fix: make join review read only

This commit is contained in:
User
2026-07-14 15:06:16 +02:00
parent c7474f3852
commit 27af6733c8
11 changed files with 378 additions and 22 deletions
@@ -104,20 +104,20 @@ Expected: PASS.
- Consumes: options `{ id, label, detail?, rationale? }`.
- Produces: response `{ id, kind: "join-review", choices: allOptionIds }` on `Continue`.
- [ ] **Step 1: Write failing builder and gate tests**
- [x] **Step 1: Write failing builder and gate tests**
Assert the builder emits read-only option details, `confirm_label: "Continue"`, and reserved controls.
Exercise `reviewer_decide` with only `join_modified` decisions; queue a Continue response containing
all ids and assert every `tht decision add` call occurs. Queue `control:"freetext"` and assert no
decision is written.
- [ ] **Step 2: Run harness tests and verify RED**
- [x] **Step 2: Run harness tests and verify RED**
Run: `cd harness && node --test .pi/extensions/gate/__tests__/builders.test.js .pi/extensions/gate/__tests__/gate_join_review.test.js`
Expected: builder/export/widget contract is missing and join calls still emit `multiselect`.
- [ ] **Step 3: Implement builder and gate routing**
- [x] **Step 3: Implement builder and gate routing**
Add `buildJoinReviewRequest`. In `reviewer_decide`, detect a non-empty, join-only merit list:
@@ -128,24 +128,24 @@ const joinOnly = opts.length > 0 && opts.every((o) => o.decision.type === "join_
Emit `join-review` with `detail` and `rationale`; after Continue persist all original decisions.
On free text, return feedback without persistence. Keep all other decisions on `multiselect`.
- [ ] **Step 4: Write failing frontend widget tests**
- [x] **Step 4: Write failing frontend widget tests**
Render two join cards and assert there are no checkboxes. Click `Continue` and expect all ids in the
response. Open `Other — specify`, submit correction text, and expect a freetext control response.
- [ ] **Step 5: Run frontend widget tests and verify RED**
- [x] **Step 5: Run frontend widget tests and verify RED**
Run: `cd frontend && npx vitest run src/widgets/JoinReviewWidget.test.tsx src/widgets/registry.test.tsx`
Expected: widget and registry entry are missing.
- [ ] **Step 6: Implement and register JoinReviewWidget**
- [x] **Step 6: Implement and register JoinReviewWidget**
Render semantic cards with label, detail, and rationale, one `Continue` primary button, and
`ReservedControls`. Register `join-review` and extend `WidgetOption` with optional `detail` and
`rationale` strings.
- [ ] **Step 7: Update model instructions and verify targeted tests**
- [x] **Step 7: Update model instructions and verify targeted tests**
Document that joins must be a separate join-only `reviewer_decide` call; the reviewer cannot remove
individual joins and textual corrections require a complete revised proposal.