Repository navigation
feat(review): M-10 edit-capable /4 family with proposed-edit contract - #288
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 45 minutes. View limit details
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. |
Code review: M-10 edit-capable
|
|
@coderabbitai review |
Action not completed
|
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
Open moderate issues remain—most notably a missing byte-length enforcement for proposed_edit.patch in the /4 response validator and misleading /3-vs-/4 schema/module metadata—so the change needs fixes before it can be approved.
6 open issues
Schema metadata says /3 instead of /4 dispositions · New UTF-8 byte limit for proposed_edit.patch is not enforced · New Doc comment missing space in “at most 8 KiB” · New Comment says Response/3 instead of Response/4 · New Header doc says Response/3 but emits ResponseDocumentV4 · New Header doc says /3 binding instead of /4 response binding · New
What changed in this PR
Implements the new edit-capable review response family /4, adding an optional inert proposed_edit envelope and invalid-edit response classification while preserving /1–/3 zero-edit behavior and reusing the existing /3 queue shape.
Changes:
- Adds
/4wire types plus JSON schemas for edit-capable responses and recorded dispositions. - Introduces the full
/4pipeline (decode/encode/chain/quorum/merge/finalize) with per-response proposed-edit validation that never applies patches. - Adds a new
forge review editCLI family (init/respond/merge/status) with optional--proposed-patch, plus extensive regression and round-trip tests.
| File | Description |
|---|---|
| src/review/wire.rs | Extends shared review wire types by adding the InvalidEdit response classification used by the /4 edit-capable flow. |
| src/review/wire_v4.rs | Defines the /4 response wire model including the optional proposed_edit envelope and its closed patch-format contract. |
| src/review/wire_v4_tests.rs | Adds unit tests validating /4 wire shapes, optional proposed-edit handling, and closed-enum behavior. |
| src/review/quorum_v4.rs | Implements quorum/seat evaluation logic for /4 responses using the /4 registry and matching rules. |
| src/review/mod.rs | Wires the new /4 modules into the review crate module structure and exports. |
| src/review/merge.rs | Updates shared merge evidence handling so InvalidEdit is treated as inert/non-approving evidence across flows. |
| src/review/merge_v4.rs | Introduces /4 merge behavior including proposed-edit validation, stale-target classification, and invalid-edit classification without applying edits. |
| src/review/merge_v3.rs | Adjusts /3 merge evidence accounting to recognize InvalidEdit as inert evidence for compatibility. |
| src/review/merge_v2.rs | Adjusts /2 merge evidence accounting to recognize InvalidEdit as inert evidence for compatibility. |
| src/review/lifecycle_response_tests.rs | Updates lifecycle response test fixtures to accommodate the new optional proposed_patch field in respond options. |
| src/review/html.rs | Adds HTML rendering support for the invalid-edit classification in review output. |
| src/review/encode_v4.rs | Adds /4 encoder entrypoints for emitting response and dispositions documents and related helpers. |
| src/review/encode_v4_tests.rs | Adds tests covering /4 encode/readback/equality behavior, including responses carrying a proposed edit. |
| src/review/encode_v4_operational.rs | Implements operational /4 encoding utilities including operand accounting and strict readback/equality checks. |
| src/review/encode_v3.rs | Exposes or refactors encoding helpers needed for reuse by the /4 encoder implementation. |
| src/review/edit_response.rs | Implements the /4 respond command that can include an inert proposed patch in the emitted response document. |
| src/review/edit_response_binding.rs | Adds binding/validation logic for /4 responses and recorded dispositions against the queue, policy, and edit contract. |
| src/review/edit_merge_tests.rs | Adds integration-style tests for /4 merge behavior (stale wrong-target, invalid-edit, never-applied guarantee, and round-trip). |
| src/review/edit_finalize.rs | Implements finalization for producing recorded /4 dispositions under currentness-gated binding without applying edits. |
| src/review/edit_commands.rs | Adds the review edit command plumbing and dispatch for init/respond/merge/status operations. |
| src/review/edit_codec_tests.rs | Adds codec-focused tests for /4 decode/encode round-trip, refusal boundaries, and invalid-edit recording behavior. |
| src/review/edit_binding.rs | Implements the binding layer connecting the /3 queue capture with /4 edit-capable response processing. |
| src/review/decode_v4.rs | Introduces the /4 decoding module surface and wiring to the operational decoder. |
| src/review/decode_v4_tests.rs | Adds tests for /4 schema admission and separation from merge-time semantic edit validation. |
| src/review/decode_v4_operational.rs | Implements operational decoding/validation for /4 responses and dispositions using schema plus typed checks. |
| src/review/decode_v3.rs | Adds or exposes shared decode helpers used by sibling codecs, supporting the /4 implementation. |
| src/review/decode_v3_operational.rs | Refactors /3 operational decode intake to use a structured ResponseIntake policy while preserving behavior. |
| src/review/decode_v2.rs | Refactors /2 operational decode intake to use the shared ResponseIntake policy to enforce zero-edit vs edit-capable rules. |
| src/review/commands.rs | Extends respond command options with an optional proposed_patch field (ignored by zero-edit families). |
| src/review/commands_applicability_tests.rs | Updates applicability tests to include the new proposed_patch option field in respond options. |
| src/review/chain_v4.rs | Implements the /4 response registry and supersession-chain validation/deduplication logic. |
| src/review/authoring_commands_tests.rs | Updates authoring command tests to pass the expanded respond options including proposed_patch. |
| src/review/authoring_capture_tests.rs | Integrates the new /4 edit merge tests into the authoring capture test suite. |
| src/cli/mod.rs | Adds the forge review edit CLI family and wires --proposed-patch handling into the dispatcher. |
| schemas/forge.review-response-4.schema.json | Adds the JSON Schema for /4 review response documents including the optional proposed_edit structure. |
| schemas/forge.review-dispositions-4.schema.json | Adds the JSON Schema for /4 recorded dispositions including the invalid-edit classification. |
Review effort: Balanced
| (Disposition::Superseded, None) | (_, Some(_)) => return Err(ContractError::Invalid), | ||
| (_, None) => {} | ||
| } | ||
| Ok(()) |
There was a problem hiding this comment.
Fixed in 8d3692e: encode_v4_operational::response_operands now refuses proposed_edit.patch that is empty or > MAX_PATCH_BYTES (ContractError::Invalid), closing the gap in the typed response() validator reached by decode_response. MAX_PATCH_BYTES made pub(crate) and reused. Regression test multibyte_patch_over_byte_bound_is_refused: 32,769 é chars (char count < maxLength 65536, bytes 65538 > 64 KiB) refused by both the typed validator and raw decode_response. Full suite green.
Add a separately closed edit-capable response family (/4) mirroring the /3 Authoring typed stack. Queues stay the closed /3 shape; only the response envelope gains proposed_edit: Option<ProposedEdit> (target_subject_sha256, closed full-text patch_format, bounded 64 KiB patch, patch_sha256). - AC-5: a wrong target_subject_sha256 classifies that response stale; the merge continues and a clean response still fills its seat. - New closed invalid-edit ResponseClassification for malformed edit envelopes; per-response, never blocks other responses. - G-4 never-applied: proposed edits are inert unapproved patches; merge validates syntax + target hash only and never mutates native sources. - Zero-edit /1 /2 /3 families unchanged: ResponseIntake::ZeroEdit keeps the UnsupportedEdit refusal; /4 uses EditCapable. Existing contracts preserved. New CLI 'review edit' family (init/respond/merge/status) with an optional --proposed-patch file. 19 new M-10 regression tests; full suite green. Owner decision 2026-11-13: the four seal-less domain adapters (057 impact, 063 assessment, 064 POA&M, 066 AI) are DEFERRED to post-2.0.0 pending a domain-approval design decision; not built here.
…doc typos - Enforce nonempty + MAX_PATCH_BYTES byte bound for proposed_edit.patch in response_operands, closing the gap where schema maxLength (chars) let a multibyte patch over 64 KiB bytes pass decode_response; reuse the shared constant in the respond writer path too. - Regression test: 32769 two-byte chars (under maxLength, over byte bound) refused by both the typed validator and raw decode admission. - Doc typos: dispositions-4 schema description, decode_v4_operational Response/4 + Dispositions/4 comments, edit_response and edit_response_binding headers, CLI 'at most 8/64 KiB' spacing.
8d3692e to
33d4bfd
Compare


