Skip to content

Preserve multipart recovery state for missing upload IDs - #244

Open
rootzero00 wants to merge 2 commits into
antiwork:mainfrom
rootzero00:fix/multipart-upload-not-found-recovery
Open

rootzero00 wants to merge 2 commits into
antiwork:mainfrom
rootzero00:fix/multipart-upload-not-found-recovery

Conversation

@rootzero00

@rootzero00 rootzero00 commented Nov 22, 2026 •

Copy link
Copy Markdown

What

  • Parse the API's structured error_code into APIError.Code without changing legacy error-message handling.
  • Treat HTTP 400 with the exact multipart_upload_not_found code returned by /files/complete as an uncertain completion outcome rather than a definitive rejection.
  • Preserve the recovery manifest, upload ID, object key, completed part numbers, and ETags.
  • Avoid automatic multipart abort for this specific uncertain completion outcome.
  • Provide safer terminal and JSON guidance: retain recovery information and verify the original upload's outcome before taking further action.
  • Preserve existing behavior for untagged HTTP 400 responses, unrelated codes, and other definitive failures.

Why

A missing multipart upload ID does not establish whether an earlier completion succeeded or the upload was otherwise removed.

Previously, the CLI classified this response as complete_rejected, potentially suggesting replay or abort even though the completion outcome was uncertain.

The related Rails API change, antiwork/gumroad#9245, introduced the machine-readable multipart_upload_not_found error code. This contribution uses that exact code alongside HTTP 400 to distinguish uncertain completion from ordinary definitive failures without matching error-message text.

The approach preserves backward compatibility and the recovery information needed for reconciliation.

Before / After

Terminal recording: Gumroad CLI — Multipart Recovery Before/After Demonstration

Scenario Before After
HTTP 400 with multipart_upload_not_found complete_rejected complete_state_unknown
Seller guidance for tagged HTTP 400 Suggests replay or abort Retain recovery manifest and verify the original outcome
HTTP 400 without the structured code complete_rejected complete_rejected (unchanged)
Unrelated structured error code Definitive rejection Definitive rejection (unchanged)
Recovery information Retained Retained, including upload ID, key, completed parts, and ETags
Automatic abort in demonstrated cases No abort requests No abort requests

The demonstration uses a synthetic loopback HTTP server exercising the CLI binaries. It is not production Gumroad API or S3 validation.

Test Results

Local verification used Go 1.25.4 and the repository's applicable checks:

Verification Result
make build PASS
make test PASS
make test-cover PASS
make test-race PASS
make lint (golangci-lint v1.64.8) PASS
Go formatting verification PASS
Git whitespace verification PASS
Eight-case before/after CLI demonstration PASS
Recovery-manifest preservation PASS
No automatic abort requests in the demonstrated cases PASS
Eight-file commit verification PASS
Post-commit working tree Clean

The initial umask 0077 run exposed a file-permission-sensitive test-environment problem; the controlled umask 0022 execution passed the applicable tests, coverage gates, and race checks. Previously recorded logs were subsequently read back with integrity checks; this did not rerun the tests.

Local test-results screenshot: Verified pre-push test evidence (build, tests, coverage, race detection, lint, and log integrity).

Gumroad-CLI-Prepush-Test-Results

Source commit: 9fdc51ea906875586073b8dedcefa43927e8c9f5

Base commit: 9c216072aefba8346bfc569d299575db335993d4

These results cover local implementation and synthetic HTTP behavior, not production end-to-end validation against Gumroad/S3.

Self-review

The eight-file diff was reviewed, including exact HTTP 400/error-code matching; absent, unrelated, case-mismatched and malformed codes; HTTP 403/500 controls; original API error preservation; uncertain versus definitive classification; manifest, upload ID, key, part and ETag retention; automatic-abort suppression; and terminal/JSON guidance.

No unresolved source defect was identified within the locally tested scope. Production behavior remains unverified.

Related Contribution


AI Disclosure

Model: OpenAI GPT-6 (ChatGPT).

AI assistance was used for implementation analysis, error-classification reasoning, regression-test and verification planning, verification-script preparation, local test-result interpretation, terminal demonstration preparation, source self-review, and PR drafting. The contributor reviewed the changes, executed local verification, assessed the evidence, and authorized publication actions.

Representative prompts and instructions given to the assistant:

  • Prioritize safe multipart completion recovery and preserve uncertain completion state.
  • Verify the local seller-guidance correction and its regression behavior.
  • Run the isolated pre-push suite: build, tests, coverage, race detection, and lint.
  • Record a before/after terminal demonstration of the CLI behavior.
  • Prepare the Gumroad CLI PR package, including the test screenshot, PR description, AI disclosure, and final self-review.
  • Review all eight contribution files before committing.
  • Create one local commit containing exactly the reviewed files.
  • Publish the verified commit to the contributor's fork and create the upstream PR under explicit authorization.

This is a representative summary of prompts and instructions, not a complete verbatim transcript of every prior development prompt.

@rootzero00
rootzero00 marked this pull request as ready for review November 22, 2026 10:27
@tastelint

tastelint Bot commented Nov 22, 2026

Copy link
Copy Markdown

Tastelint

The only picture is a PowerShell window replaying test logs, not a user interface, so there is nothing here to review.

@rootzero00

Copy link
Copy Markdown
Author

@claude review once

@gumclaw gumclaw self-assigned this Nov 22, 2026
@gumclaw gumclaw added the awaiting-human Waiting on a human response/decision; assignee is that human label Nov 22, 2026
@gumclaw gumclaw assigned gianfrancopiana and unassigned gumclaw Nov 22, 2026
@gumclaw

gumclaw commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed at head 6ec9c4b: the change is correct and narrow — the tagged HTTP 400 becomes complete_state_unknown in both the files complete and upload paths, with the recovery manifest preserved and automatic abort suppressed only for that case. No Claude review bot is configured here, so the merge call is the maintainer's.

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

Labels

awaiting-human Waiting on a human response/decision; assignee is that human

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants