Skip to content

Admit contract-defined inverse intents from causal history#659

Merged
flyingrobots merged 40 commits into
mainfrom
cycle/472-contract-inverse-admission
Jul 14, 2026
Merged

Admit contract-defined inverse intents from causal history#659
flyingrobots merged 40 commits into
mainfrom
cycle/472-contract-inverse-admission

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • retain exact causal receipt ancestry, canonical submission envelopes, and replayable runtime provenance through WAL recovery
  • expose typed receipt identity and installed contract inverse laws
  • resolve inverse intents from recovered target evidence and the validated current frontier, then admit them through the normal WAL-backed path
  • cite both the inverted transition and current-basis receipts as causal parents
  • keep missing evidence, stale bases, unmappable spans, retention gaps, and contract-version mismatches as typed obstructions
  • update the CLI consumer to use exact causal receipt coordinates

Closes #472.

Why

Undo and redo must be forward causal history, not process-local snapshots or an LRU correlation cache. An application contract owns inverse semantics; Echo owns evidence resolution, admission, durability, ordering, and receipts.

Validation

  • cargo test -p warp-core --features native_rule_bootstrap,trusted_runtime,host_test
  • cargo test -p warp-core --features native_rule_bootstrap --test installed_contract_registry_tests
  • cargo test -p warp-cli --test cli_integration
  • cargo check --workspace --all-targets
  • strict cargo clippy for warp-core and warp-cli targets
  • cargo fmt --all -- --check
  • Prettier and markdownlint on changed docs
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Added contract inverse admission for supported mutation operations, including causal-history derivation and runtime-WAL acknowledgement.
    • Preserved receipt ancestry, ingress envelopes, and replayable runtime state across trusted-runtime restarts.
    • Added causal receipt references to distinguish identical receipt content across different events.
    • Added CLI receipt-reference details to WAL submission posture output.
  • Bug Fixes

    • Improved detection and reporting of stale, missing, mismatched, or corrupted runtime evidence.
    • Strengthened validation of causal parent data and retained ingress records.
  • Documentation

    • Added contract inverse admission guidance and expanded runtime-WAL durability documentation.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@flyingrobots, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 621dd334-3aaa-48c1-9ad7-b0af2d3035b8

📥 Commits

Reviewing files that changed from the base of the PR and between aab3698 and 6844b93.

📒 Files selected for processing (19)
  • CHANGELOG.md
  • crates/warp-core/src/causal_wal.rs
  • crates/warp-core/src/contract_obstruction.rs
  • crates/warp-core/src/coordinator.rs
  • crates/warp-core/src/head_inbox.rs
  • crates/warp-core/src/provenance_codec.rs
  • crates/warp-core/src/provenance_store.rs
  • crates/warp-core/src/receipt.rs
  • crates/warp-core/src/trusted_runtime_host.rs
  • crates/warp-core/src/wsc/store.rs
  • crates/warp-core/tests/causal_wal_tests.rs
  • crates/warp-core/tests/external_consumer_contract_fixture_tests.rs
  • crates/warp-core/tests/provenance_retention_codec_tests.rs
  • crates/warp-core/tests/receipt_causal_parent_recovery_tests.rs
  • crates/warp-core/tests/tick_receipt_tests.rs
  • crates/warp-core/tests/trusted_runtime_host_loop_tests.rs
  • crates/warp-core/tests/wsc_store_tests.rs
  • docs/topics/ContractInverseAdmission.md
  • docs/topics/WAL.md
📝 Walkthrough

Walkthrough

Adds typed causal receipt references, versioned retained WAL evidence, replayable provenance validation, installed-contract inverse admission, and restart recovery checks. Updates WSC storage, CLI posture output, integration tests, and runtime documentation to use the new causal identity model.

Changes

Runtime durability and inverse admission

