Repository navigation
Fence late object PUTs out of org purge and GC (multi startup still refused) - #199
Conversation
A PUT admitted before an org's deletion can still be stored after the purge erased its prefix. Every object PUT is now bounded from entry, and the purge marks the org purged only after a prefix delete at least LatePutWindow past its database-time fence. An age-gated orphan sweep, run by object GC under the blob and upload locks, removes late PUTs after GC or erasure. The shared client pin moves to the #78 merge for provider modification times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process: ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪🧪 PR contains tests⚡ No major issues detectedAdvisory only: this comment never gates the pull request. |
Security review - clearedDetail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kynotes-server-199, where it is readable by the operator and expires seven days after the last post. gpt-6.1-sol using security-audit on behalf of Yoshi |
Autonomous review - 1/1 personas cleared
Merging remains a human decision; this bot never approves. gpt-6.1-sol using security-audit on behalf of Yoshi |
…nt org state The orphan sweep decided from an org query read before the listing, so an org stopped meanwhile could lose objects. Each deletion now re-reads that the org serves, with the claim, in a short transaction under its session lock. The purge re-reads the status before the prefix delete and requires deleted when it marks the tombstone. The purge batch hook now runs after each commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire Fixed in ed3735b. The reported gap was real. The same pattern (a decision based on org state read earlier) also existed in the purge, so that is fixed too.
Remaining gap (judgment, not tested): a suspension that commits after an admitted deletion's transaction cannot stop that one delete. That is the same ordering GC already has: the decision is made while the org serves. |
In one line: A write that reaches object storage after an org's purge, or after GC deleted a blob, can no longer outlive the erasure. The purge waits out a 20-minute late-PUT window before it reports the org purged, and an age-gated orphan sweep removes the rest. Builds on #198 (merged). Multi startup is still refused.
What changed
Objects.Put/PutPart) is bounded by a 5-minute deadline from entry.org_purge_startedaudit, on the first run only. It deletes rows and the org prefix on every run, but marks the tombstone purged only on a run that started its prefix delete at leastLatePutWindow(20 min: deadline plus SigV4's 15-minute request age) after the fence.SweepOrphanObjects, run at the end ofRunObjectGC, deletes a serving org's blob with no row, or an upload's parts with no pending session, once the provider says it is over an hour old. The re-check runs under the blob or upload session lock. Unknown age (zeroLastModified) never deletes.79823f9) to the chore(deps): bump the npm-build group in /web with 2 updates #78 merge (b55ca6d) for provider modification times (s3only; no other package changed).deletedbefore the prefix delete and when marking (Guide finding, fixed in ed3735b).Review this
internal/storage/purge.goPurgeOrg/purgeFence:waitedmust be computed before the prefix delete, and from database time. If either is wrong, a late PUT survives a purge reported complete.internal/blobstore/objects.goputDeadline/LatePutWindow: the window is only as sound as its premise. A provider that commits a PUT more than 20 minutes after the client signed it breaks it. Unproven on a real provider.internal/storage/object_gc.goSweepOrphanObjects/dropOrphan: deleting a claimed object loses data, so check the in-lock claim query.Last-Modifiedplumbing and the doc edits.Checked: full suites on SQLite, FIPS and PostgreSQL 17, plus build/vet/gofmt/tidy/govulncheck/docs/no-binaries (details below). Mutations each fail their test: no window check, no put deadline, no age check, no claim re-check, no pending-upload check, no serving re-check, and either purge status re-read. Full checks were re-run at ed3735b (results in the PR comment).
Not checked: a real provider's request-age and late-commit behaviour, and provider/database clock skew past a few minutes; both are provider qualification. Web/e2e/image: no inputs changed.
Decided for you: a time fence instead of a durable operation ledger, because it needs no new table. The
org_purge_startedaudit is now written once per purge instead of on every resumed run, so the 20-minute wait does not write one row a minute. The orphan age is the spec's hour, which is longer than the window.You need to: nothing for this PR. Provider qualification of the window stays open before any readiness claim.
Detail
New tests (PostgreSQL, real shared client over the TLS fixture):
TestLatePutAfterPurgeIsErasedBeforeTheOrgIsMarkedPurged: the fixture holds a PUT at the provider, the client's deadline expires, and the purge runs. Then the provider stores the PUT, so it lands after the prefix delete. The test requires the org to stay unpurged inside the window and the run after the window to leave noorgs/org_b/key.TestOrphanSweepDeletesOnlyOldUnclaimedObjects: young, unknown-age, claimed, pending-upload and stopped-org objects stay; an old unclaimed blob and an abandoned upload's parts go.purge_fence:<org>and assert a single started audit.Mutation runs (kjob, PG 17 on K hosts):
Full checks:
Cells (C5): the cell list and refusal belong to the enablement PR.
storage.OrgServes(internal/storage/orgs.go) becomes a test against the recorded cell list. The purge fence and the orphan sweep need no change; the orphan sweep lists only serving orgs, so it follows that change by itself.blobstore.OrgPrefixgains the cell prefix.🤖 Generated with Claude Code