Skip to content

feat: add cleanup unfinished uploads#144

Open
goanpeca wants to merge 10 commits into
mainfrom
feat/98-cleanup-unfinished
Open

feat: add cleanup unfinished uploads#144
goanpeca wants to merge 10 commits into
mainfrom
feat/98-cleanup-unfinished

Conversation

@goanpeca

@goanpeca goanpeca commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add cleanup-unfinished to list unfinished B2 large uploads under an optional source prefix and cancel matched uploads, with dry-run preview support
  • add conservative cleanup safeguards: non-dry-run whole-bucket cleanup requires allow-bucket-cleanup: true; active, unknown, or part-scan-truncated uploads are skipped unless cleanup-unfinished-force: true
  • emit files-deleted, file-count, and projected cleanup summary-json entries with status, reason, bounded best-effort part diagnostics, sanitized cancel diagnostics that retain safe B2 error codes, and no B2 fileInfo metadata
  • harden cleanup failure handling so cancel errors with missing details still produce structured failed entries instead of aborting the cleanup loop
  • document the new inputs/outputs and cleanup diagnostics, and add focused tests plus updated bundled dist

Fixes #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.ts
  • pnpm test __tests__/commands/cleanup-unfinished.test.ts
  • pnpm test __tests__/main.test.ts
  • pnpm typecheck
  • pnpm test
  • pnpm lint
  • pnpm spellcheck
  • pnpm docs:check-action-yml
  • pnpm check:release-provenance
  • pnpm build
  • pre-push hook: vitest --coverage

Follow-up notes

  • None.

Copilot AI review requested due to automatic review settings July 7, 2026 13:26
@goanpeca goanpeca added this to the v1.2.0 milestone Jul 7, 2026
@goanpeca goanpeca added enhancement New feature or request reliability Runtime resilience and failure handling sdk-parity SDK capability not yet exposed by the action labels Jul 7, 2026
@goanpeca goanpeca self-assigned this Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-unfinished command that paginates unfinished uploads, summarizes part counts/bytes, and cancels uploads (or previews under dry-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.

Comment thread src/commands/cleanup-unfinished.ts
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated 2 comments.

Comment thread src/main.ts
Comment thread src/inputs.ts
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated 1 comment.

Comment thread src/commands/cleanup-unfinished.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated 2 comments.

Comment thread README.md
Comment thread action.yml
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated 1 comment.

Comment thread src/main.ts
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated no new comments.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated 1 comment.

Comment thread src/commands/cleanup-unfinished.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated 1 comment.

Comment thread src/commands/cleanup-unfinished.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated no new comments.

@goanpeca
goanpeca marked this pull request as ready for review July 7, 2026 14:53
Copilot AI review requested due to automatic review settings July 8, 2026 23:17
@goanpeca
goanpeca force-pushed the feat/98-cleanup-unfinished branch from c93d5ad to a86060b Compare July 8, 2026 23:18
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request reliability Runtime resilience and failure handling sdk-parity SDK capability not yet exposed by the action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cleanup-unfinished: list and cancel unfinished large uploads to reclaim storage

2 participants