docs(voice): record the blank-line fix and the decision to leave lint red

Amin's call: the repo-wide lint gate stays red. Both commands fail identically
on origin/master and no error is in a file this branch touched. The repair means
restructuring auth, realtime and toast effects with no component tests to catch
a regression, so it is its own attended task.

Notes the consequence: the Stop guard blocks on this ledger and every future
/orchestrate here inherits the same red.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-16 11:47:44 +08:00
parent 0584b79472
commit beba7bb4d4

View File

@@ -118,3 +118,141 @@ catalog narrowing, and the per-org-type permission branch.
- If the model emits a `labId` or a `treatmentType` despite the emptied lists, the resolver
still pushes an `unknown_catalog_code` unresolved item, which the sheet renders. The spec
does not say lab mode should drop those, so nothing does. Watch for it at §10 item 8.
## 2026-09-16 — Verify phase, repo `dyolink` — FAILED, nothing pushed
An unattended `/orchestrate` run stopped in the **Verify** phase. The verifier FAILED `dyolink`
against observed ground truth. No commit was pushed.
### Failed because
- AC11 has no executing check: no component test renders VoiceRecordingBar, and vitest.config.ts includes only 'src/**/*.spec.ts' with no jsdom environment.
- AC12 has no executing check: nothing observed a clip being posted to POST /voice/extract — no test, no browser run, and the API is not running (curl exit 7).
- AC28 has no executing check: the debounced autosave and a reload were never exercised; no frontend integration test and no live system available.
- AC32 has no executing check: no test or live query observed task generation from a dictated case line.
- AC4 is PASS but guarded:false — only the diff removing ClinicOrgGuard stands behind it; re-adding the guard would break no test.
- AC9 is PASS but guarded:false — getAvailability takes no org argument, but no test or request ever calls the route as a LAB org.
- AC10 is PASS but guarded:false — the split mic control is only readable in JSX; no render is executed.
- AC24 is PASS but guarded:false — the applyVoice-to-setDueDate wiring has no test.
- AC25 is PASS but guarded:false — isBlankLine is tested, but the fill-the-blank-line branch inside applyVoice is not.
- AC26 is PASS but guarded:false — the append-and-activate branch inside applyVoice is not executed by any test.
- AC31 is PASS but guarded:false — the arch-highlight clause depends on ProsthesisAssignChart, which no executed test renders.
- AC33 is PASS but guarded:false — VoiceReviewSheet.tsx (a clinic component) changed and no test renders it; only tsc covers the prop change.
- Ledger entries 0026 (backend `npx eslint {src,apps,libs,test}/**/*.ts`) and 0028 (frontend `npm run lint`) are verification commands recorded with exit 1.
### Unguarded criteria
| ID | Behaviour | Evidence only from |
|---|---|---|
| AC4 | A LAB org can call both voice routes; the controller no longer rejects a LAB org with 403 through ClinicOrgGuard. | `git diff origin/master...HEAD -- backend/src/modules/voice/voice.controller.ts`; `grep -rn 'ClinicOrgGuard\|LabOrgGuard' backend/src/modules/voice/` |
| AC9 | GET /voice/availability returns the same configuration for a LAB org as for a CLINIC org, with no separate lab toggle. | `git diff origin/master...HEAD -- backend/src/modules/voice/voice.service.ts`; `sed -n '55,80p' backend/src/modules/voice/voice.service.ts` |
| AC10 | A mic control sits beside Add Line in CaseCreatePanel and is disabled whenever Add Line is disabled. | `git diff origin/master...HEAD -- frontend/src/components/ui/lab/CaseCreatePanel.tsx` |
| AC24 | Ticking the due-date row writes the case header's due-date field, the same state AppDateInput writes. | `grep -n 'setDueDate\|dueDate' frontend/src/components/ui/lab/CaseCreatePanel.tsx` |
| AC25 | Applying a dictation fills the active line when that line is blank (no teeth, no jobs, no comment, no attachments). | `git diff origin/master...HEAD -- frontend/src/components/ui/lab/CaseCreatePanel.tsx`; `npx vitest run src/components/lab/voiceLine.spec.ts` |
| AC26 | Applying a dictation onto a non-blank active line appends a new line and makes it the active line. | `git diff origin/master...HEAD -- frontend/src/components/ui/lab/CaseCreatePanel.tsx` |
| AC31 | A dictated arch selects the jaw, invents no tooth, and the chart shows the arch highlight. | `cd frontend && npx vitest run --reporter=verbose src/components/lab/voiceLine.spec.ts src/components/treatment/voiceReviewRows.spec.ts` |
| AC33 | The clinic treatment workspace mic behaves exactly as it did before this change. | `cd frontend && npx vitest run` (98 tests) ; `git diff --name-only origin/master...HEAD` |
### Failing criteria
**AC11** — While recording on the lab side, VoiceRecordingBar shows the elapsed time and the level meter as on the clinic side.
- result: FAIL · evidence_kind: test_stdout · guarded: false · exit_code: 0
- command: `cd frontend && npx vitest run`
- evidence: Looked for an executed render of VoiceRecordingBar and found none. The suite is 5 files / 98 tests, all pure helpers: toothSelectionGroups, prosthesisTree, voiceReviewRows, voiceLine, voiceApply. vitest.config.ts: include ['src/**/*.spec.ts'], no environment set. The only trace of the criterion is the JSX `{voiceEnabled ? <VoiceRecordingBar voice={voice} /> : null}` in the diff.
- log: `/Users/aminmsvi/PersonalProjects/dyolink/.git/orchestrate/logs/0024-test.log`
**AC12** — Stopping the lab recording posts the clip to POST /voice/extract.
- result: FAIL · evidence_kind: test_stdout · guarded: false · exit_code: 0
- command: `cd frontend && npx vitest run; grep -n 'voice/extract' frontend/src/lib/api/voice.ts`
- evidence: Looked for an executed check of the stop-to-POST path and found none. Static chain only: CaseCreatePanel wires `onClick={isRecording ? voice.onStop : voice.onStart}` to useVoiceCapture, and frontend/src/lib/api/voice.ts:26 does `apiClient.post('/voice/extract', payload, ...)`. No test, no browser run, no server request observed (API not running, curl exit 7).
- log: `/Users/aminmsvi/PersonalProjects/dyolink/.git/orchestrate/logs/0024-test.log`
**AC28** — After confirming the sheet, the debounced autosave persists the case, so reloading it shows the dictated line.
- result: FAIL · evidence_kind: test_stdout · guarded: false · exit_code: 7
- command: `cd frontend && npx vitest run ; curl --max-time 3 http://localhost:3000/api/voice/availability`
- evidence: Looked for an executed persistence check and found none. No frontend component or integration test exists; the backend suite (18 suites, 230 tests) holds no case-autosave-from-voice test; the API is not running (curl exit 7, HTTP code 000), so no live query could confirm a reload. The 500 ms autosave effect is only visible as source at CaseCreatePanel.tsx:247-252.
- log: (none)
**AC32** — Starting a case built by dictation generates tasks whose groups match the lines.
- result: FAIL · evidence_kind: test_stdout · guarded: false · exit_code: 0
- command: `cd backend && npm test`
- evidence: Looked for an executed start-case / task-generation check driven by a dictated line and found none. The backend suite passes 230 tests in 18 suites, but no ledger entry and no suite exercises LabCase start with a voice-built line; the API and database are not running, so no live query could observe the generated task groups.
- log: `/Users/aminmsvi/PersonalProjects/dyolink/.git/orchestrate/logs/0022-test.log`
### Unexecuted cells
None.
### Stale evidence
- ledger 0001-0008 (ts 1789505529-1789505699, cells C01-C04, `npm test -- voice.service.spec -t C0x`) ran BEFORE the last edit of backend/src/modules/voice/voice.service.ts, voice.service.spec.ts and narrowCatalogForOrgType.spec.ts (mtime 1789505987). Superseded by fresh entries 0018-0021 (ts 1789506102-1789506123).
- ledger 0012 (ts 1789505763, `npx eslint src/modules/voice/...`, exit 1) is stale and superseded by 0027 (ts 1789506206, exit 0).
- ledger 0013 (ts 1789505784, cell C03, `npx vitest run`), 0014 (ts 1789505792, cell C01, `npx tsc --noEmit`), 0017 (ts 1789505820, cell C03, `npm run build`) are stale and mis-tagged: whole-suite frontend commands carrying single cell ids that do not describe them. Superseded by untagged fresh runs 0024, 0025, 0030.
### git_status
(empty)
### Why
The earlier gates passed on what agents said about their own work. This one passed nothing.
## 2026-09-16 — the blank-line bug, and the lint gate left red
### Fixed: a dictation that built no line still appended one
The `/orchestrate` correctness critic refuted, and the finding held up when checked by hand.
`applyVoice` tested `isBlankLine` on the **target** line but never on the line it had just
**built**. A dictation carrying no line content — a due date alone, or one whose codes were all
refused — returned a blank `newLine()`, fell past the blank-target branch and was appended, made
active, and autosaved. `start` only requires that *some* line carries jobs
(`cases.service.ts:549`), so the empty line shipped to the floor. That is what decision 9 exists
to prevent; decision 9 only ever covered *filling* a blank target, not *appending* one.
The spec's own §10 manual step 7 triggers it: dictate «تا پنجشنبه» with line 1 already filled.
Fixed in the pure layer rather than guarded in the component: `buildLabLineFromVoice` returns
`line: null` when the line is blank, so a test can hold the rule. The due date still lands, since
it belongs to the case header. Six tests that asserted an empty line now assert null, one new test
covers a due date riding along with real work, and reverting the guard fails five of them.
Commit `c881fdf`.
### Left red: the repo-wide lint gate
| Command | Exit | On `origin/master` |
|---|---|---|
| `npx eslint "{src,apps,libs,test}/**/*.ts"` (backend) | 1 — 1285 errors, 95 warnings | identical, byte for byte |
| `npm run lint` (frontend) | 1 | identical |
**No error is in a file this branch touched.** Verified by running both commands against
`origin/master` in a throwaway worktree.
- **Backend:** 1109 of the 1285 are auto-fixable; **176 survive `--fix`**, across 25 files, 74 of
them in `auth/` — mostly `no-unsafe-member-access` on what looks like an untyped `req.user`.
The repo's own pinned script already carries `--fix`, so even that exits 1.
- **Frontend:** `npm run lint` runs `next lint`, which Next 16 removed, so it reads `lint` as a
directory and has never linted anything. Repointing it at `eslint` surfaces 22 errors: 10
`react-hooks/set-state-in-effect` in `useAuth`, `RealtimeProvider`, `ToastProvider`,
`ThemeToggle`, `AppDateInput` and the badge hooks; 7 `no-explicit-any` in the auth layer; 3
`static-components`; 2 trivial.
**This repo has never had a green lint gate on either side**, and `.gitea/workflows/*` runs no
lint step, so nothing ever reported it. `/orchestrate` is the first thing to run it.
Amin's call, 2026-09-16: **leave it.** The repair means restructuring effects in authentication,
realtime and toast providers, and the frontend has no component tests to catch a regression — a
broken `useAuth` effect would first be noticed by a human unable to sign in. It is its own task,
on its own branch, done attended.
Consequence to expect: `test-exit-guard.mjs --stop` blocks on this ledger, and every future
`/orchestrate` in this repo inherits the same red, until that task is done.
### State
Branch `feat/cases/add-voice-input-for-lab-case-line` at `c881fdf`, **not pushed**.
Green: backend 230 tests / 18 suites, `nest build`; frontend 99 tests, `tsc --noEmit`,
`next build`; eslint clean on each of the 13 touched files.
Red: the two repo-wide lint commands above.
Outstanding: §10 manual pass, and the verifier's 4 FAILs / 8 unguarded criteria, which need
either component tests or a running API — see the Verify entry above.