Layer / File(s) Summary
Causal identity and inverse contracts
crates/warp-core/src/causal_receipt.rs, crates/warp-core/src/contract_inverse.rs, crates/warp-core/src/contract_registry.rs, crates/warp-core/src/head_inbox.rs
Defines typed causal receipt coordinates, typed causal ingress parents, inverse handler interfaces, installed-package validation, and retained ingress v2 encoding.
WAL and provenance replay
crates/warp-core/src/causal_wal.rs, crates/warp-core/src/provenance_codec.rs, crates/warp-core/src/provenance_store.rs, crates/warp-core/src/receipt.rs
Adds causal receipt WAL records, retained submission envelopes, replayable runtime state deltas, canonical provenance codecs, and receipt consistency errors.
Runtime recovery and inverse admission
crates/warp-core/src/coordinator.rs, crates/warp-core/src/trusted_runtime_host.rs
Persists and validates causal correlations, reconstructs durable runtime authority, restores retained evidence, and exposes WAL-backed contract inverse admission.
Storage and CLI projections
crates/warp-core/src/wsc/store.rs, crates/warp-cli/src/wal.rs, crates/warp-cli/tests/*
Uses causal receipt references for WSC identity and canonicalization, and reports optional receipt references in submission posture output.
Validation and documentation
crates/warp-core/tests/*, docs/topics/*, CHANGELOG.md
Covers codec rejection, causal-parent recovery, inverse admission across restart, WAL durability, and the documented runtime behavior.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: admitting contract-defined inverse intents from causal history.
Linked Issues check ✅ Passed The changes implement inverse-intent admission with typed obstructions, retained evidence, and normal WAL-backed admission, matching issue #472.
Out of Scope Changes check ✅ Passed The diff stays focused on inverse admission, causal receipt identity, WAL retention, and supporting docs/tests with no clear unrelated feature work.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cycle/472-contract-inverse-admission

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.

@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: 9bf2def0e5

ℹ️ 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 crates/warp-cli/src/wal.rs
Comment thread crates/warp-core/src/trusted_runtime_host.rs
Comment thread crates/warp-core/src/causal_wal.rs Outdated
…verse-admission

# Conflicts:
#	crates/warp-core/src/trusted_runtime_host.rs
#	docs/BEARING.md
#	docs/README.md
#	docs/design/0018-contract-hosted-file-history-substrate/design.md
#	docs/design/product-facing-intent-outcome-api.md
#	docs/design/witnessed-submission-persistence.md
@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer self-audit

Priority Source File Issue RED witness
P1 Self (post-origin/main merge) crates/warp-core/src/trusted_runtime_host.rs Conflict resolution retained both copies of the internal tests module; the branch cannot compile its library tests, and the stale copy also omits the new causal receipt fields. cargo test -p warp-core --lib --features native_rule_bootstrap,trusted_runtime,host_test fails with E0428 and E0063.

The correction will remove the stale upstream copy, retain the branch copy that covers recovered causal receipt fields, rerun the exact RED witness, and land as its own commit.

Cc: @codex for a second opinion.

@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer Activity Summary

# Severity Source Finding Commit Outcome
1 P2 PR CLI posture omitted the exact causal receipt reference 6d67aad7 Fixed and regression-tested
2 P1 Self Merge resolution retained a stale duplicate test module 32e81800 Removed and full feature test lane restored
3 P2 PR Rejected target receipts remained eligible for inversion 2e69323e Structured rejection added and regression-tested
4 P2 PR WAL decoding normalized noncanonical parent sets aab36980 Duplicate and out-of-order sets now fail deterministically

RED / GREEN evidence

  • Exact receipt reference: cargo test -p warp-cli --test cli_integration wsc_causal_history_exports_and_verifies_profiles
  • Applied-outcome gate: cargo test -p warp-core --test external_consumer_contract_fixture_tests --features native_rule_bootstrap,trusted_runtime,host_test
  • Canonical parent set: cargo test -p warp-core --test causal_wal_tests receipt_correlation_decode_rejects_noncanonical_parent_sets
  • Merge-resolution regression: cargo test -p warp-core --lib --features native_rule_bootstrap,trusted_runtime,host_test
  • Full branch gate: cargo +1.90.0 xtask pr-preflight

All three originating review threads are resolved. The worktree is clean and the verified head is aab36980.

@codex review please

@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer follow-up

# Severity Source Finding RED Commit Outcome
5 P2 CI The branch retained a forbidden backlog/ process ledger after adopting the repository knowledge model from main bash tests/docs/test_knowledge_model.sh failed with one violation 1cf42316 Removed the obsolete ledger; durable contract and evidence remain in topic docs and tests

GREEN evidence:

  • bash tests/docs/test_knowledge_model.sh
  • bash tests/docs/test_retired_component_refs.sh
  • bash tests/hooks/test_verify_local.sh (PASS: 123, FAIL: 0)
  • cargo +1.90.0 xtask pr-preflight

@codex review please

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
crates/warp-core/src/causal_wal.rs (1)

7345-7405: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Validate cross-record identity before committing atomic WAL transactions.

The builders accept mutually inconsistent evidence without checks:

  • Acceptance and retained envelope can name different submissions or envelope digests.
  • Receipt and correlation can carry different receipt_ref values.
  • Replay state-delta bytes can carry a receipt digest unrelated to the tick receipt.

Decode and validate these contracts before commit; preferably accept typed retained records rather than unchecked bytes.

As per coding guidelines, one transaction must form a canonical append-only evidence claim.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/warp-core/src/causal_wal.rs` around lines 7345 - 7405, Validate
cross-record identity in build_submission_acceptance_with_material_transaction,
build_tick_transaction, and build_replayable_tick_transaction before calling
commit. Ensure acceptance records match retained envelope submission and
envelope digests, receipt and correlation share the same receipt_ref, and
replayable state-delta material carries the tick receipt’s expected digest.
Prefer a typed retained state-delta record over unchecked bytes, and return the
established validation/build error on mismatches so only canonical evidence
claims are committed.

Sources: Coding guidelines, Path instructions

crates/warp-core/src/receipt.rs (1)

37-94: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Validate all blocker invariants in the retained-parts constructor.

This public constructor accepts duplicate, unsorted, forward, or disposition-incompatible blockers. Because the receipt digest excludes blockers, malformed attribution can still pass the provenance store’s transaction/digest checks. Enforce every documented blocked_by invariant here and return a typed error.

As per coding guidelines, retained receipt evidence must be canonical before entering append-only history.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/warp-core/src/receipt.rs` around lines 37 - 94, The public
TickReceipt::try_from_retained_parts constructor currently validates only
parallel lengths; validate every documented blocked_by invariant there,
including canonical ordering/uniqueness, rejecting forward references and
disposition-incompatible blockers. Add appropriate typed TickReceiptPartsError
variants carrying the relevant context, and return them before computing the
digest or constructing the receipt; keep TickReceipt::new’s existing behavior
unchanged.

Sources: Coding guidelines, Path instructions

crates/warp-core/src/wsc/store.rs (1)

4551-4586: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Redundant by_receipt map duplicates by_correlation.

by_receipt and by_correlation are both keyed by record.receipt_ref and receive identical inserted values, so by_receipt is a pure duplicate that costs an extra BTreeMap plus an extra record.clone() (cloning a Vec<CausalTickReceiptRef>) per record for no behavioral benefit. Drop it and reuse by_correlation for the conflict check.

♻️ Proposed fix
 fn canonical_receipt_correlations(
     records: &[WalReceiptCorrelationRecord],
 ) -> Result<Vec<WalReceiptCorrelationRecord>, WscStoreObstruction> {
     let mut by_correlation = BTreeMap::new();
     let mut by_submission = BTreeMap::new();
     let mut by_ticket = BTreeMap::new();
-    let mut by_receipt = BTreeMap::new();
     for record in records {
         if let Some(existing) = by_submission.get(&record.receipt_ref.submission_id) {
             if existing != record {
                 return Err(WscStoreObstruction::duplicate_mismatch(
                     WscStoreEnvelopeId::from_hash(record.receipt_ref.submission_id),
                 ));
             }
         }
         if let Some(existing) = by_ticket.get(&record.receipt_ref.ticket_digest) {
             if existing != record {
                 return Err(WscStoreObstruction::duplicate_mismatch(
                     WscStoreEnvelopeId::from_hash(record.receipt_ref.ticket_digest),
                 ));
             }
         }
-        if let Some(existing) = by_receipt.get(&record.receipt_ref) {
+        if let Some(existing) = by_correlation.get(&record.receipt_ref) {
             if existing != record {
                 return Err(WscStoreObstruction::duplicate_mismatch(
                     WscStoreEnvelopeId::from_hash(record.receipt_ref.identity_digest()),
                 ));
             }
         }
         by_correlation.insert(record.receipt_ref, record.clone());
         by_submission.insert(record.receipt_ref.submission_id, record.clone());
-        by_ticket.insert(record.receipt_ref.ticket_digest, record.clone());
-        by_receipt.insert(record.receipt_ref, record.clone());
+        by_ticket.insert(record.receipt_ref.ticket_digest, record.clone());
     }
     Ok(by_correlation.into_values().collect())
 }

As per path instructions, "warp-core is the deterministic kernel... Performance matters — flag unnecessary allocations in hot paths."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/warp-core/src/wsc/store.rs` around lines 4551 - 4586, Remove the
redundant by_receipt BTreeMap and its insert from
canonical_receipt_correlations. Reuse by_correlation for the receipt_ref
conflict check, preserving the existing mismatch error behavior while
eliminating the extra map and record clone.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backlog/bad-code/RE-034-causal-tick-receipt-reference.md`:
- Around line 6-7: Update the active backlog item to mark the inverse-admission
witness complete, reflecting that
inverse_intent_resolves_one_admitted_transition_after_restart has been added.
Change the pending status and check off the corresponding backlog entry while
preserving the rest of the item.

In `@crates/warp-core/src/causal_wal.rs`:
- Around line 2230-2297: The receipt-correlation encoder and decoder must use
one canonical representation for an empty causal-parent set. Update
to_payload_bytes and from_payload_bytes so empty parents are either always
encoded/read with a count or explicit zero-count payloads are rejected as
non-canonical; preserve deterministic sorting and validation for non-empty
parent lists.
- Around line 2701-2710: Make recovery record application append-only: update
apply_tick_receipt_record, apply_correlation_record, and the related handlers
around the other insert calls to return Result and reject conflicting duplicate
receipt, ticket, decision, or causal-parent records. Allow only exact duplicates
as no-ops, and remove any overwrite or remove-and-replace behavior, including
parent ancestry changes in apply_correlation_record. Propagate these errors
through all callers.

In `@crates/warp-core/src/coordinator.rs`:
- Around line 1340-1346: Update receipt_correlations storage and admission paths
around receipt_correlation_for_receipt_ref to maintain deterministic BTreeMap
indexes keyed by CausalTickReceiptRef and current-basis coordinate. Populate
both indexes whenever a ReceiptCorrelationRecord is admitted, then replace the
values().find scan and reuse the indexes for inverse-admission basis lookups
while preserving exact-match behavior.
- Around line 2029-2039: In the recovered submission flow around the envelope
lookup, derive the canonical causal-parent reference set from
envelope.causal_parents() and compare it with the independently persisted
correlation parents before restoration at the later correlation step. Return the
appropriate replay-mismatch error on any difference, while preserving the
existing ingress ID validation and successful restoration path.

In `@crates/warp-core/src/engine_impl.rs`:
- Around line 432-436: Update the cfg_attr on the contract_inverse_handlers
field to allow dead_code only when not(all(feature = "native_rule_bootstrap",
feature = "trusted_runtime")). Keep the existing suppression for
contract_query_observer_packages unchanged.

In `@crates/warp-core/src/provenance_codec.rs`:
- Around line 178-234: Update validate_local_commit to validate entry.parents
ordering before computing the commit hash: require each adjacent pair of parent
commit_hash values to be strictly increasing using a windows(2) check, and
return the existing inconsistency error for non-canonical ordering. Keep the
existing hash validation unchanged for canonically ordered parents.

In `@crates/warp-core/src/provenance_store.rs`:
- Around line 605-609: Update ProvenanceEntry validation around
validate_recorded_event_entry to reject any tick_receipt when the recorded event
is not a local event, preserving receipt acceptance only for local commits.
Ensure ProvenanceEntry::with_tick_receipt cannot create an entry that bypasses
this local-commit-only constraint, either through validation or a typed builder.

In `@crates/warp-core/tests/external_consumer_contract_fixture_tests.rs`:
- Around line 351-368: Update temp_runtime_wal_dir so an AlreadyExists result
from create_dir is treated as a path collision: do not remove the existing
directory, and continue to the next TEMP_COUNTER suffix. Preserve the retry
limit and existing panic behavior for other filesystem errors and exhausted
attempts.

In `@crates/warp-core/tests/provenance_retention_codec_tests.rs`:
- Around line 18-21: Replace the hard-coded EXPECTED_COMMIT_HASH_OFFSET and
generic is_err() assertion in the provenance retention codec test with
fixture-driven lookup of the encoded commit hash, then assert the exact
commitment-validation error for the mutated data. Update the related assertions
around the failure case while preserving deterministic behavior and avoiding
duplicated codec-layout offsets.

In `@crates/warp-core/tests/trusted_runtime_host_loop_tests.rs`:
- Around line 645-648: Replace the inequality checks in both
recovery-certificate assertions with exact comparisons against the canonical
root calculated from all recovered evidence, reusing the same full-root
calculator or production verifier at
crates/warp-core/tests/trusted_runtime_host_loop_tests.rs:645-648 and 1763-1766.
Ensure both sites validate the expanded recovery certificate deterministically
rather than merely differing from the obsolete submissions/receipts-only root.

---

Outside diff comments:
In `@crates/warp-core/src/causal_wal.rs`:
- Around line 7345-7405: Validate cross-record identity in
build_submission_acceptance_with_material_transaction, build_tick_transaction,
and build_replayable_tick_transaction before calling commit. Ensure acceptance
records match retained envelope submission and envelope digests, receipt and
correlation share the same receipt_ref, and replayable state-delta material
carries the tick receipt’s expected digest. Prefer a typed retained state-delta
record over unchecked bytes, and return the established validation/build error
on mismatches so only canonical evidence claims are committed.

In `@crates/warp-core/src/receipt.rs`:
- Around line 37-94: The public TickReceipt::try_from_retained_parts constructor
currently validates only parallel lengths; validate every documented blocked_by
invariant there, including canonical ordering/uniqueness, rejecting forward
references and disposition-incompatible blockers. Add appropriate typed
TickReceiptPartsError variants carrying the relevant context, and return them
before computing the digest or constructing the receipt; keep TickReceipt::new’s
existing behavior unchanged.

In `@crates/warp-core/src/wsc/store.rs`:
- Around line 4551-4586: Remove the redundant by_receipt BTreeMap and its insert
from canonical_receipt_correlations. Reuse by_correlation for the receipt_ref
conflict check, preserving the existing mismatch error behavior while
eliminating the extra map and record clone.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a7a43d99-ae00-4e4d-b90f-41390a2bcad8

📥 Commits

Reviewing files that changed from the base of the PR and between 2989b27 and aab3698.

📒 Files selected for processing (37)
  • .ban-nondeterminism-allowlist
  • CHANGELOG.md
  • backlog/bad-code/RE-034-causal-tick-receipt-reference.md
  • crates/warp-cli/src/wal.rs
  • crates/warp-cli/tests/cli_integration.rs
  • crates/warp-cli/tests/support/runtime_wal_fixture.rs
  • crates/warp-core/src/causal_receipt.rs
  • crates/warp-core/src/causal_wal.rs
  • crates/warp-core/src/contract_host.rs
  • crates/warp-core/src/contract_inverse.rs
  • crates/warp-core/src/contract_obstruction.rs
  • crates/warp-core/src/contract_registry.rs
  • crates/warp-core/src/coordinator.rs
  • crates/warp-core/src/engine_impl.rs
  • crates/warp-core/src/head_inbox.rs
  • crates/warp-core/src/lib.rs
  • crates/warp-core/src/playback.rs
  • crates/warp-core/src/provenance_codec.rs
  • crates/warp-core/src/provenance_store.rs
  • crates/warp-core/src/receipt.rs
  • crates/warp-core/src/trusted_runtime_host.rs
  • crates/warp-core/src/wsc/store.rs
  • crates/warp-core/tests/causal_wal_hardening_tests.rs
  • crates/warp-core/tests/causal_wal_tests.rs
  • crates/warp-core/tests/external_consumer_contract_fixture_tests.rs
  • crates/warp-core/tests/ingress_retention_codec_tests.rs
  • crates/warp-core/tests/installed_contract_intent_pipeline_tests.rs
  • crates/warp-core/tests/installed_contract_registry_tests.rs
  • crates/warp-core/tests/provenance_retention_codec_tests.rs
  • crates/warp-core/tests/receipt_causal_parent_recovery_tests.rs
  • crates/warp-core/tests/retained_evidence_ref_tests.rs
  • crates/warp-core/tests/trusted_runtime_host_loop_tests.rs
  • crates/warp-core/tests/wsc_store_tests.rs
  • docs/README.md
  • docs/topics/ContractInverseAdmission.md
  • docs/topics/README.md
  • docs/topics/WAL.md

Comment thread backlog/bad-code/RE-034-causal-tick-receipt-reference.md Outdated
Comment thread crates/warp-core/src/causal_wal.rs
Comment thread crates/warp-core/src/causal_wal.rs Outdated
Comment thread crates/warp-core/src/coordinator.rs Outdated
Comment thread crates/warp-core/src/coordinator.rs
Comment thread crates/warp-core/src/provenance_codec.rs
Comment thread crates/warp-core/src/provenance_store.rs
Comment thread crates/warp-core/tests/external_consumer_contract_fixture_tests.rs
Comment thread crates/warp-core/tests/provenance_retention_codec_tests.rs Outdated
Comment thread crates/warp-core/tests/trusted_runtime_host_loop_tests.rs Outdated

Copy link
Copy Markdown
Owner Author

Code Lawyer self-audit follow-up

Priority Source File Issue RED witness
P2 Self crates/warp-core/src/causal_wal.rs The receipt-correlation encoder omits an empty causal-parent set, but the decoder accepts an explicit zero-count field. That gives the same semantic record two valid byte encodings and leaves committed authority malleable. Extend receipt_correlation_decode_rejects_noncanonical_parent_sets with an empty-but-present count payload; current decode succeeds.

The correction will reject an explicit zero count with the existing NonCanonicalCausalParentReceipts error, rerun the causal-WAL suite and strict branch gate, and land as one additional commit.

Cc: @codex for a second opinion.

Copy link
Copy Markdown
Owner Author

Code Lawyer follow-up closure

# Severity Source Finding Commit Outcome
6 P2 Self Receipt-correlation decoding accepted an explicit zero parent count even though canonical encoding omits an empty set d6e45077 Empty-but-present, duplicate, and reordered parent sets now share one deterministic rejection path

RED evidence:

  • cargo test -p warp-core --test causal_wal_tests receipt_correlation_decode_rejects_noncanonical_parent_sets -- --exact --nocapture failed because the zero-count payload decoded successfully.

GREEN evidence:

  • Exact regression witness
  • All 66 causal_wal_tests
  • Strict warp-core clippy with -D warnings -D missing_docs
  • cargo +1.90.0 xtask pr-preflight

The pushed PR head is d6e45077. Graft reports no breaking exported changes relative to origin/main, and the thread-aware audit currently reports zero unresolved review threads.

@codex review please

@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: d6e45077a8

ℹ️ 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 crates/warp-core/src/head_inbox.rs
Comment thread crates/warp-core/src/trusted_runtime_host.rs
Comment thread crates/warp-core/src/coordinator.rs
Comment thread crates/warp-core/src/trusted_runtime_host.rs Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 14, 2026
@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer Activity Summary

Final reviewed head: ca9a2d15

# Severity Source Finding Commit(s) Outcome
1 P1 Codex Normal admission could claim the inverse-target role 1bc5826a Stable rejection; validated inverse path remains internal
2 P2 Codex Recovery could bind a non-empty receipt to an unrelated ingress 1361d061, ca9a2d15 Applied receipt ownership checked; empty obstruction posture preserved
3 P2 Codex Recovery selected the first duplicate tick/correlation frame 709ef5c9, e7f4d8d6 Exactly one record required; committed duplicate fixtures rejected
4 P2 CodeRabbit Atomic WAL builders accepted cross-record identity mismatch 9404f488 Submission, receipt, correlation, and state-delta identities bound
5 P2 CodeRabbit Recovery overwrote conflicting receipt evidence 05fcade1 Append-only exact-duplicate semantics enforced
6 P2 CodeRabbit Recovered correlation parents were not bound to envelopes 75b25e8c Canonical envelope parents independently rederived
7 P2 CodeRabbit Receipt lookup and inverse basis lookup scanned history 1a000e67, e7271412 Deterministic exact and current-basis indexes installed and consumed
8 P2 Self Retained receipt blocker invariants were incomplete 449aedce Ordering, direction, and disposition invariants enforced
9 P2 CodeRabbit Provenance codec accepted noncanonical parent order 340e87e3 Strictly increasing parent hashes required
10 P2 CodeRabbit Non-local provenance events accepted scheduler receipts 5f9a4f77 Stable typed rejection added
11 P2 CodeRabbit Temp fixture collision deleted another owner’s directory fcf1d6e6, 0decbf12 Collision retries preserve existing directories
12 P2 Self WSC receipt canonicalization duplicated its primary index 6b434460 Redundant map and clone removed
13 P3 CodeRabbit Empty receipt-parent representation was noncanonical d6e45077, ca948b9f Explicit empty encodings rejected
14 P3 CodeRabbit Commitment and recovery-root tests admitted weak oracles 2c5bc502, 5b7d83d6 Exact structured failures and canonical roots asserted
15 P3 Self CLI posture exposed only content digest, not exact receipt ref 6d67aad7 Exact causal receipt reference projected
16 P3 Self Inverse requests accepted non-applied target receipts 2e69323e Applied outcome required
17 P4 CodeRabbit Retired backlog artifact contradicted landed behavior 1cf42316 Obsolete checked-in status file removed
18 P5 CodeRabbit Engine cfg warning was reported as a product defect n/a Verified feature matrix; thread closed without code churn

Verification

  • RED/GREEN regressions were observed for every behavioral finding.
  • cargo test -p warp-core --lib coordinator::tests: 52 passed.
  • Trusted-host contract suite: 32 passed.
  • External-consumer inverse suite: 4 passed.
  • Provenance, WAL, receipt-parent, WSC, and codec focused suites passed in the pre-push gate.
  • cargo xtask pr-preflight --base origin/main: passed on final tree.
  • Review threads: 0 unresolved.

CodeRabbit’s incremental review was rate limited after its initial full audit. Requesting an alternate Codex review of exact head ca9a2d15 before merge.

@flyingrobots

Copy link
Copy Markdown
Owner Author

@codex review please

@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer CI follow-up

Severity Source Finding RED Commit GREEN
P2 CI Collision regression depended on ambient std::process::id(), failing both the nondeterminism gate and its no-ripgrep hook regression scripts/ban-nondeterminism.sh failed on std-process; hook suite was 122/123 6844b936 Atomic private-root fixture; guard passed; hook suite 123/123; focused collision test passed; final PR preflight passed

Final reviewed head is now 6844b936. Review threads remain at zero unresolved.

@flyingrobots

Copy link
Copy Markdown
Owner Author

@codex review please

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 6844b936da

ℹ️ 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".

@flyingrobots flyingrobots merged commit 4ef7db8 into main Jul 14, 2026
35 checks passed
@flyingrobots flyingrobots deleted the cycle/472-contract-inverse-admission branch July 14, 2026 05:07
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.

Contract Inverse Admission Hook

1 participant