Skip to content

chore(issues): re-verify #ZBAC9D with code evidence and a measured exposure count - #2494

Merged
BigSimmo merged 4 commits into
mainfrom
claude/zbac9d-ledger-evidence
Sep 1, 2026
Merged

chore(issues): re-verify #ZBAC9D with code evidence and a measured exposure count#2494
BigSimmo merged 4 commits into
mainfrom
claude/zbac9d-ledger-evidence

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Queue append-only inbox requests replacing the detail on #ZBAC9D with re-verified code evidence and a measured production exposure count, keeping it at P2.

No product code, no migration, no schema change. The canonical ledger docs/outstanding-issues.md is untouched; these are immutable request files under docs/outstanding-issues-inbox/, applied later by a serialized npm run issues:reconcile.

Three request files, which is the inbox's designed retraction path rather than an edit: an initial update raising the row to P1, a cancel retracting it, and the final update at P2. The cancelled request is retained for the audit trail and is dropped from the active set at reconcile time.

The hazard

documents.owner_id is ON DELETE SET NULL while a null owner independently means "public corpus", so deleting an auth user would silently republish that user's private documents.

The code defect — real, and worse than the row previously recorded

The retrieval path is closed at no layer. public.retrieval_owner_matches resolves the public sentinel to row_owner_id is null with no public_corpus condition, and public_corpus appears zero times across src/lib/rag/rag-candidate-sources.ts, corpus-grounding.ts, deep-memory.ts, document-enrichment.ts, owner-scope.ts, clinical-search.ts and query-privacy.ts.

The helper written for exactly this hazard is dead code. src/lib/documents/is-public-document.ts requires owner_id === null && metadata.public_corpus === true, and tests/documents-is-public.test.ts:22 pins the precise case ("Orphaned after user delete"false). No production caller exists outside its own module and the barrel re-export. Same dead-contract shape as #A3AHCX.

One path is genuinely closed: the REST document read, via withOwnerReadScope in src/lib/public-api-access.ts:116. The previous wording "the application read paths were closed" is true only of that path.

The measured exposure — and why this stays P2

The owner approved a read-only count against production (sjrfecxgysukkwxsowpy, GET only):

Measure Count
total documents 2851
owner_id NOT NULL (privately owned) 0
owner_id IS NULL (treated as public by retrieval) 2851
…of those, carrying metadata.public_corpus = true 2851
exposed (null owner, no published marker) 0

The entire production corpus is deliberately published and no document is privately owned, so there is nothing for the mechanism to leak and its trigger — deleting an auth user who owns documents — cannot fire.

That is why the P1 escalation queued earlier in this PR is cancelled rather than kept. It was raised on the code evidence before the count was run, and the count does not support it.

The trigger condition matters more than the priority: this must be closed before the first privately-owned document exists in production, because from that moment the hazard is live, silent, and the helper that would catch it is dead.

A useful side effect of the measurement: because all 2851 documents carry the marker, adding the public_corpus predicate to the retrieval path should move zero rows, which makes the required eval-canary an unusually safe one.

Verification

Documentation and ledger paperwork only. Code claims were checked by reading origin/main at a633eb6e3. The counts came from four read-only GET requests against the PostgREST endpoint, guarded by a script that refuses to run unless the project ref is exactly sjrfecxgysukkwxsowpy; no value of any secret was printed, and no write, migration, OpenAI or Railway access occurred. npx prettier reports the added files already formatted. No unit, build or browser check was run: this diff contains no executable code. npm run check:ledger-write-discipline in CI is the gate that governs this path.

🤖 Generated with Claude Code

Re-verified the orphaned-document republication hazard against main
a633eb6. The row understated it.

The retrieval path is closed at no layer: retrieval_owner_matches still
resolves the public sentinel to `row_owner_id is null`, and public_corpus
appears zero times across rag-candidate-sources, corpus-grounding,
deep-memory, document-enrichment, owner-scope, clinical-search and
query-privacy. The helper written to close the hazard,
src/lib/documents/is-public-document.ts, has no production caller — it is
exercised only by its own test, which pins the exact orphaned-row case.
Only the REST document read is genuinely closed, via withOwnerReadScope.

Append-only inbox request; the canonical ledger is untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: dc2d3362-d6ca-4567-af5a-89d95a66774b


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.

@supabase

supabase Bot commented Sep 1, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@cursor

cursor Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_a294f250-96f2-45ac-a339-69ab28a6b3f3)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T09:45:18.134182Z 651e999 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 651e999152

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/outstanding-issues-inbox/224cda1c-ae72-4921-b8aa-e6b3e315796a.json Outdated
@BigSimmo
BigSimmo merged commit fdbaf94 into main Sep 1, 2026
38 checks passed
@BigSimmo
BigSimmo deleted the claude/zbac9d-ledger-evidence branch September 1, 2026 10:35
@BigSimmo BigSimmo changed the title chore(issues): raise #ZBAC9D to P1 with verified retrieval-path evidence chore(issues): re-verify #ZBAC9D with code evidence and a measured exposure count Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant