Repository navigation
Conversation
…eeds A discard drops the shadow as the owner and now refuses missing USAGE up front instead of failing mid-drop; a resume that only finishes a committed swap creates nothing and is no longer refused for missing CREATE.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Correctness review at What I checked. I traced every door that now asks the owner for less, from the preflight call down to the SQL each later step runs and the role it runs it as.
0 blocking, 4 non-blocking. BlockingNone. I could not construct an input where the narrowed preflight passes and a later step then fails on a privilege the preflight no longer asks for:
Non-blocking
This review was generated by Claude Code (claude-sonnet-5-5). |
|
🤖 Second pass at What I checked. The new and changed tests against the paths they are meant to pin, the existing owner-privilege and discard tests they sit beside, and the failure paths that now return a 0 blocking, 4 non-blocking. BlockingNone. Every changed behavior has at least one test that fails if the change is reverted:
Non-blocking
This review was generated by Claude Code (claude-sonnet-5-5). |
aparajon
left a comment
There was a problem hiding this comment.
🤖 Approving at 6294af7: 0 blocking, 8 non-blocking (details in the comments above).
Each narrowed owner preflight matches what its later steps run, and the new tests pin both the refusal and the leftovers that must stand after it. The non-blocking items are a missing USAGE check on the DiscardGone door (and the matching doc wording) plus test and wording gaps.
This review was generated by Claude Code (claude-sonnet-5-5).
|
🤖 Reviewed The automated review result was unavailable. No local tests were run. |
Each copy-and-swap entry point now checks only the schema access the table's owner actually needs for what it does: a discard checks
USAGEbefore it drops anything, and a resume that only finishes an already-committed swap no longer needsCREATE.Why
Copy-and-swap does its writes as the table's owner, so before a run starts pg-sprite checks that the owner can reach the table's schema (
USAGE) and create in it (CREATE). Every entry point asked for both, which was wrong in two ways. A discard, which abandons a stopped run, drops the half-built copy as the owner but never checkedUSAGE, so it could fail with "permission denied" halfway through cleaning up. A resume whose swap had already committed creates nothing, but it was still refused withoutCREATE, while its replication slot kept holding WAL on the server.What
checkCopySwapOwnerSchematakes aneedCreateflag.CheckCopySwapEnvironmentpassesfalsefor a run that only finishes a committed swap (Held.SwapCommitted). That run still needsUSAGE, because it drops the retained source as the owner.preflight.CheckCopySwapOwnerUsage.Runner.Discardcalls it in both discard paths once it has found a shadow, before the first drop. A discard that finds no shadow is not checked.USAGE-only refusal reuses*preflight.PrivilegeError(reasoninsufficient-privileges), with its own hint and a grant forUSAGEalone.pg-sprite discardmaps it to its refusal report. No new cause.--restart, desired-plan statements and resumes before the swap still need both privileges.main:USAGEwith nothing dropped, then succeeds once the owner holdsUSAGEthrough a granted role.USAGEalone. OncePUBLICholdsUSAGEit is admitted and finishes, while a fresh run and a restart are still refused forCREATE.engine-role.mdlists what each entry point needs.copy-and-swap.md,copy-and-swap-design.md,cli.md,invariants.md,refusal-classes.mdandtcb-model.mdnow match.Before / after
The table
app.ordersbelongs toorders_owner, who has lostUSAGEandCREATEon schemaapp. Two operators each run a different command against a stopped run.