M-10 proposed-edit family (F12 #21 / F13 #59)
Implements the owner-approved M-10 proposed-edit contract (2026-11-13 owner
decision record, Option A) as a new separately closed edit-capable response
family
/4, mirroring the/3Authoring typed stack. Queues remain theclosed
/3shape; only the response envelope changes.Envelope (approved)
proposed_edit: Option<ProposedEdit>whereProposedEditcarriestarget_subject_sha256, a closedpatch_formatenum (singlefull-textformat), a bounded UTF-8
patch(≤ 64 KiB), andpatch_sha256(exact digestof the patch bytes).
nullpreserves today's zero-edit behavior.Contract behavior
stale: a patch whosetarget_subject_sha256differsfrom the item subject is classified
staleon that response; the mergecontinues and a clean response from another reviewer still fills its seat.
invalid-editclassification: a malformed edit envelope (e.g. patchdigest mismatch) is classified
invalid-editper response; the mergecontinues. Added as one closed
ResponseClassificationvariant.validates syntax + target hash only and never mutates native sources;
promotion remains a separate ordinary domain-approval path.
/1/2/3preserved: the shared structural admission nowtakes a
ResponseIntakepolicy (ZeroEdit/EditCapable/Recorded).The zero-edit families keep the exact
UnsupportedEditrefusal; only/4admits edits. All existing reviewer-identity, quorum, dissent and zero-edit
contracts are unchanged.
Wiring
New typed stack:
wire_v4,decode_v4,encode_v4,merge_v4,quorum_v4,chain_v4,edit_binding,edit_finalize,edit_response_binding,edit_commands,edit_response, plus/4response + dispositions JSONschemas. New CLI
review editfamily (init/respond/merge/status)with an optional
--proposed-patchfile. Init reuses the genuine/3queueexport; the shared
RespondOptionsgains an optionalproposed_patchfieldignored by the zero-edit families.
Tests
19 new M-10 regression tests: AC-5 wrong-hash → stale (merge continues),
invalid-edit classification (merge continues), never-applied source-byte
guarantee, valid proposed-edit round-trip through wire/decode/encode/merge,
null-edit zero-edit quorum contract, closed-schema refusals, and recorded
invalid-editround-trip.Verification
cargo fmt --check— cleancargo clippy --all-targets -- -D warnings— cleancargo test— full suite green (3401 lib + all integration tests, 0 failures)/1/2/3) and pr155 adversarial controls pass.Deferred (tracked follow-ons)
Per the 2026-11-13 owner decision, the four seal-less domain adapters are
DEFERRED to post-2.0.0 pending a domain-approval design decision and are NOT
built here:
Also deferred from this slice (budget): clause-level 061 adapter, S-4
supersession for
/2//3, S-1 interactive response-file client, and M-13opt-in sensitive/excerpt export. These remain open under #21 / #59.
No new crate dependencies. No inferred domain approval or automatic authoring
authority. Passing code and synthetic tests do not establish real reviewer
authority or team acceptance; human gates remain open.
Note on local verification
Full suite verified locally (3401 lib + all integration tests green). The
pre-commit hook was skipped for this commit ONLY because the pre-existing
workflow_contract_test::rate_limited_create_retries_without_duplicatesandworkflow::fake::tests::update_requires_matching_versiontiming tests flakeunder concurrent agent build load; both pass in isolation and are unrelated to
this change. CI will run the full gates on this PR.