feat(integration): bind verified publish receipts to fenced persistence - #264
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 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. Comment |
|
@cwl-noema-review |
|
Exact head moved to @cwl-noema-review |
|
Reconciled the latest exact head from
This is validation evidence, not approval. Please review only exact head |
|
@opencode-agent Please review only exact head |
|
@opencode-agent Please review only exact head |
|
@opencode-agent Current-base correction: protected main is exact head 503a4e6. Please review only PR #264 head ad485cc against that current protected main; the PR metadata may still show the older ancestor base 5544149. Do not transfer conclusions from superseded heads or stale-base reviews. |
Preserve the verified outbound-publish receipt handoff, fenced PostgreSQL recording contract, and aligned risk/traceability/UML evidence on top of current protected main. The #258 Rust toolchain-refresh paths are disjoint, so this reconciliation retains both change sets without force-pushing or changing delivery semantics beyond the existing PR delta.
| pub fn record_verified_leased_delivery_attempt( | ||
| transaction: &mut Transaction<'_>, | ||
| verified_receipt: &VerifiedIntegrationPublishReceipt, | ||
| attempt_ref: &str, | ||
| occurred_at_unix_ms: u64, | ||
| cause_code: Option<&str>, | ||
| fencing_token: u64, | ||
| ) -> Result<DeliveryAttemptPersistence, PersistenceError> { | ||
| record_leased_outbox_delivery_attempt( | ||
| transaction, | ||
| OutboxPersistenceIdentity::new( | ||
| verified_receipt.source_ref(), | ||
| verified_receipt.tenant_ref(), | ||
| verified_receipt.event_ref(), | ||
| ), | ||
| attempt_ref, | ||
| verified_receipt.outcome(), | ||
| occurred_at_unix_ms, | ||
| cause_code, | ||
| fencing_token, | ||
| ) | ||
| } |
There was a problem hiding this comment.
📝 Info: Verified handoff argument order matches target signatures
record_verified_leased_delivery_attempt (integration_delivery.rs) forwards to record_leased_outbox_delivery_attempt, whose signature is (transaction, identity, attempt_ref, outcome, occurred_at_unix_ms, cause_code, fencing_token). The forwarded order and the OutboxPersistenceIdentity::new(source, tenant, event) construction both match the target definitions in src/postgres_integration.rs. The verified-receipt design correctly prevents rebinding by deriving identity/outcome solely from the receipt rather than accepting independent caller arguments. No bug.
Was this helpful? React with 👍 or 👎 to provide feedback.
Resolved conflicts: - CHANGELOG.md: union Added bullets; Active PR #248/#287 rewritten as merged - docs/TRACEABILITY.md: main's module/migration truth plus #224 reload row; fixed mangled tree annotation - docs/adr/0015: unioned references with consistent APA lettering - AS_BUILT_SCHEMA/ERD/UML: main's merged truth (#58/#77/#218/#232/#264) plus Active PR #224 reload evidence - src/postgres_item_delivery.rs: kept exact_reference/stored_sequence/reconstruct_error helpers; unioned doc contract - tests: restored concurrency-test imports
Why
Protected main now verifies that an outbound publisher acknowledges the exact immutable event it was given (#252). The durable fenced persistence API still accepts outbox identity and delivery outcome as separate caller arguments. A composition layer could therefore verify event A, then accidentally hand event B identity or a different outcome to the persistence adapter.
What
VerifiedIntegrationPublishReceiptthat can be minted only afterexecute_integration_publishaccepts the exact publisher acknowledgement.execute_verified_integration_publishfor outbound execution without holding a database transaction open.record_verified_leased_delivery_attempt, which derives source, tenant, event, and outcome from that verified receipt and accepts only attempt evidence plus the current fencing token.TDD lineage
5d240841d263034e34a0353e3c310b684e972109introduced the missing verified handoff surface. The following isolation commit restored the pre-existing durable-integration contract file and moved the new RED contract to its own test target without changing the intended failing API requirement.5f32d5a68643a927730c5a5f1e4b5ed31b2b7e52restores the existingintegration_delivery_contractbyte-for-byte and keeps the new handoff contract separate.55eea44a2e2013d1542ea4cf7ac489516d37d3f7adds the verified receipt and persistence composition.841076a3897b9ecbf9dee27a5b77a23d8140f891exercises the exact fenced durable handoff and cross-event fence rejection.The PR diff against protected main is additive: the existing durable-integration test file is unchanged.
Boundary
This does not perform network I/O inside a PostgreSQL transaction, change retry/quarantine policy, add a schema, bypass EgressWeave policy, access another service database, or implement psychometric arithmetic. The caller still claims and commits a durable lease first, performs outbound I/O, then records the verified result in a fresh transaction under the current fencing token.
Verification required before merge
Exact-current-head Runtime CI, owned line/branch coverage, rustfmt/clippy/rustdoc, security/SAST/SBOM/provenance, zero valid unresolved findings, and qualifying independent non-author last-push review remain required. Never self-approve or transfer evidence from another head.