Skip to content

Share the broker receipt binding guard - #5433

Merged
freeqaz-openai merged 1 commit into
mainfrom
refactor/share-broker-receipt-binding
Nov 11, 2026
Merged

freeqaz-openai merged 1 commit into
mainfrom
refactor/share-broker-receipt-binding

Conversation

@freeqaz-openai

Copy link
Copy Markdown
Collaborator

Summary

  • Use one guard for the persisted attempt binding checked by broker receipt admission, bind, fence, and disposal.
  • Keep each row lock inside its existing State transaction and retain the operation-specific recovery, status, and disposal rules.

Verification

  • Workspace audit, TypeScript type-check, ESLint, and focused formatting passed.
  • Native cutover integration suite passed all 8 tests, including prepared sender binding and recovery that fences the original ID without creating a replacement.
  • The focused broker receipt suite on the PostgreSQL lane reported 8 passing test records, including generation-scoped fencing and confirmed disposal across service restart. The suite includes memory and PostgreSQL cases.
  • A paired local probe produced identical refusal order in 8 cases across the four operations. Each variant checked its loaded source hash. The probe used an instrumented State transaction fixture.

Coverage is local to the named suites and probe. Hosted checks will run on the pull request.

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@freeqaz-openai
freeqaz-openai marked this pull request as ready for review November 11, 2026 08:16
@freeqaz-openai
freeqaz-openai requested a review from a team as a code owner November 11, 2026 08:16
@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 11, 2026
@clawsweeper

clawsweeper Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR centralizes rejection of missing or mismatched persisted attempts across four broker receipt operations.

Example: A protocol-3 prepared attempt is presented without preparedOnly: true.

  • Before: The operation rejects with RECEIPT_UNAVAILABLE before accessing its receipt.
  • After: The shared guard rejects with the same error at the same point.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A correct, narrowly scoped refactor supported by relevant integration coverage and source equivalence; evidence remains at harness level.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored refactor is outside the ordinary contributor proof gate; reported native-control and PostgreSQL integration runs exercise receipt binding, recovery, and disposal, while the paired probe uses an instrumented State fixture.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The collaborator-authored direction is authorized, and the small extraction gives all four operations one rejection owner without changing supported behavior.

Merge readiness

✅ Ready for maintainer review

Keep this PR open for maintainer triage: it is a focused, behavior-preserving refactor with no actionable correctness or security findings.

Priority: P3
Reviewed head: 365d37e37de6a37e4d80b2579f45112a3433f629

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied verification covers integration harnesses rather than an attached run through the shipped worker and broker entry points.
Agent review details

How this fits together

The worker-owned receipt store receives broker journal commands, validates their persisted attempt inside a State transaction, and reads or advances durable receipt state.

flowchart TB
  Broker[Credential broker] --> Listener[Private receipt listener]
  Listener --> Store[Worker receipt store]
  Store --> Transaction[State transaction and attempt lock]
  Transaction --> Guard[Shared binding guard]
  Guard --> Receipts[Receipt reads and transitions]
Loading

Technical review

Best possible solution:

Retain the shared private guard with the existing transaction, protocol, ownership, generation, and disposal rules intact.

Do we have a high-confidence way to reproduce the issue?

This PR reports duplicated rejection handling rather than a behavioral bug; source comparison confirms the repeated checks.

Is this the best way to solve the issue?

The existing receipt store remains the sole owner, and the extraction removes repetition without adding a parallel path or changing its contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0f82ccf02e7f.

Provenance checked

  • Exact persisted-attempt binding and fail-closed receipt handling keeps the original intent (24ae029: Recover confirmed disposal after broker loss without treating missing or uncertain evidence as disposal.)
  • Shared ownership validation across receipt mutations keeps the original intent (ba3bf4a: Share backend and Driver ownership checks while retaining requested-protocol checks, terminal-read restrictions, and transaction-local mutation rules.)
  • Generation-scoped reservation fencing keeps the original intent (5b1512f: Allow the reserving broker to fence an unbound reservation so recovery does not remain unavailable indefinitely.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Introduced change preserves behavior: The pinned introduced diff retains every binding predicate, short-circuit order, transaction boundary, operation-specific check, and receipt transition; it moves the existing missing-attempt rejection into the private guard. (apps/controller/src/backends/repository-credentials/receipt-store.ts:26, 365d37e37de6)
  • Current main and merge scope: Fetched main retains the pre-refactor receipt store. The verified test merge changes only this file relative to its base parent, preserving the independent base-side configuration change. (apps/controller/src/backends/repository-credentials/receipt-store.ts, 0485a2794e89)
  • Established receipt contract: The durable receipt design in Recover confirmed repository credential disposal #534 requires exact attempt/session/grant/generation binding and committed disposal evidence; refactor(credentials): share receipt attempt ownership checks #4939 subsequently shared ownership checks while preserving operation-specific rules. This PR respects both decisions. (apps/controller/src/backends/repository-credentials/receipt-store.ts:49, ba3bf4a62e72)
  • Relevant integration coverage: Existing native-cutover coverage exercises the real control handler and receipt listener with in-memory State, including prepared binding and rejection of an unmarked protocol-3 lookup; PostgreSQL receipt coverage exercises generation fencing, durable disposal recovery, and shutdown acknowledgment. (tests/integration/repository-native-cutover.test.ts:245, 365d37e37de6)
  • Discussion and head checks: The full body reports focused integration runs and an instrumented refusal-order comparison; comments contain no additional behavior evidence. Checks on the reviewed head include successful CI Required, PostgreSQL Platform, and Checks and Conformance 2. Job-log retrieval was blocked by the network allowlist, so individual hosted test execution was not independently verified. (365d37e37de6)
  • Policy and history inspection: Read the complete root AGENTS.md; no ancestor instruction files, maintainer-note directory, or pr-simplify skill were present for this path. Applied the single-reviewer restriction without running a helper. Path history, prior refactor hunks, and current-main blame establish shared ownership; follow-history traversal encountered one unavailable historical blob. (AGENTS.md, 0f82ccf02e7f)

Likely related people:

  • kevinlin-openai: Raw commit 24ae029 adds apps/controller/src/backends/repository-credentials/receipt-store.ts:32 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 24ae029557b3; files: apps/controller/src/backends/repository-credentials/receipt-store.ts)
  • stevenlee-oai: Raw commit ba3bf4a adds apps/controller/src/backends/repository-credentials/receipt-store.ts:29 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ba3bf4a62e72; files: apps/controller/src/backends/repository-credentials/receipt-store.ts)
  • Free Wortley: Raw commit 7fed115 adds apps/controller/src/backends/repository-credentials/receipt-store.ts:210 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7fed115af7b5; files: apps/controller/src/backends/repository-credentials/receipt-store.ts)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P3: This is internal cleanup with equivalent observable behavior and no identified user-facing regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is internal cleanup with equivalent observable behavior and no identified user-facing regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 11, 2026, 3:29 AM ET / 08:29 UTC.

@freeqaz-openai
freeqaz-openai merged commit 6b4e851 into main Nov 11, 2026
66 checks passed
@freeqaz-openai
freeqaz-openai deleted the refactor/share-broker-receipt-binding branch November 11, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant