Skip to content

Admit contract-defined inverse intents from causal history#659

Open
flyingrobots wants to merge 8 commits into
mainfrom
cycle/472-contract-inverse-admission
Open

Admit contract-defined inverse intents from causal history#659
flyingrobots wants to merge 8 commits into
mainfrom
cycle/472-contract-inverse-admission

Conversation

@flyingrobots

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

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

Next review available in: 22 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 77ed5b1d-eb5e-4e7a-b1de-b3a4cf3c397a

📥 Commits

Reviewing files that changed from the base of the PR and between e10f371 and de08de1.

📒 Files selected for processing (40)
  • .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/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
  • docs/topics/ContractInverseAdmission.md
  • docs/topics/WAL.md

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

receipt_digest: matching_entry.and_then(|entry| {
entry
.receipt_ref
.map(|receipt_ref| hex_hash(&receipt_ref.receipt_content_digest))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Emit exact receipt coordinates in posture output

When two decided submissions produce identical tick-receipt content, this still reports only receipt_content_digest, even though TickReceipt::digest is intentionally not tied to the admitted tick/commit coordinate. In that scenario wal submission-posture prints the same Receipt for distinct causal receipt events, so callers cannot use the CLI output to identify the exact retained receipt needed by the new inverse/ancestry surfaces; emit the CausalTickReceiptRef identity or its coordinate fields instead of just the content digest.

Useful? React with 👍 / 👎.

Comment on lines +496 to +499
let correlation = self
.runtime
.receipt_correlation_for_receipt_ref(&request.target_receipt_ref)
.ok_or_else(|| ContractInverseObstruction::TargetReceiptUnavailable {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject inverse requests for rejected target receipts

When target_receipt_ref names a receipt correlation whose receipt entry was Rejected(FootprintConflict), this path still treats it as an invertible target, decodes the original mutation, and invokes the inverse law. In that conflict scenario the original contract mutation never changed state, so admitting the produced inverse can create a spurious forward mutation; after resolving the correlation, verify that the target outcome is an applied receipt entry before constructing the inverse context.

Useful? React with 👍 / 👎.

Comment on lines +2291 to +2292
causal_parent_receipts.sort_unstable();
causal_parent_receipts.dedup();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject non-canonical parent receipt encodings

If a committed ReceiptCorrelationRecorded payload contains duplicate or out-of-order parent receipts, recovery currently sorts and deduplicates it instead of rejecting the WAL bytes. That means a byte-valid but non-canonical segment can silently rewrite the causal ancestry that inverse/recovery indexes expose, rather than surfacing corruption; decode should reject payloads whose parent list is not already canonical (or whose re-encoded bytes differ).

Useful? React with 👍 / 👎.

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