Skip to content

Add WSC store port for causal history recovery#530

Merged
flyingrobots merged 14 commits into
mainfrom
stack/jedit-wsc-store-port
Jun 3, 2026
Merged

Add WSC store port for causal history recovery#530
flyingrobots merged 14 commits into
mainfrom
stack/jedit-wsc-store-port

Conversation

@flyingrobots
Copy link
Copy Markdown
Owner

Summary

  • add a deterministic WSC store envelope and in-memory WSC store port with commit-marker visibility
  • persist and recover accepted submissions, receipt correlations, and retained evidence records from committed WSC material
  • validate WSC causal-history completeness so receipts/correlations cannot appear without matching accepted submission evidence
  • expose recovery constructors for WSC-backed submission, receipt, and retention indexes

Audit Fixes

  • reject conflicting duplicate receipt/correlation WSC evidence instead of silently overwriting it
  • add committed-store recovery for retained evidence records

Validation

  • cargo test -p warp-core --test wsc_store_tests
  • cargo check -p warp-core
  • cargo clippy -p warp-core --lib -- -D warnings -D missing_docs
  • cargo fmt --check
  • ./scripts/check-no-app-nouns-in-core.sh
  • git diff --check
  • pre-push: cargo fmt --all -- --check; cargo check -p warp-core --quiet; cargo test -p warp-core --test wsc_store_tests

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 2, 2026

Warning

Review limit reached

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

More reviews will be available in 50 minutes and 6 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 918c24e2-2973-4e46-b642-a3364f0106f7

📥 Commits

Reviewing files that changed from the base of the PR and between 7dc0374 and f32c53d.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • crates/warp-core/src/causal_wal.rs
  • crates/warp-core/src/wsc/mod.rs
  • crates/warp-core/src/wsc/store.rs
  • crates/warp-core/tests/wsc_store_tests.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stack/jedit-wsc-store-port

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 and usage tips.

@flyingrobots flyingrobots enabled auto-merge June 2, 2026 20:23
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: aa63c1d830

ℹ️ 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/wsc/store.rs Outdated
@flyingrobots
Copy link
Copy Markdown
Owner Author

Self-Code Review Findings

@codex please confirm the finding below before this PR lands.

Severity File Lines Infraction Evidence Recommended mitigation prompt
P1 Major crates/warp-core/src/wsc/store.rs / crates/warp-core/src/causal_wal.rs store.rs:1337-1353, causal_wal.rs:2372-2398 Retained evidence identity conflicts can survive WSC recovery and then be silently collapsed by the recovered retention index. canonical_retained_material_records and canonical_reading_ref_records dedupe by full payload bytes, so two retained-material records with the same material_digest but different semantic coordinate/kind/posture are both accepted. RecoveredRetentionIndex::from_retention_records then inserts by material_digest, letting the later record overwrite material_by_digest while semantic-coordinate indexes can still retain the earlier relationship. The same pattern exists for duplicate reading_id. This undermines the PR's evidence-recovery goal: conflicting retained evidence should obstruct, not produce an internally inconsistent index. Add RED tests proving WSC retention recovery rejects conflicting duplicate material_digest and reading_id records. Then change retained material and reading canonicalization to return Result and emit WscStoreObstructionKind::DuplicateEnvelopeMismatch when the same material_digest or reading_id maps to different payload material. Propagate the Result through retention_records_to_wsc_envelope, retention_records_from_wsc_envelope, and retention_records_from_wsc_store. Keep identical duplicate payloads idempotent. Run cargo test -p warp-core --test wsc_store_tests, cargo check -p warp-core, cargo clippy -p warp-core --lib -- -D warnings -D missing_docs, cargo fmt --check, and git diff --check.

Review Context

  • Pre-review worktree gate: clean.
  • git fetch origin: completed.
  • Merge target: origin/main.
  • Open PR: Add WSC store port for causal history recovery #530, stack/jedit-wsc-store-port -> main.
  • CI at review time: all checks green, including CodeRabbit.
  • git diff --check origin/main...HEAD: clean.

Severity Breakdown

  • P0 Critical: 0
  • P1 Major: 1
  • P2 Medium: 0
  • P3 Minor: 0
  • P4 Nit: 0

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: aa63c1d830

