Repository navigation
fix(review): reconcile public claim surfaces - #825
Conversation
Summary by CodeRabbit
WalkthroughThe change adds planned delivery metadata to review topics, reconciles inline and summary findings, classifies cross-surface duplicates, and validates these contracts in compiler artifact verification. ChangesCross-surface reconciliation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related issues
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c535398cc
ℹ️ 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".
| let left = canonical_text(left); | ||
| let right = canonical_text(right); | ||
| !left.is_empty() && left == right |
There was a problem hiding this comment.
Compare all tokens before suppressing a summary
When an inline comment and a distinct summary share their first 24 whitespace-delimited tokens, this comparison treats them as identical because canonical_text truncates after 24 tokens. reconcile_public_surfaces then silently removes the summary even if the claims differ in a qualifying condition or consequence after that prefix, and the Python verifier repeats the same truncation so it will accept the loss. Use a non-truncated normalized key for exact cross-surface deduplication.
Useful? React with 👍 / 👎.
| topic.thread_disposition = thread_disposition(topic, &matching_threads); | ||
| topic.planned_action = planned_action(topic); | ||
| topic.planned_thread_id = if topic.planned_action == "reply" { |
There was a problem hiding this comment.
Derive planned actions after conflict adjudication
When an explicit cross-lane conflict is resolved later in build_active_claim_graph, adjudicate_claim_graph_conflicts changes the losing topic's delivery to no-human-surface, but the action computed here remains inline or summary. The resulting handoff therefore instructs the later delivery seam to publish a proof-refuted claim that final surface reconciliation suppresses; recompute or clear the plan after adjudication for losing topics.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/verify-bun-review-artifacts.py (1)
11857-11906: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd negative self-tests for the new
planned_actionvalidation.
self_test_claim_graph_contractonly exercises the happy path for the newplanned_action/planned_thread_idfields ("novel"→"summary", no thread). The validation added at lines 1920-1963 has several failure branches: mismatchedplanned_actionfor a giventhread_disposition, a"reply"plan with a missing or non-existing thread id, and a non-"reply"plan with a thread id set. None of these failure paths has a self-test.🤖 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 `@scripts/verify-bun-review-artifacts.py` around lines 11857 - 11906, Extend self_test_claim_graph_contract with negative cases for planned_action validation: reject mismatched planned_action/thread_disposition combinations, reject reply plans when planned_thread_id is missing or not present in existing_threads, and reject non-reply plans when planned_thread_id is set. Use write_graph overrides and expect_self_test_failure assertions matching the validation messages.
🤖 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 `@scripts/verify-bun-review-artifacts.py`:
- Around line 5994-6007: Update the duplicate_cross_surface branch around
expected["kind"] to require that the removed surface is kind "summary" before
validating retained inline twins and receipts; reject any other kind while
preserving the existing exact-twin and source-bound receipt checks.
---
Outside diff comments:
In `@scripts/verify-bun-review-artifacts.py`:
- Around line 11857-11906: Extend self_test_claim_graph_contract with negative
cases for planned_action validation: reject mismatched
planned_action/thread_disposition combinations, reject reply plans when
planned_thread_id is missing or not present in existing_threads, and reject
non-reply plans when planned_thread_id is set. Use write_graph overrides and
expect_self_test_failure assertions matching the validation messages.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d91a9b1d-d6fe-4512-8cdf-a71550b105b2
📒 Files selected for processing (4)
scripts/verify-bun-review-artifacts.pysrc/compiler_reconciliation.rssrc/main.rssrc/review_topics.rs
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- planned_action is computed before adjudicate_claim_graph_conflicts overwrites delivery to 'no-human-surface'; losing topics keep 'inline' or 'summary' plan, instructing the delivery seam to surface refuted claims. Recompute plan after adjudication or clear it for losing topics.
- same_public_claim suppresses summary findings when only the first 24 tokens of normalized text match; later qualifying-condition divergence is silently dropped. Use a non-truncated normalized key or hash full canonical text for exact cross-surface dedup.
Confirmed findings
- same_public_claim strips a [lane] prefix then calls canonical_text; canonical_text (per prior P1 review) truncates to first 24 whitespace tokens. Two distinct claims sharing the first 24 tokens but diverging after the prefix (or after token 24) will compare equal and the summary will be suppressed.
- duplicate_cross_surface path in compiler_reconciliation requires exactly one retained inline twin (matching_inline_claims.len() == 1); ambiguity leaves the summary unaccounted rather than surfaced, hiding duplicates from the receipt.
reconcile_inline_commentsandreconcile_summary_only_findingsare now redundant in production paths and only kept alive by tests; consider gating them behind#[cfg(test)]or deleting to keep the public API minimal.- duplicate_cross_surface removal requires retained_ids size == 1 and exact set match against adjudicating; an inline summary pair that also has a second identical inline would still pass removal but produce a misleading retained_ids cardinality. Coverage is symmetric to the Rust test only when exactly one inline twin exists.
Verification questions
- Confirm reconcile_public_surfaces filter retains summary findings whose inline count != 1. With 0 inline matches the duplicate summary is kept; with 2+ inline matches the ambiguous duplicate is kept (per test). Good, but claim_graph topic.planned_action for that summary is set to 'summary' before reconciliation runs, so the handoff plan is not updated to reflect suppression.
- Confirm several existing tests had to be updated to add
planned_action/planned_thread_idfields to fixtures; six assertion sites now cover the new planned delivery field across dispositions (none, inline, summary, reply). Adjudication-loss re-derivation is not exercised. - Confirm canonical_text truncates after 24 tokens, so same_public_claim treats near-duplicates with diverging tails as identical and silently suppresses summary copies.
- Confirm planned_action is computed in build_active_claim_graph before adjudicate_claim_graph_conflicts; losing topics keep inline/summary plan while delivery flips to no-human-surface.
- Confirm prior P1 objection (truncated canonical_text silently suppresses summary after 24 tokens) was answered by adding same_public_claim with prefix-strip + full canonical_text, so reopens only if a qualifying prefix difference still falls through.
Verification questions
Refuted
[review body truncated; see review artifacts]
[review body truncated; see review artifacts]
| @@ -192,6 +196,12 @@ pub(crate) fn build_active_claim_graph( | |||
| } | |||
There was a problem hiding this comment.
[opposition] planned_action is computed before adjudicate_claim_graph_conflicts overwrites delivery to 'no-human-surface'; losing topics keep 'inline' or 'summary' plan, instructing the delivery seam to surface refuted claims. Recompute plan after adjudication or clear it for losing topics.
| .map_or(left, |(_, body)| body.trim()); | ||
| let left = canonical_text(left); | ||
| let right = canonical_text(right); | ||
| !left.is_empty() && left == right |
There was a problem hiding this comment.
[source-route] same_public_claim suppresses summary findings when only the first 24 tokens of normalized text match; later qualifying-condition divergence is silently dropped. Use a non-truncated normalized key or hash full canonical text for exact cross-surface dedup.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@src/compiler_reconciliation.rs`:
- Around line 706-725: Remove the redundant assertions at all three sites: in
src/compiler_reconciliation.rs:706-725, delete the seven-element tuple assertion
because lines 679-698 already cover each field; in
src/compiler_reconciliation.rs:762-770, delete the individual explanation.0,
explanation.1, and explanation.2 assertions because lines 751-761 assert the
tuple; in src/review_topics.rs:1606-1618, remove the inline_identity and
summary_identity rebuild, adding path and line checks to the existing assertions
only if those checks are required.
- Around line 512-515: Remove the tautological planned_action and
planned_thread_id assertions from the direct loser_graph fixture, and update the
associated suppression so it no longer cites them as evidence. Add equivalent
assertions in a test that obtains the graph through build_active_claim_graph,
where they validate production behavior rather than fixture literals.
In `@src/review_topics.rs`:
- Around line 1682-1701: Extend the planned_action test matrix around the
corroborated_with_new_evidence and refuted_by_new_evidence cases to explicitly
clear existing_threads and assert "none" when no current thread exists. Retain
the existing non-empty-thread assertions for both reply dispositions, covering
both guard outcomes in planned_action.
- Around line 1526-1553: Extend reconcile_public_surfaces_exact_matrix to use an
active claim graph with adjudicated survivor and losing topic identities,
ensuring graph-driven filter branches suppress the losing inline or summary
surface. Preserve the existing exact text-matching assertions, and add coverage
for the active losing-topic scenario rather than relying solely on
build_shadow_claim_graph’s empty topics and conflicts.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4a4bc3cb-b979-4cdf-9f77-12c0026cec69
📒 Files selected for processing (3)
.ripr/suppressions.tomlsrc/compiler_reconciliation.rssrc/review_topics.rs
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/verify-bun-review-artifacts.py (1)
5994-6009: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winMatch the Rust public-claim identity contract.
Line 6001 compares keys without either surface lane. The verifier cannot restrict prefix removal to the owning lane. It can treat a structural prefix such as
[src/other_parser.rs:18]as metadata.
compiler_canonical_tokensalso truncates at 24 tokens. Rust now compares the complete normalized public claim. Claims that differ after token 24 can therefore pass this verifier branch as duplicates.Pass each surface lane to
compiler_public_claim_key. Use an untruncated canonical-text path for this comparison. Add tests for structural prefixes and claims with different trailing conditions.🤖 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 `@scripts/verify-bun-review-artifacts.py` around lines 5994 - 6009, Update the duplicate_cross_surface validation to call compiler_public_claim_key with the appropriate surface lane for both claims, while preserving structural prefixes such as [src/other_parser.rs:18] as metadata rather than claim content. Use the untruncated canonical-text identity path so differences after 24 tokens remain distinct, and add coverage for structural prefixes and differing trailing conditions.
🤖 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.
Outside diff comments:
In `@scripts/verify-bun-review-artifacts.py`:
- Around line 5994-6009: Update the duplicate_cross_surface validation to call
compiler_public_claim_key with the appropriate surface lane for both claims,
while preserving structural prefixes such as [src/other_parser.rs:18] as
metadata rather than claim content. Use the untruncated canonical-text identity
path so differences after 24 tokens remain distinct, and add coverage for
structural prefixes and differing trailing conditions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: fc29c4f9-c143-4d75-8aad-8f3489813ecb
📒 Files selected for processing (4)
.ripr/suppressions.tomlscripts/verify-bun-review-artifacts.pysrc/compiler_reconciliation.rssrc/review_topics.rs
Summary
This PR completes the bounded #764 public-surface contract on current
main.It ensures that one semantic current-head claim has at most one planned public
location, that exact cross-surface duplicates are accounted for explicitly, and
that planned delivery metadata is deterministic and source-thread bound. The
artifact verifier now enforces the same contract, including the explicit
noneplan for a receipted claim-graph loser. GitHub transport, deliveryconfirmation, retries, proof execution, and body ranking remain out of scope
for #825; #765 owns transport.
Source and policy receipts
d0ad0a97cf02015d5ce8889fe491072a3e6dfc07.records after the colocated semantic matrices and generated-packet checks
passed. The final local ready scan reports
new_unsuppressed=0andthreshold=0; its only notice is the existing Python preview skip.non-rust-ripr-suppressionsreview warning was notrenewed or changed.
Verification
Local proof passed:
cargo fmt --all -- --checkreview_topicstests and 9compiler_reconciliationtestsub-reviewbinary testscargo test --workspace --all-targets --lockedcargo clippy --workspace --all-targets --locked -- -D warningscargo doc --workspace --no-deps --lockedcargo xtask policy-checkgit diff --checknew_unsuppressed=0Hosted exact-head run
30873539288passed theub-review/gate, artifactverifier, Codecov, and GitGuardian checks. The hosted gate is the authoritative
integration proof; it confirms the final generated packet and strict-zero
RIPR enforcement, not GitHub comment delivery, which is intentionally later
work.
CI budget
The exact-head hosted gate took approximately four minutes. It is required for
this slice because local RIPR and packet verification must be checked with the
hosted repository context and gate policy.
Agent notes
The valid exact-head findings were repaired or narrowly receipted after the
semantic tests were added. The final remaining hosted failure was a verifier
contract mismatch for an explicitly adjudicated losing topic; the verifier now
accepts only that conflict-receipted
no-human-surface/nonecase and has aregression self-test. CodeRabbit review automation was rate-limited during the
final pass; its actionable findings were independently checked and addressed.