Repository navigation
feat(domain): guarded test edit precondition DTOs; ADR 0026 proposed (#1902, carries #12649) - #12962
Conversation
…sed (#1902) Carrier for #12649 on current main. Registrations moved to the per-PR fragments (.ripr/traceability.d, policy/doc-artifacts.d, docs/spec-index.d) instead of appending to shared tails. check-architecture exempts the cfg(test) corpus loader's serde_json like next_action.rs. ADR 0025 is proposed, not accepted (#1902 keeps acceptance a pending design decision). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 26 minutes. View limit details
|
There was a problem hiding this comment.
Code Review
This pull request proposes ADR 0025 and introduces RIPR-SPEC-0320, establishing a guarded, opt-in, test-only assertion replacement edit class. It implements the versioned source-precondition contract (ExactTestEditPrecondition and GuardedEditUnavailable) in crates/ripr/src/domain/guarded_edit.rs with comprehensive unit tests and a corpus-backed validation fixture. The PR also updates the identity registry, changelog, and architectural policies to accommodate these changes. No review comments were provided, so there is no feedback to address.
…pact Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
EffortlessSteven
left a comment
There was a problem hiding this comment.
REPAIR_REQUIRED (technical COMMENT, not approval)
Reviewed head: c5827c7
Integration basis: main 075e4e8
Scope: source/contract review of the guarded-edit DTO, minting, validation, corpus, API visibility and #12926 overlap. No edit emission or runtime consumer is present, so these findings concern the proposed boundary, not an observed applied-edit incident.
-
Snapshot identity is not bound. guarded_edit.rs:533–559 omits document_version, instruction_instance_id and all snapshot identity fields from the ID hash. Changing only document version or instruction instance preserves the ID, contrary to identity/catalog.rs:233–248. Repair direction: bind the governed inputs and test each identity/version perturbation independently. The corpus's expected ID is copied from the actual result at lines 719–739, so its drift comparison cannot detect this defect. Confidence: high.
-
Missing validation evidence passes minting. guarded_edit.rs:388–397 rejects only Failed, while omitted parse/format fields default to NotRun (lines 189–190 and serde(default)). An otherwise valid positive input still mints without either validation having run. Repair direction: require Passed for the exact precondition, with missing-field and NotRun negatives for both fields. Confidence: high.
-
Decoded DTO validation is weaker than builder validation. guarded_edit.rs:442–485 accepts a previously valid DTO changed to test_file = src/lib.rs and allowed_edit_surface = [src/lib.rs]. Failed parse/format status, an empty selector and disabled required capabilities are also unchecked. Repair direction: centralize the final invariant checks and test decoded/mutated DTOs, not only builder inputs. Confidence: high.
-
Test-path recognition admits traversal and non-Rust targets. guarded_edit.rs:301–306 returns true for tests/../src/lib.rs, tests/readme.md and ../other/tests/demo.rs. normalize_path only replaces separators; matching the sole allowed surface does not establish containment. Repair direction: require a contained normalized Rust test source, using the repository's source-role authority where applicable; cover traversal, non-Rust extensions and outside-root paths. Confidence: high from source and mechanical evaluation of this predicate, not compiled Rust execution.
-
The documented Rust contract is inaccessible. domain/mod.rs:21 declares a private guarded_edit module and adds no re-exports. The documented domain::guarded_edit::EditInstructionId path and DTOs cannot be imported by external consumers or sibling adapters. Repair direction: settle intended visibility and the matching public-API policy, or explicitly retain a staged internal contract. Potential dead_code/-D warnings consequences remain unexecuted; no compiler failure is claimed. Confidence: high for privacy.
-
Digest-only DTOs disagree with the source verifier. validate() permits original text absent when a digest exists (lines 451–465), consistent with the ADR's passive representation, but verify_source_text:502–517 unconditionally requires text. Repair direction: support comparison against the current text's SHA-256 when only a valid digest is retained, with positive/negative tests for both representations. Confidence: high.
Integration concern: #12926 at 81b2750 independently assigns ADR 0025 to lockstep support crates, deletes domain/mod.rs and relocates identity/catalog.rs. Composition needs unique ADR numbering and refreshed module/catalog mappings. guarded_edit depends on InstructionSemanticId/InstructionInstanceId from fix_instruction, which stays facade-hosted in ripr; moving it blindly into ripr-contract would invert that dependency.
Validation limits: no Rust build/test was run in this review. The inspected CI run was skipped; the successful Windows gate skipped its execution job. No integration or final merge clearance is asserted. Focused repair verification should include cargo test -p ripr --lib fix_instruction, relevant DTO counterexamples, workspace Clippy, and identity/public-API/architecture/traceability gates.
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY — head c5827c7
Independent review against current main (05b9f30; the PR's base is 075e4e8). A trial merge of this head into main applies cleanly with no conflicts. No unresolved review threads. Built and executed on the merged tree.
The four findings from the earlier carrier (#12649) are all closed.
- Traceability collision. The entry is now a fragment,
.ripr/traceability.d/guarded-test-edit-precondition-1902.toml, so nothing is appended to the shared monolith.check-traceabilityexits 0 on the merged tree. - Architecture gate.
policy/architecture.txtgains one exemption forcrates/ripr/src/domain/guarded_edit.rswith its reason (cfg(test) corpus loader). I checked the claim in that reason: the onlyserde_jsonuse in the file is at line 692, inside the#[cfg(test)]module that starts at line 583, so production precondition code does not touch it.check-architectureexits 0. - Text conflicts.
docs/identity/REGISTRY.mdcarries the singleEditInstructionIdrow change,registry.v1.jsonmatches, and no shared-file edit remains fordoc-artifacts.toml(the spec registers throughpolicy/doc-artifacts.d/RIPR-SPEC-0320.toml,docs/spec-index.d/RIPR-SPEC-0320.mdand the traceability fragment).check-identity-registryexits 0. - ADR status. ADR 0025 is
Status: proposed; its row indocs/adr/README.mdand the doc-artifact entry say proposed and name acceptance as a pending design decision on #1902; RIPR-SPEC-0069's non-goal now says the ADR and spec "propose" the exception; RIPR-SPEC-0320 line 59 says "once accepted". Nothing in the diff claims the read-only default has changed. Accepting the ADR stays the owner's call.
Executed on the merged tree.
cargo test -p ripr --lib guarded_edit: 6 passed, 0 failed.cargo test -p ripr --lib identity: 565 passed, 0 failed (covers the catalog change).- xtask gates, all exit 0:
check-spec-format,check-spec-numbering,check-doc-artifacts,check-doc-index,check-traceability,check-identity-registry,check-architecture,check-support-tiers,check-output-contracts,check-public-api,check-fixture-contracts,check-generated-clean,check-static-language,check-file-policyandcheck-capabilities.
Scope. The module adds typed DTOs, a fail-closed builder and apply-time checks, with a corpus fixture; it emits no TextEdit and advertises nothing in the LSP. The classified output does not change, so I expect no cache bump for this PR.
Not run: the full lib suite, goldens, clippy and the hosted Ripr Rust Small Result.
Generated by Claude Code
Bind the edit instruction id to document version, instruction identities and snapshot identity; require passed parse/format evidence; hold decoded DTOs to the builder's rules through one validate(); admit only contained Rust test sources; make the documented module reachable and record it in public_api.txt; verify digest-only sources against the digest. Corpus ids are literals from an independent reference. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
…h literal (#1902) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
…ed-edit path check (#1902) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
…ded-edit ADR to 0026 (#1902) Main took ADR 0025 for the Go parser substrate. Keep main's 0025 row and rename this PR's ADR to 0026-guarded-test-only-edit-boundary, updating every reference (README row, RIPR-SPEC-0320, RIPR-SPEC-0069, spec index fragment, traceability fragment, changelog fragment). Status stays proposed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY — head f9d9b8b
Integration basis: main e32323a (merge-base equals main; the diff is the 16 intended files).
Scope: full source review of guarded_edit.rs, the identity catalog and registry, public_api.txt, the corpus, RIPR-SPEC-0320, ADR 0026 and the registrations, compared against main. The six findings from the earlier review of c5827c7 were each checked against the repaired code:
- The edit ID now derives from the precondition's own governed inputs: document version, instruction identities, snapshot, config, base revision, workspace, head, input, target, original digest, replacement and range. Sixteen independent perturbation cases, plus an empty-vs-absent case, show the ID changing.
- NotRun or Failed parse/format evidence refuses to mint, including omitted serde-default fields.
- validate() is the single invariant check, called by the builder and by decoded DTOs. Fifteen decoded mutations are rejected.
- The test path must be contained and a .rs file under a tests directory segment. Traversal, non-Rust and outside-root paths are rejected. Dropping the
_test.rsnaming rule is consistent with RIPR-SPEC-0153. #[doc(hidden)] pub mod guarded_editwith 20 public_api.txt lines follows the existing precedent; hosted check-public-api remains the confirmation.- verify_source_text handles text plus digest, digest-only, and neither.
The corpus IDs and digests were reproduced independently with ref_id.py (99ad9b7b…, 95d57931…). That checks implementation fidelity; the perturbation test is the discriminating check. ADR numbering is 0026 throughout (README, traceability, spec, changelog, RIPR-SPEC-0069 wording) and main's 0025 Go parser ADR is untouched. There are no unresolved review threads. ADR 0026 remains Proposed.
Follow-ups, none affecting this change, tracked in #12986: document the (None, _) behaviour of verify_document_version, assert reasons in the mutation test, require normalized test_file in validate(), and consider binding must_not_change and command refs in the ID.
Not established by this review: hosted CI on this head (no Rust build was run here). The merge-ready label requests the Ripr Rust Small Result; it must be green on this exact head before merge.
Generated by Claude Code
…#1902) Absent version on the precondition or the current document now refuses with document_version_mismatch; adds a test for both None cases and one spec sentence in RIPR-SPEC-0320. Resolves the Graphite finding and closes the #12986 item 1 note (spec states the (None, _) outcome). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY — head ce72f78
Delta review of f9d9b8b..ce72f78 (one commit). Integration basis is unchanged: main e32323a. The earlier full review of f9d9b8b still stands for every unaffected dimension; only the document-version check, its test and one spec sentence changed.
- verify_document_version now returns Ok only for (Some(expected), Some(actual)) with expected == actual. An absent version on either side returns document_version_mismatch, which is fail-closed and consistent with the other apply-time helpers.
- The new test covers current None against a versioned precondition, and an unversioned precondition against both None and Some(3). The existing document_and_source_checks test uses a versioned sample (Some(3)) and still holds: match on 3, mismatch on 4.
- verify_document_version has no consumer outside this module and its tests, so the tightening affects nothing else.
- The RIPR-SPEC-0320 sentence matches the code.
- The single review thread (graphite, guarded_edit.rs:609) is resolved, with a reply, and there are no other threads.
Not established by this review: hosted CI on this head (no Rust build was run here). The Ripr Rust Small Result must be green on this exact head before merge.
Generated by Claude Code
|
Generated by Claude Code |
verdict-corpus check-all required a spec-scopes fragment for every corpus (perl, python, rust, typescript) because the spec has numbered acceptance examples. It is a domain precondition DTO, not an analyzer verdict. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
|
|
There was a problem hiding this comment.
Confirmed findings
- Digest-only validation admits a precondition whose ID cannot distinguish two original source texts having the same digest field but different retained text.
- The identity registry describes EditInstructionId as source-bound, but the implementation binds source through a caller-supplied digest rather than a canonical source value.
Verification questions
- Confirm the new public helper routes are centralized in domain::guarded_edit, but the PR states there are no production consumers.
- Confirm the corpus's two positive cases omit document_version, although apply-time verification rejects every absent version.
- Confirm the claimed independent reference for corpus identity literals is not independently evidenced, so corpus drift detection is weaker than the spec asserts.
Evidence gaps
- No scheduled cargo-test receipt was available in this packet, so active-view assertions remain unconfirmed by a completed test run.
- Broad repository-wide sibling coverage is not established because the Rust sensor failed and the late cargo-test receipt is absent.
- The corpus has positive identity literals and negative reason rows, but the scheduled cargo-test receipt is absent, leaving execution status unverified in this lane.
- The new Rust unit tests and corpus-backed behavior lack a completion receipt in this packet.
- The cargo-test receipt was absent in the supplied packet, while the ripr sensor failed.
- Model proof intent was rejected by deterministic validation.
- Successful compilation and test execution are not established by the available.
…ty (#1902) Case 2 now carries document_version 3 (matching case 1); its edit-instruction id is re-derived with the reference transliteration (b0aad19c46de8d3e; source digest unchanged). Spec: a version-less precondition mints but never verifies; the reference is described as a transliteration, not an independent oracle. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY — head 5f30a7e
Delta review of 081d6e2..5f30a7e (3 files). The earlier full review of f9d9b8b and the deltas at ce72f78 and 081d6e2 stand for every unaffected dimension. Integration basis: main e32323a at the time of review; main has since moved ahead and a trial merge was clean.
- The boundary_value_equality_replacement positive now carries document_version 3, so a precondition minted from it can pass verify_document_version.
- Its expected edit_instruction_id changed to edit-instruction:b0aad19c46de8d3e. I reran ref_id.py on the committed corpus: it reproduces that ID for case 2 and 99ad9b7b… for case 1, and the digests are unchanged. The ID changing while the digest holds is what the document-version binding predicts.
- RIPR-SPEC-0320 now says the corpus ids come from a transliteration of the paragraph (fidelity, not an independent oracle) and that a precondition without a document_version mints but can never verify. The test comment matches. This addresses the overstatement noted in the previous round.
- The single review thread is resolved, and there are no other threads.
Not established by this review: hosted CI on this head (no Rust build was run here). The Ripr Rust Small Result must be green on this exact head before merge.
Generated by Claude Code
) Builder and validate now refuse (source_text_mismatch) a range that does not cover original_source_text: LSP convention, 0-based, UTF-16 units, end exclusive; multi-line ranges check line count and last-line width. Corrects all 15 corpus ranges and sample_input, re-derives both edit-instruction ids with ref_id.py, adds one-short and one-long negative rows, a covers_text unit test and two decoded-DTO mutations, and a spec clause. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmoz3yvGnngtDNnPKxG
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY — head 54cfc6d
Delta review of 5f30a7e..54cfc6d (guarded_edit.rs, RIPR-SPEC-0320, corpus.json). Earlier reviews stand for every unaffected dimension. Main has moved ahead since the last full comparison; the earlier trial merge was clean.
- Width math: covers_text counts UTF-16 units. A single-line range must satisfy end_character - start_character == width(text); a multi-line range must span one line per
\nand end at the UTF-16 width of the last line, ignoring start_character on the final line as LSP does. I checked it by hand onassert!(result.is_err());(25 units, 4..29), on U+1D11E plus U+00E9 (2+1 = 3, so 0..3 passes and 0..2 fails), and ona(\n b,\n);(lines 1..3, end 2).segments.len() - 1can't underflow because split always yields one segment. Checked-sub comparisons reject reversed ranges. - It runs in the builder and in validate() after the earlier refusals, and reports source_text_mismatch. The digest-only representation skips it, since there is no retained text to cover. That matches the spec wording.
- Corpus: I recomputed coverage independently for all 17 rows. Both positives and every earlier negative cover their text, and the new range_one_short_of_text and range_one_long_of_text rows do not. ref_id.py reproduces the new IDs from the committed corpus: 99aa357ba1136b76 and b0a4059c46d8c6ec, with unchanged digests. The corpus literals match.
- Tests include the non-BMP, accented and multi-line cases, the builder in both directions, and two decoded mutations. The perturbation test keeps each case valid, since it moves the range along with the text.
- Residual, not affecting this change: a lone
\ris a line break in LSP but is not counted here, and CRLF text keeps\rin earlier lines only, which is harmless. It's worth a note in #12986. - Both review threads (guarded_edit.rs 395 and 644) are resolved, and there are no unresolved or outdated threads.
Not established by this review: hosted CI on this head (no Rust build was run here). The Ripr Rust Small Result must be green on this exact head before merge.
Generated by Claude Code
There was a problem hiding this comment.
Confirmed findings
- Digest-only behavior is tested in Rust but not represented as a corpus case, weakening repository-level evidence for an explicitly documented passive representation.
- The positive corpus identity literals exercise implementation/spec fidelity but cannot independently detect a shared hashing-oracle error; add an independent fixture-generation oracle or a fixed algorithm reference with separately reviewed expected values.
Verification questions
- Confirm the corpus exercises full text-and-digest preconditions, but its committed positives do not independently cover the digest-only representation.
- Confirm the corpus ID check is not an independent red/green oracle because expected IDs were generated by transliterating the same FNV algorithm used by the implementation.
Refuted
- Serialized preconditions are decoded into ordinary owned Rust values, so there is no separate active-view region whose length can become stale relative to a backing store.
Evidence gaps
- No completed cargo-test receipt is available in this packet, so the new module's exercised behavior is established by source inspection and seeded prior reviews rather than a fresh local witness.
- The advertised fail-closed behavior is not independently witnessed in this packet because cargo-test has no receipt and the Rust sensor failed.
- The Rust behavior changed, but no completed cargo-test receipt is present in this review packet.
- The changed Rust behavior lacks a completed scheduled cargo-test receipt, while the ripr sensor failed with exit code 2.
- Compiled test execution remains unconfirmed because the cargo-test receipt is absent and the ripr sensor failed.
- The scheduled cargo-test receipt is absent, so this packet does not establish that the new module compiles or that its unit/corpus tests pass.
- Model proof intent was rejected by deterministic validation.
|
Required qualification receipt for unchanged head Request 41828681365, attempt 1, failed in gate job 126570288828. At 13:55:46 UTC the PR-evidence producer reported The actual gate checkout was This establishes incomplete qualification due to the producer timeout, not a guarded-edit test failure or a complete zero-finding analysis. No new campaign or source change was launched for this diagnostic report; existing branch ownership is unchanged. |
Summary
crates/ripr/src/domain/guarded_edit.rs(exact_test_edit_precondition.v1, closedGuardedEditUnavailablereasons, builder, apply-time checks), the corpus fixture, RIPR-SPEC-0320, ADR 0026 (renumbered from 0025), and the RIPR-SPEC-0069 non-goal amendment..ripr/traceability.d/,policy/doc-artifacts.d/,docs/spec-index.d/) instead of the shared tails feat(domain): ratify guarded test edit precondition DTOs (Closes #1902) #12649 appended to.policy/architecture.txtexempts the cfg(test) corpus loader'sserde_jsoninguarded_edit.rs, mirroring thenext_action.rsexemption.proposed, not accepted. slice(#1571 PR A): ratify guarded test-only edit boundary and define exact source-precondition DTOs #1902 still records acceptance as a pending design decision.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Spec: RIPR-SPEC-0320, RIPR-SPEC-0069 (amended non-goal)
ADR: 0026 (proposed)
Governing issue or accepted claim: #1902
Acceptance delta (one sentence): Types the versioned
ExactTestEditPrecondition/GuardedEditUnavailablefail-closed boundary with corpus-backed minting and records ADR 0026 as a proposal, without emitting or applying LSP edits.Candidate Relationships
Candidate branch: guarded-edit-precondition-1902-carrier
Proposed replacement of PR (if any; not yet accepted): supersedes #12649 (closed in favour of this carrier)
Acceptance retained from a replaced candidate (if any): all #12649 content, plus the three fragment moves and the architecture exemption
Scope
Scope Classification
Production delta: new
domain::guarded_editmodule (no consumers yet).Evidence/support delta: corpus fixture, unit tests, spec/ADR.
Single acceptance criterion: the precondition builder fails closed on every corpus negative row and mints only the two positive classes.
Non-goals: no
TextEdit, no LSP advertisement, no source mutation; #1903 / #8183 out of scope.Support-tier Impact
Policy Impact
Ledger or exception notes:
policy/architecture.txtserde_json exemption for the cfg(test) corpus loader (#1902).Proof
Result, failures, or skipped proof: no Rust build on the authoring box; hosted CI is the compiler. Not yet run:
cargo xtask check-architecture,check-traceability,check-doc-artifacts,check-spec-format,check-identity-registry.Claim Boundary
May claim: the boundary is typed and fail-closed in the domain layer. Must not claim: ADR 0026 accepted, any edit emitted or applied, or replacement correctness.
Rollback
Revert the squash commit; nothing consumes the module yet.
Spec-Test-Code Traceability
domain::guarded_edit::tests::fix_instruction_guarded_edit_*crates/ripr/src/domain/guarded_edit.rsfixtures/boundary_gap/expected/guarded-edit-precondition/corpus.jsonStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Generated by Claude Code