ℹ️ 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/wsc/store.rs
@flyingrobots
Copy link
Copy Markdown
Owner Author

Self-Code Audit Finding

@codex please confirm this cleanup before merge.

Severity File Lines Infraction Evidence Recommended mitigation prompt
P5 Nit crates/warp-core/src/wsc/store.rs store.rs:129-132, store.rs:724-732, store.rs:855-860, store.rs:1017-1022 Documentation underspecifies basis-digest mismatch evidence after adding BasisDigestMismatch. WscStoreSubject::EnvelopeDigest still says the subject is for encoded byte digest mismatches, but BasisDigestMismatch now also uses it for expected envelope basis vs actual recovered canonical basis. The *_records_from_wsc_store docs also say malformed/conflicting material without naming basis-mismatched envelopes. The code is correct, but public docs should not lag the new obstruction posture. Update the WSC store documentation so EnvelopeDigest describes generic envelope digest evidence, and the committed recovery function error docs explicitly include basis-digest mismatches. Run cargo fmt --check, cargo clippy -p warp-core --lib -- -D warnings -D missing_docs, cargo test -p warp-core --test wsc_store_tests, and git diff --check.

Severity breakdown for new self-discovered issues: P5 Nit: 1.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 93b8faf1eb

ℹ️ 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/wsc/store.rs Outdated
@flyingrobots
Copy link
Copy Markdown
Owner Author

Activity Summary

@codex please confirm the resolved items below before merge.

# Source Severity File Commit Outcome
1 PR review thread P1 Major crates/warp-core/src/wsc/store.rs 93b8faf1 Added typed BasisDigestMismatch obstruction and recovery checks for accepted submissions, receipt correlations, and retained evidence. Recovery now recomputes canonical record basis digests and rejects stale/forged envelope basis bindings. Thread resolved.
2 Self audit + PR review thread P1 Major crates/warp-core/src/wsc/store.rs, crates/warp-core/src/causal_wal.rs 20f7562d Retained evidence recovery and RecoveredRetentionIndex now reject conflicting duplicate material digests and reading ids instead of silently overwriting evidence identity collisions. Thread resolved.
3 Self audit + PR review thread P5 Nit crates/warp-core/src/wsc/store.rs f32c53d3 Clarified digest obstruction docs so EnvelopeDigest and committed recovery docs cover basis-digest mismatch evidence. Thread resolved.

Local Witnesses

  • cargo test -p warp-core --test wsc_store_tests basis_digest_mismatch -- --nocapture → 3 passed
  • cargo test -p warp-core --test wsc_store_tests → 25 passed
  • cargo check -p warp-core → passed
  • cargo clippy -p warp-core --lib -- -D warnings -D missing_docs → passed
  • cargo fmt --check → passed
  • ./scripts/check-no-app-nouns-in-core.sh → passed
  • git diff --check and git diff --check origin/main...HEAD → passed
  • npx markdownlint-cli2 CHANGELOG.md → passed
  • pre-commit and pre-push hooks → passed

Current PR State

  • Unresolved review threads: 0
  • CodeRabbit: passing
  • Auto-merge: enabled
  • CI: restarted after f32c53d3; no failures observed at posting time, remaining jobs still pending

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: f32c53d3f1

ℹ️ 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 on lines +2396 to +2399
pub fn from_retention_records<I, J>(
materials: I,
readings: J,
) -> Result<Self, RecoveredRetentionIndexError>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Route committed WAL recovery through retention checks

When conflicting retained evidence comes from committed WAL frames rather than a WSC envelope, this new checking constructor is bypassed: recover_retention_index still builds RecoveredRetentionIndex::default() and inserts directly into material_by_digest/reading_by_id, so a later frame silently overwrites an earlier record with the same material digest or reading id. That leaves WAL doctor/recovery accepting exactly the identity collision this API now rejects; please route WAL recovery through these checks or share the duplicate-detection logic.

Useful? React with 👍 / 👎.

@flyingrobots flyingrobots merged commit d594516 into main Jun 3, 2026
36 checks passed
@flyingrobots flyingrobots deleted the stack/jedit-wsc-store-port branch June 3, 2026 01:11
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.

1 participant