Count every part R2 acknowledges so gates can prove nothing was resent#66

merged1
dev
feat/gate-1-ledger
openedOct 2, 2026byAAviddaram
View on GitHubTwo-way sync enabledPR last imported 20d ago

The release gates have to prove a 100 GB upload never resent bytes it didn't need to. Part bytes go from the browser straight to R2, so the API never sees them, and nothing could check that.

This layer adds the parts ledger. It records every browser request to R2 from the browser's own network events, then summarize turns them into the numbers a gate asserts on.

text
1R2Request { at, session, kind: create|part|list|complete|abort, partNumber, uploadId, status }
2
3status 200 acked: R2 has those bytes and the browser knows it
4status null no response (offline, reload, crash): may or may not have landed
5
6summarize(requests, fileSize) →
7 uploadIds one transfer, one multipart upload
8 parts.avoidable acked, then sent again ← a gate fails on any
9 parts.missing never acked
10 parts.unanswered died in flight, resending them is fine
11 bytes.acked / avoidable / unacknowledged

Ledger is the live version a run uses. It settles entries as responses arrive, appends each one to ledger.jsonl, and lets a scenario wait for N acked parts without sleeping. If no new part is acked for 10 minutes, the run fails as stalled. 12 tests in ledger.test.ts pin the counting rules.

Checks

4 successful · 2 skipped
All checks passed
a1545fe

Added 1 commit

  • Add the R2 parts ledger with guarantee testsa1545fe
Synced from GitHub

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b4581a77-33a2-47c7-b08c-f37ce0061389

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.