Repository navigation
Sweep and purge primary objects per org (multi startup still refused) - #198
Merged
Merged
Conversation
RunObjectGC is the multi-mode blob sweep: per (org_id, digest), under the blob session lock, rows commit before the object delete. The purge now deletes the org's object prefix and marks the tombstone purged only after that succeeds. Startup stays refused; binding comes with enablement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
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. |
Member
Author
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-198, 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 |
Member
Author
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 |
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.
In one line: Multi mode now has a primary-object blob GC and an org purge that erases the org's object-storage prefix; neither is bound to startup, which stays refused.
What changed
storage.RunObjectGCsweeps unreferenced blobs per(org_id, digest), at most 100 a pass, serving orgs only. Identical ciphertext in another org is never touched.storage.BlobLockName), re-checks, commits the row deletes, then deletes every version of the object. A failed delete leaves an object with no row, never a row with no object.PurgeObjectsstep, refuses before deleting anything when there is none, deletesorgs/<org_id>/after the rows and marks the tombstone purged only if that worked.Review this
internal/storage/object_gc.go:orgUnreferencedandsweepObject. A predicate that ignores the org, or a delete that runs before the commit, loses another org's data or leaves a row pointing at a missing object.internal/storage/purge.goPurgeOrg: purged is marked only after the prefix delete succeeds.Checked: full local suites on SQLite, FIPS and PostgreSQL 17, plus build/vet/gofmt/govulncheck/docs/no-binaries (details below). Four mutations (org-blind candidates, no re-check under lock, object delete before commit, purge without the prefix step) each fail their test.
Not checked: web/e2e/Docker image (no web or image input changed; CI runs them). No real provider: tests use the real shared client over the local TLS S3 fixture.
Decided for you: the purge's object step is a function value (
PurgeObjects), so the row-only purge tests ininternal/storageneed no S3 fixture. The realObjects.Purgeis tested ininternal/blobstore.You need to: nothing. The late-PUT fence is the stacked PR on top of this one.
Detail
Spec: new "PR 5b-3 as built" section in
docs/superpowers/specs/2026-11-23-tenancy-design.md. Contracts updated inAGENTS.md,internal/blobstore/AGENTS.mdandDESIGN.md.Tests (PostgreSQL, real
ky-primitives/s3client over TLS):TestObjectGCSweepsOnlyTheUnreferencedOrgsCopy,TestObjectGCWaitsForTheBlobLockAndRechecks,TestObjectGCDeleteFailureLeavesNoRowPointingAtAMissingObject,TestObjectGCWaitsWhileTheOrgIsStoppedAndRefusesSingleMode,TestPurgeDeletesOnlyTheDeletedOrgsPrefix. On both backends:TestPurgeRefusesWithoutObjectsAndKeepsTheOrgUnpurged.Local full run (Major, Go 1.27.3, shared lock with a 6 GiB cap, own
postgres:17-alpinecontainer removed by a trap):Cells (C5): the cell list and refusal belong to the enablement PR.
storage.OrgServes(internal/storage/orgs.go) compareshome_regionwith oneregionsetting. It becomes a membership test against the recorded cell list, and object keys gain the cell prefix inblobstore.OrgPrefix.🤖 Generated with Claude Code