Conversation
Most commands only called m.Close() (which removes the temp c1z copy) but never called store.Close() (which cleans up the decompressed SQLite temp directory). This caused temp directories to accumulate on every invocation. Also fixes principals_compare.go which was closing the wrong manager (m instead of mCompare) and adds missing m.Close() to c1z.go. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (13)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ggreer
left a comment
There was a problem hiding this comment.
A test case would be nice too. Also this codebase should probably get merged into the baton-sdk repo so we don't forget to update baton-sdk in it.
Summary
defer store.Close(ctx)calls across all CLI commands that load a C1Z file. Without this, the decompressed SQLite temp directory (c1z*/db) created bydecompressC1z()is never cleaned up — only the temp c1z copy file (sync-*.c1z) was being removed bym.Close().principals_compare.gowheredefer m.Close(ctx)was called twice instead of closingmCompare.defer m.Close(ctx)inc1z.goexport command.Affected commands:
stats,syncs,entitlements,resources,resource-types,principals,principals compare,grants,access,diff,csv,xlsx,c1z.Note: When running repeated operations on large syncs (especially on Windows, where the OS does not aggressively clean temp directories), the leaked temp files accumulate quickly and can exhaust disk space.
Test plan
baton statsand verify no leftoverc1z*directories remain in the system temp folderbaton resources,baton grants, and other subcommands and confirm temp cleanupbaton principals comparecorrectly closes both managers and stores🤖 Generated with Claude Code