Harden R2 publication, corpus rebuild, progress, and error boundaries#14
Merged
Merged
Conversation
…dd smoketest script The recommended R2 token (Object Read & Write, scoped to one bucket) cannot create buckets, but `depot init` auto-created missing buckets and its 403 hint told users to re-check permissions that were already correct. ensureBucket now surfaces non-NotFound HeadBucket errors as themselves, names the bucket-creation step when CreateBucket is denied, and the hint layer answers that case with "pre-create the bucket" instead. Onboarding §8 is reordered into dependency order: bucket, then bucket-scoped token, then init. The production R2 client pins request/response checksums to WhenRequired per Cloudflare's SDK guidance — R2 implements x-amz-checksum-* only partially, the SDK default attaches checksums to every PutObject, and the fake-S3 suite can never catch that mismatch. scripts/r2-smoketest.sh preflights the R2 environment with per-variable guidance and runs the live-bucket integration test (-count=1, so a cached pass can't vouch for the live service). Docs: bucket-lock guidance scoped to blobs/ (locking machines/ would break the conditional pointer/index overwrites every push performs), Account-vs-User token choice, temporary credentials for CI, location hints, and a troubleshooting entry for the create-bucket denial. https://claude.ai/code/session_01PtaKyYUoZtmThtvxFCskYA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is a release-hardening pass across R2 depot publication, corpus migration, progress/error contracts, and verification infrastructure. It is intentionally described as one correctness-by-construction change set: the CLI, storage protocols, smoke capabilities, and tests now enforce the same safety invariants end to end.
What changed
Depot and R2
Corpus rebuild and lifecycle
aha corpus rebuild --backup; there is no unsafe no-backup operation.rebuild_lockprogress phase.Public UX contracts
auto|off|plain|tty|json).aha.error.v1, one structured next action, and allowlisted verbose diagnostics.Verification and documentation
/tmppaths.Key invariants
Testing
make verify-full— passgo test ./...go vet ./...go test -race ./...scripts/r2-smoketest-target.json— pass.scripts/r2-smoketest.shrun against the source-pinned bucket — pass, including push/delta/reuse/pull/deep-verify and concurrent first-push coverage. The wrapper confirmed the test-only target/capability boundary before mutation and completed cleanup.Risk and review plan
This is a large cross-cutting PR, not the narrow onboarding change in its original description. Splitting it now would separate mutually dependent protocol, CLI, safety, and conformance guarantees and make intermediate branches misleadingly unsafe, so the PR metadata is expanded instead.
Recommended review order:
internal/depot/{push_v2,depot_v2,r2_integration_v2_test}.gointernal/corpus/{rebuild,lifecycle_lock,path_identity,durability,swap_*}.gointernal/usererrorand CLI/MCP/HTTP boundariesinternal/progressand progress call sitesscripts/r2-smoketest*.sh,scripts/verify.sh, and test-quality guardsResidual platform note: atomic corpus rebuild promotion is intentionally supported only on Darwin/Linux; Windows returns an explicit unsupported error. Existing corpus operations still build on Windows.