feat: add cleanup unfinished uploads#144
Conversation
|
Build artifact for this PR: |
There was a problem hiding this comment.
Pull request overview
Adds a new cleanup-unfinished action verb to help reclaim storage by listing unfinished B2 multipart uploads (optionally scoped by source prefix) and canceling them, with dry-run preview support and reporting via standard outputs.
Changes:
- Implement
cleanup-unfinishedcommand that paginates unfinished uploads, summarizes part counts/bytes, and cancels uploads (or previews underdry-run). - Wire the new verb into the main dispatcher and output/summary reporting (
files-deleted,file-count,summary-json). - Update docs/metadata (README, action.yml, DEVELOPMENT, CHANGELOG) and add test coverage for the new verb.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main.ts | Dispatches cleanup-unfinished and emits outputs + step summary. |
| src/inputs.ts | Adds cleanup-unfinished to valid actions and dry-run documentation. |
| src/commands/cleanup-unfinished.ts | Implements listing/part summarization and cancellation of unfinished multipart uploads. |
| README.md | Documents the new verb, usage example, and output semantics. |
| action.yml | Exposes the new verb in action metadata and descriptions. |
| DEVELOPMENT.md | Updates diagrams/docs to include the new verb. |
| CHANGELOG.md | Records the new feature under Unreleased. |
| tests/main.test.ts | Adds dispatcher and summary/output assertions for cleanup-unfinished. |
| tests/main-output-contract.test.ts | Adds output contract expectations for cleanup-unfinished. |
| tests/commands/cleanup-unfinished.test.ts | Adds unit tests for cancel/preview behavior and error logging hygiene. |
| dist/index.js | Updates the bundled distribution output to include the new verb. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Build artifact for this PR: |
|
Build artifact for this PR: |
|
Build artifact for this PR: |
|
Build artifact for this PR: |
|
Build artifact for this PR: |
c93d5ad to
a86060b
Compare
|
Build artifact for this PR: |
Summary
cleanup-unfinishedto list unfinished B2 large uploads under an optionalsourceprefix and cancel matched uploads, withdry-runpreview supportallow-bucket-cleanup: true; active, unknown, or part-scan-truncated uploads are skipped unlesscleanup-unfinished-force: truefiles-deleted,file-count, and projected cleanupsummary-jsonentries with status, reason, bounded best-effort part diagnostics, sanitized cancel diagnostics that retain safe B2 error codes, and no B2fileInfometadatafailedentries instead of aborting the cleanup loopdistFixes #98
Tests
pnpm test __tests__/commands/cleanup-unfinished.test.ts __tests__/main.test.ts __tests__/main-output-contract.test.ts __tests__/inputs.test.ts __tests__/errors.test.tspnpm test __tests__/commands/cleanup-unfinished.test.tspnpm test __tests__/main.test.tspnpm typecheckpnpm testpnpm lintpnpm spellcheckpnpm docs:check-action-ymlpnpm check:release-provenancepnpm buildvitest --coverageFollow-up notes