Repository navigation
Realize add-doxbench-editing-phase-a: Editor/Preview canvas, one Save/Cancel, chat-on-active-buffer - #196
Conversation
…/Cancel, chat-on-active-buffer Brett's model in one sentence — left selects, centre chat works, right shows the result — landed on the EXISTING two-buffer machinery, with the invariant Phase B will re-cut left explicitly intact. The canvas (`doxbench-editor.js`) - The buffer tablist is retired as a rendered control. `DOXBENCH_BUFFER_TABS` becomes `DOXBENCH_BUFFER_LABELS`: a label lookup keyed on `BUFFER_KINDS`, feeding accessible names, claiming nothing about being clickable. - `DOXBENCH_VIEW_TABS` (`Editor`, `Preview`) replaces the side-by-side textarea+preview split. `Preview` is selected at mount; switching INTO it calls the existing `flushOne` before the pane is shown, so a switch never displays a rendering the debounce had not applied. One rendering path, one debounce, one `mountSafeMarkdown` sink — no new raw-markup sink anywhere. - The panel carries ONE Save and ONE Cancel, in chrome outside both view tabs. Save is the same zero-argument `save()` it always was (the dirty set over `BUFFER_KINDS`, one call to the seam, `SAVE_BUFFER_ORDER` untouched in `doxbench-save.js`, `adoptSavedBase` still the only way a base advances) — it was already whole-canvas and merely drawn twice. Cancel is `discardBuffer` aimed at the ACTIVE buffer and no other, and it names the buffer it reverted. - Both buffers keep their own status region, both on screen at once, so the partial-success case stays separately readable with one button. - FR-010's focus/selection/scroll persistence now keys on the combined predicate (active buffer AND `Editor` selected), so it survives both the buffer switch and the view switch. The CHK007 APG tablist pattern moved across unchanged. Selection (`staging-workbench.js`) - Focusing the context region's `outline` selection tab sets the active buffer through the canvas's own `setActiveBuffer`; a scoped docs-wheel row routes through the canvas's existing `selectDocument`, so the dirty-Document guard and the scope refusal fire identically on both routes. The wheel's mount-time seed is deliberately not forwarded — a render is not a human choosing. - The canvas document picker stays (design D3) and moved into the chrome, so it is reachable from either view. Its refusal sentence moved INTO `selectDocument`, giving both routes one refusal vocabulary. Chat (`doxbench-chat.js`, `doxbench_turns.py`) - The rail's header states the buffer it is WORKING ON, read live off `state.active_buffer` — no second context-tracking mechanism. Grounding is unchanged and still carries both buffers. - `BufferBinding` + `resolve_turn_binding` record which buffer a turn was bound to on `PromptEnvelope.bound_buffer` (path, or kind where there is none yet). Additive; `revalidate_scope`, `require_outline_and_document` and `PROPOSAL_TARGETS` are untouched, and no wire schema changed. Naming (`viewer.js`) - `✎ edit` becomes `✎ open in editor`: it never edited anything in-app, and Phase B will put a third claimant on the word. Behaviour unchanged. Tests re-pinned honestly, never deleted — every moved assertion carries the reason in the test itself. New coverage: the mount posture (two view tabs, Preview selected, one tablist, one Save, one Cancel), the flush-on-switch, the two selection routes, Cancel's scope + its identity notification, a panel Save against a moved identity driven through the rendered button, and the no-force/no-bypass rule. No contract release: no schema change, no new artifact kind, no new gate verb. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
There was a problem hiding this comment.
Pull request overview
This PR realizes the add-doxbench-editing-phase-a change by re-shaping the doxBench authoring canvas around view tabs (Editor/Preview) over the active buffer, consolidating controls to one Save / one Cancel, and wiring context-region selection + chat binding to state.active_buffer, with tests updated to pin the new invariants.
Changes:
- Replace the retired buffer-tab control with an
Editor/PreviewARIA tablist, showing only the active buffer and flushing preview on switch intoPreview. - Consolidate canvas controls to one
Save(whole-canvas) and oneCancel(active-buffer discard), moving shared status/control chrome outside view panes. - Bind context selection (outline tab focus + docs wheel selection) to the canvas active buffer, and record per-turn buffer binding server-side.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/ideation-dashboard/test_staging_workbench.py | Pins that context selection routes drive the canvas active buffer without adding transport. |
| tests/ideation-dashboard/test_explorer_viewer.py | Updates external-editor button label expectations (“✎ open in editor”). |
| tests/ideation-dashboard/test_doxbench_view.py | Re-pins doxBench canvas tests to view tabs, single Save/Cancel, selection-driven active buffer, and flush-on-preview-switch. |
| tests/ideation-dashboard/test_doxbench_turns.py | Adds tests for per-turn bound-buffer recording without narrowing grounding. |
| tests/ideation-dashboard/test_doxbench_state.py | Clarifies/pins the “exactly two buffers” invariant at the state contract boundary. |
| tests/ideation-dashboard/test_doxbench_mutation_boundary.py | Extends mutation-boundary proof to cover view switching in addition to buffer switching. |
| tests/ideation-dashboard/test_doxbench_accessibility.py | Re-points APG roving-tabindex pins to the view tablist and asserts the buffer tablist is not rendered. |
| scripts/ideation_dashboard/web/views/viewer.js | Relabels “✎ edit” to “✎ open in editor” to avoid ambiguity with in-app editing. |
| scripts/ideation_dashboard/web/views/staging-workbench.js | Routes outline/docs selection to canvas controller primitives; factors rail refresh into a named callback. |
| scripts/ideation_dashboard/web/views/doxbench-editor.js | Implements view-tab canvas, chrome controls, active-buffer selection API, and Cancel/Safe preview switching behavior. |
| scripts/ideation_dashboard/web/views/doxbench-chat.js | Updates rail header to state the currently bound active buffer. |
| scripts/ideation_dashboard/web/styles.css | Renames/repurposes styling from buffer tabs/toolbars to view tabs/chrome. |
| scripts/ideation_dashboard/doxbench_turns.py | Adds BufferBinding + bound_buffer to PromptEnvelope and derives binding from declared active document path. |
| README.md | Records Phase A realization in the active changes list. |
| openspec/changes/add-doxbench-editing-phase-a/tasks.md | Marks Phase A tasks complete and updates checklists accordingly. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (saveSeam) { | ||
| // With a governed Save wired, Discard restores the last SAVED text, so it | ||
| // With a governed Save wired, Cancel restores the last SAVED text, so it | ||
| // stays available on a clean buffer (a no-op there, and a control that | ||
| // flickered between postures mid-Save would be worse). Only an in-flight | ||
| // Save takes it away. Without a seam this is untouched: a clean buffer has | ||
| // nothing to restore, so Discard is disabled exactly as before. | ||
| statusEls[kind].setAttribute("aria-busy", savingKinds.has(kind) ? "true" : "false"); | ||
| saveButtons[kind].disabled = saving; | ||
| saveButtons[kind].setAttribute("aria-disabled", saving ? "true" : "false"); | ||
| discardButtons[kind].disabled = saving; | ||
| // nothing to restore, so Cancel is disabled exactly as Discard was. | ||
| saveBtn.disabled = saving; | ||
| saveBtn.setAttribute("aria-disabled", saving ? "true" : "false"); | ||
| cancelBtn.disabled = saving; | ||
| guardSaveBtn.disabled = saving; | ||
| guardDiscardBtn.disabled = saving; | ||
| guardCancelBtn.disabled = saving; | ||
| } else { | ||
| discardButtons[kind].disabled = !buffer.dirty; | ||
| cancelBtn.disabled = !state.buffers[activeBuffer].dirty; | ||
| } |
selection surfaces reconcile F1 (BLOCKING) — declining a document switch moved the chat binding. `focusBufferEditor` called `setActiveBuffer`, so the guard's Cancel — the "no, leave it alone" choice — bound the chat to the document and PERSISTED it: a human on the outline came back working on material they never chose. Focus return no longer re-binds; it selects the Editor view and focuses the buffer that is actually on screen. Where a switch really happened, `switchDocument` has already bound, so nothing is lost. F3 — the `unchanged` selection route left the stated binding stale. `bindCanvasToDocument` now refreshes the rail on EVERY outcome (its sibling already did), so the header stops naming the outline beside a chat bound to the document. The mount-time half too: the rail's header names buffers the canvas does not have until its load settles, so the composition refreshes once `ready` resolves instead of rendering "(absent)" until something unrelated happened. F4 — the wheel, the picker and the canvas could sit on three documents. `doc-wheel.js`'s `selectPath` — written for exactly this and with zero callers — now has one: a selection that does not land reconciles the wheel to the document the canvas really holds, the same revert the picker has always done for itself, and a redraw starts the fresh wheel where the canvas is. The reconcile is suppressed from binding, because it is the canvas answering, not a human choosing. F5 (a11y, WCAG 2.1.1) — `Preview` is where a mount lands and its content has nothing focusable, so a keyboard-only human could reach the panel and not scroll it. Both view tabpanels are tabbable. F6 — an oversized or undecodable document rejected inside the switch, reached through handlers that drop the promise: nothing said, control left showing a document that never loaded. Contained in `switchDocument` into the same stated refusal every other selection failure speaks, which fixes both routes at once. F7 — the remembered caret/scroll belonged to the document that left. Dropped with the buffer it described. F8 — `SAVE_WIRED_NOTE` derived its ORDER clause from `BUFFER_KINDS`, which is the buffer SET; the order is `SAVE_BUFFER_ORDER`'s, in a module this one deliberately does not import. The note names the authority instead of restating its content. Test nit — `guardChoices` was measured and never asserted; it is now the pin that stops a lost panel control hiding behind the guard's vocabulary. New coverage: declining the guard does not move the binding (with the persisted record checked, and the discard arm's contrapositive); a live shell mount for the two selection routes — the rail header had NO test at all — and for wheel/picker/canvas agreement through a blocked-then-declined switch; the view tabpanels' focusability; the contained load failure on both routes; and the dropped stale view. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…hase B and
remove the unreadable placeholder
The review's F2 asked where the turn's binding record lives. Brett ruled Option
A — defer with an explicit carve-out — so the attempt comes out and the
obligation is written down where the work that can discharge it is planned.
REMOVED. `doxbench_turns.py` is byte-identical to main again: `BufferBinding`,
`resolve_turn_binding` and `PromptEnvelope.bound_buffer` are gone, with their
four tests. `revalidate_scope`, `require_outline_and_document` and
`PROPOSAL_TARGETS` were never touched and still are not. Two reasons the field
could not stand: nothing serializes, persists or renders it, so no human ever
reads the record it was meant to improve; and the wire carries only the
document path, never which buffer the human selected, so an outline-bound turn
was recorded as document-bound. Dead code that is also wrong is worse than an
honest gap.
WHY IT CANNOT BE PHASE A's. `xfactory-workbench-chat-turn.schema.yaml` closes
the request AND the success envelope (`additionalProperties: false`, fixed
`required`), so a turn record a reader can actually consult cannot carry the
name without a chat-turn contract release — which this change forbids
(`target_release: none`, re-verified by task 9.3).
RECORDED, not silently dropped:
* design.md gains "Turn-record naming — deferred (F2 carve-out, Brett
2026-08-15)" — the closed wire, the two defects the review found, and where
the obligation goes; the chat-binding rule's clause 5 now states what Phase
A does ship (the live binding on the rail) and points at it.
* The spec delta's chat-binding requirement states the deferral IN THE
REQUIREMENT, so a reader of the promoted spec sees an obligation rather
than a gap, and its scenario is rewritten from "a turn record is read
later" to "a turn record is asked to name its bound buffer" — which refuses
the claim AND refuses a server-side-only field standing in for an answer.
* tasks.md 5.3 is marked `[~] DEFERRED` with the reasoning rather than
falsely ticked.
* proposal.md's code_surface, What Changes item 4 and Impact stop claiming
`doxbench_turns.py`; README's realization note says the same.
* ideation/staging/INDEX.md records that Phase B inherits the obligation —
it re-cuts the turn machinery and releases that contract anyway, so the
naming rides that release.
What Phase A ships for Q4 is unchanged and unaffected: the chat's working
context IS `state.active_buffer`, the switch is immediate with no confirm step,
the binding is STATED live above the transcript (and now tested), and the
existing active-path revalidation still refuses a mismatched binding before any
provider call.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
PR #196 stopped being mergeable when main moved 19 commits (~180 files) ahead of this branch's base: add-staged-topic-outline-template ratified with its material moved into its proposal and its Q4 verb amended to `edit-document`; doc-health gained the `staged-topic-template` nudge family; add-client-identity-roster realized+archived at contract-v1.33; add-subject-overlay-contract archived at contract-v1.32. A rebase produced the identical tree but the branch ruleset forbids force-pushing `change/*`, so the same resolution lands as a merge. ONE conflict, in README.md's "OpenSpec Records" active block, and it is textual rather than semantic: main REMOVED the `add-client-identity-roster` entry (it archived), while this branch APPENDED the realization note to the `add-doxbench-editing-phase-a` entry immediately above it. Both intents kept — the archived entry stays gone, the realization note stays. `ideation/staging/INDEX.md` auto-merged: main appended to the `staged-topic-outline-template` topic, this branch appended the Phase B turn-record obligation to `doxbench-editing-model`. Both survive. NO semantic collision with the outline-template work. Its section model is a new standalone pure module (`web/views/outline-model.js`) with its own node harness; it touches none of this branch's files. Its only edit to a shared file is a comment block on `wheel-model.js`'s `primaryFragmentPath` recording that the selector is deliberately NOT extended — behaviour unchanged, and this branch's docs-wheel wiring reads `entry.path` from `docWheelEntries`, which is unaffected. The Q4 amendment (`edit-apply` -> `edit-document` for section patching) does not rename either gate verb, so this change's task 7.3 — both are MACHINE KEYS and are NOT renamed — stays true as written. Gates re-run against the NEW base, all green: doc-health 80 findings on a clean 642dd64 worktree and 80 on this branch, ZERO new (the new `staged-topic-template` family's 29 nudges fire identically on clean main); pytest tests/ideation-dashboard 2882 passed / 6 skipped, including the new test_outline_model.py; openspec validate --all --strict 60 passed / 0 failed; validate-ideation-dashboard-contracts 0 errors / 0 warnings. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.
Suppressed comments (1)
scripts/ideation_dashboard/web/views/doxbench-editor.js:1486
switchDocument()persists state twice:setActiveBuffer("document")already callspersistNow(), and thenswitchDocument()callspersistNow()again after only DOM updates. This causes redundant storage writes on every document switch.
setActiveBuffer("document");
syncBufferDom("document");
renderPreviewNow("document");
persistNow();
…Save/Cancel (#199) with the view tabs Brett used the live Phase A canvas and left two annotations on it. ANNOTATION 1, on `div.doxbench-chrome`: "we do not need this section now that the left panel will let us select the active document. remove this but place the save and cancel in line with the tabs." * The canvas document picker is RETIRED. Phase A design D3 kept it because its dirty-buffer guard was load-bearing — and it was, until the PR #196 review moved that guard, the refusal sentence and the wheel reconcile INTO `selectDocument` (F4/F6). That is what made the control removable without losing a rule, and it is why the two changes had to happen in this order. The context region's docs wheel is now the sole human selection route, which is what "left selects" always meant. * G-1's outline-only posture used to be stated twice, on the picker's label and in the Document buffer's status. The status keeps it: it is a fact about the BUFFER, not about a control. * Save and Cancel move into the view-tab ROW, in their own group inside the row but OUTSIDE the `role=tablist` element (a button inside a tablist is announced as a tab and joins the roving-tabindex cycle). The ratified "one Save and one Cancel ... outside both view tabs so that each control and its answer are on screen whichever view the human is standing on" is satisfied literally by that placement, so no spec text changed for it. * THE PER-BUFFER VERDICT SURFACE SURVIVES, in a compact status row under the tab row: both regions, still `aria-live`, still per buffer — partial saves and stated refusals are load-bearing. One change: each line now NAMES its buffer visibly. Stacked unlabelled in the old chrome they rendered as "no unsaved changesno unsaved changes" (visible in the annotated screenshot): two identical sentences a reader could not attribute, which is exactly the case a partial Save has to report. ANNOTATION 2, on `h2.doxbench-heading`: "why do we need this line? i do not see what it is adding to our UI." * Nothing an assistive technology did not already get. A `role=region` is announced by its accessible name on entry, and the h2 rendered that same string again, visibly, costing a row of a narrow panel. The heading goes; the region keeps its `aria-label`, which is the house idiom rather than a new one — `swb-context` and `doxbench-rail` have always been named exactly that way, with no heading. A visually-hidden h2 was considered and rejected for the same reason: inside a region that already has a name it is simply announced twice. ONE COLLISION WITH RATIFIED TEXT, AMENDED RATHER THAN IGNORED. `doxBench surface identity`'s scenario read "its visible heading and accessible surface name MUST use the exact name `doxBench`", and this canvas's heading was the surface's only visible statement of it. The change delta carries that requirement as MODIFIED, directed by Brett's 2026-08-15 annotation round: the name is required wherever the surface names itself and in the ACCESSIBLE name; a region already carrying it need not restate it visibly; any heading that IS rendered must still use the exact casing; and the accessible name may never be dropped in exchange. A new scenario states that last clause so the removal cannot be read as permission to leave a region unnamed. Tests re-pinned honestly, each with its reason in the test: the picker-route scenarios now drive `selectDocument` (where the rules moved) and assert the control is genuinely absent; the loading/failed-load posture is measured on the two controls that remain; the second promise-dropping caller in the F6 probe is now the guard's discard arm; the outline-only posture is read from the buffer's own status; the region-name test asserts the accessible name and that no heading restates it; and the styles pin flips from "the picker label lays out as a row" to "a retired control leaves no orphan rules behind". Gates: pytest tests/ideation-dashboard 2885 passed / 6 skipped; openspec validate --all --strict 60 passed / 0 failed; doc-health 82 findings on a clean 6ac42ed worktree and 82 on this branch, zero NEW; validate-ideation-dashboard-contracts 0 errors / 0 warnings. Co-authored-by: brettheap <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
The adversarial review of the outline tab came back FIX FIRST. The core held — EOL end-to-end, fence-aware anchoring, the click-time race, the gate-off no-listener posture, the 3.5 invariant — and five confirmed findings did not. Fixed here as review-fix commits (PR #196's precedent), never an amend. F1 — A TEST-COVERAGE REGRESSION THIS SLICE INTRODUCED, and the worst of the five because it silently removed a guard. Widening `renderOutlinePanel`'s signature made the loosened substring pin in `test_session_confinement.py` a prefix of the DECLARATION as well as the call, so it stopped constraining the call site at all: the reviewer replaced `sourceBase` with `null` at the call and the whole suite stayed green — re-opening PR #49's finding 16, "a draft view mistaken for main", which is the entire reason that test exists. The pin is now a regex that must run through the call's own closing arguments, which no declaration can supply. The mutation was re-run against the final tree: exit 1, `test_the_outline_pane_reads_through_the_active_keys_source_base` fails. F2 — THE CONTRACT'S EXTENSION GRANT WAS UNUSABLE. `insertSection` applied a rank-wide duplicate rule on BOTH routes, and `sectionRank` matches by substring. On a fully templated fragment that refused "Exit criteria", "Why we deferred", "Impact analysis", "Claims log", "Prior art on why", "Conflicts with promoted specs" and "Open questions for Brett" — each naming a section the human never asked for, and an explicit `after=` target could not get round it because the refusal fired before the anchor was read. The same loose match silently canonicalized the near misses: "Notes on conflicts" was written as `## Conflicts` with the conflict-bullet seed and the typed heading was simply gone. Since the free-form control is the ONLY route to "either a human or an AI may add a section beyond the required set", the ratified grant was unreachable in practice — and it got worse the more conformant a topic became. The two routes are now separated by an explicit `required` flag rather than by guessing from the string. The gap row sets it and keeps both loose behaviours, where they are doing necessary work: it asks by the contract's LABEL, so it must resolve to the canonical heading and seed, and it must refuse a required section already present under the skeleton's longer spelling. Everything else is exact — exact-title duplicates, the human's heading verbatim, the generic skeleton, and canonical placement only for a title that already IS a canonical heading letter for letter. One `resolveTemplate` answers "which route" for both callers, so the rank and the heading cannot disagree. F3 — A W-10 REGRESSION. The refusal branch echoed the seam's `error` text, which both other consumers of `applyProposal` explicitly forbid: doxbench-chat.js calls its mapping a WHITELIST and drops the seam text unread, and the canvas states its sentences "remain the canvas's and are never echoed". The consequence was real, not theoretical — the settling window is reachable by pressing add inside a keystroke's hash flight, and the human got "the buffer identity is still settling" with no way out of it, while the stale sentence said "proposal", a noun this tab never uses. `outcome.code` now maps to four fixed tab-voiced sentences, each naming its own recovery, and the seam's own two refusals gained codes so they map accurately instead of falling through to the generic one. F4 — THE DUPLICATE GUARD FAILED EXACTLY WHEN IT WAS NEEDED. On a fragment ending inside an unclosed fence the insert appended INSIDE the fence, the model then saw no sections at all, "already carries" could never fire, and repeated presses piled up copies — each reporting success. `insertSection` refuses on an unclosed fence now, through the same `isFence` rule `outlineSections` toggles on (one fact that loop already knows and did not report, not a second scanner). REFUSAL, NOT REPAIR: closing the fence would rewrite a fragment nobody asked us to change, which task 3.3 forbids outright. F5 — `"Added-by: brett · 20"` passed on a literal "20". The date half is a `\d{4}-\d{2}-\d{2}` match, which also survived the UTC rollover mid-session that a hardcoded date would not have. H1 — the `onText` invocation is CONTAINED. Callers do not await `renderViewer`, so a throw inside a caller's derivation was a silent unhandled rejection, and it happened after the document had already rendered. The honest degraded outcome is a missing index and nothing said on the page: a message about a caller's bug would libel the document. Proven by removing the guard and watching the promise reject. H2 — the index header says "as stored". It describes the SAVED fragment while the canvas holds unsaved work, so after an add a gap row above ("no pre-document idea notes section") sits over a refusal below ("this outline already carries…") — two honest answers about two different texts, which without the label reads as one surface arguing with itself. The two-renderings split itself is deliberate and stays. EVERY NEW REGRESSION TEST WAS VALIDATED AGAINST THE PRE-FIX CODE rather than assumed, by running the previous commit's `insertSection` over each fixture. That is what caught the one place the first draft of these tests was worthless: F2's seven headings only misbehave on a FULLY templated fragment, so the original three-section fixture would have passed before and after and proven nothing. The fixture is now the whole ratified skeleton, with a test asserting it really is conforming — if it drifts, the seven cases stop testing anything. The unclosed fence, the settling window (driven through a holdable hash seam, including that its advice is TRUE: the same press lands once the identity settles) and the throwing `onText` were each verified the same way. 72 cases across the two files, up from 40. Gates, exit codes read directly: `pytest tests/ideation-dashboard -q` 3131 passed, 6 skipped, exit 0; `openspec validate --strict` exit 0 and `--all --strict` exit 0 (61/61); doc-health single-repo exit 0, and its report identical to the pre-change baseline once the UTC date rollover and the aging counters it moves are normalized — 0 new findings. `tests/doc-health` still carries the same 4 pre-existing `test_client_identity_composition.py` failures reproduced at a4a6f6e with this work stashed. Co-Authored-By: Claude Opus <[email protected]>
… record realization evidence (#228) * Phase A task 9.1: record the realization evidence at the archive gate Derived from git log over the change directory, not from recollection: the realization is PR #196 / 6ac42ed plus this change's own annotation round at #199 / 224bf22 and #201 / 96975c1. PR #207 realized Phase B's core and touched no file here — named in the block only to say so. Green at landing: this change's own five pinned files 487 passed exit 0; tests/ideation-dashboard 3699 passed / 15 skipped. The block also states what Phase B has since done to the surface, so the archived spec is not read as current two-buffer truth. Co-Authored-By: Claude Fable 5 <[email protected]> * proposal-support: archive a change that has no supporting documents The promoted rule scopes packaging to a change WITH supporting documents, and verify() already reads it that way on both sides — but archive_change called package() unconditionally, so a staged-origin change that legitimately never took its topic with it could not archive through the sanctioned path at all. Fifteen archived staged-origin changes already have that shape, so the wrapper was the only thing that could not produce it, which is precisely what pushes an operator toward a bare 'openspec archive' and around the gate. Found archiving add-doxbench-editing-phase-a, whose task 9.2 deliberately kept the topic staged for Phase B. --final-import-complete with no bundle is now refused rather than silently ignored. Co-Authored-By: Claude Fable 5 <[email protected]> * Land doxbench Phase B wave 2: archive Phase A, exit the staged topic, record realization evidence Phase A archived via proposal-support as 2026-08-21-add-doxbench-editing-phase-a (+5 ADDED, ~2 MODIFIED promoted). 13.7 verified against the promoted text, not assumed: the three Phase-A-relative names are present to amend, and the promoted F2 deferral sentence is the one Phase B's MODIFIED block replaces — the hazard was real. 13.6 exits the staged topic into Phase B's supporting-docs with the origin byte-identical, and dispositions the two parked items (Headroom's five gates, the graph graduation trigger) to live code that refuses adoption. 13.8 records the evidence and stays OPEN: the gate is written over the whole code surface and share-session is not built. §12 adjudication recorded against 12.6 — Phase B stays ACTIVE, NOT archived; the call between realizing §12 and carving it out is Brett's. Co-Authored-By: Claude Fable 5 <[email protected]> * Repoint the two references to Phase A's now-archived path The README's active-block entry linked a directory that no longer exists; it now points at the archive, records the realization evidence and the discharged F2 obligation, and drops the 'archive gate still needs 9.1' sentence that has stopped being true. add-staged-topic-outline-template's cross-change citation is repointed too — the finding it cites is unchanged, only its location is. Co-Authored-By: Claude Fable 5 <[email protected]> * Review round: correct the precedent count, align the predicate, make the F4 test bite F1 the comment said fifteen; sixteen archived staged-origin changes had the bundle-less shape before this one, and fifteen is the count of the complement. Corrected, with the recount method stated so it cannot be miscounted again. F3 .exists() rather than .is_dir(), so this predicate is the same one verify() applies and the two readers cannot disagree. F4 the final-import-complete test asserted a bare SupportError, which the PRE-fix path also raised — tightened to assertRaisesRegex on the message. Co-Authored-By: Claude Fable 5 <[email protected]> * F5 the full open ledger for Brett; F2/F3 recorded as a follow-up item F5 the recorded exit note named §12 alone, which would have put a partial ledger in front of the ruling. Nine tasks are open across three families — 10.7 and 11.7 each need a contract release, 12.1-12.6 need a realization slice, 13.8 follows whichever lands last — so carving §12 out narrows the blocking set from three families to two rather than clearing it. F2/F3 recorded in docs/support-bundle-scope-open-item.md and linked in the README doc index: the staged-origin scenario reads more absolutely than the requirement it illustrates (the fix is a spec-text change, not authorized here), and the deleted-supporting-docs surface stays open with its predicate half already closed. Status is 'record' per the controlled taxonomy — the open-item doc I modelled it on uses a free-form status that doc-health flags. Co-Authored-By: Claude Fable 5 <[email protected]> * Reconcile the outline-template's 5.3 enumeration and 6.3 path with the doxbench topic exit The merge of origin/main brought add-staged-topic-outline-template's gate records onto the same branch that exits doxbench-editing-model from staging, so two of its recorded claims now describe a corpus that moved under them. Neither is wrong; both would rot silently if left alone. 6.3 cited the handoff note at its staging path. The note is unchanged and still present -- it rode with the fragment into Phase B's support bundle, so the citation is repointed and the reasoning noted as strengthened, not weakened: the note existed so "Phase B inherits it" and now sits inside Phase B. 5.3's sha-pinned enumeration is unaffected in substance: doxbench-editing-model is not one of its 29 findings (it carries both required headings), and a doc-health run on the merged tree is byte-identical to its base at the new main tip -- 3/8/76/3, new findings [], empty finding-by-finding diff. What moved is the corpus size, so the real post-exit figures are recorded for the next re-run rather than leaving the pin to be discovered stale. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: brettheap <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
Realizes the ratified change
add-doxbench-editing-phase-a(proposal merged tomainat119d94f). Brett's model in one sentence — left selects, centrechat works, right shows the result — landed on the EXISTING two-buffer
machinery, with the invariant Phase B will re-cut left explicitly intact and
asserted.
Slice by slice
1. The canvas: view tabs replace the split (
doxbench-editor.js, tasks 2.1–2.6)DOXBENCH_VIEW_TABS = [{editor, Editor}, {preview, Preview}], rendered asONE ARIA tablist over the ACTIVE buffer,
Previewselected at mount. TheCHK007 APG discipline — roving tabindex, Arrow/Home/End,
aria-selectedasthe only spelling of selection, arrows consumed — moved across unchanged.
DOXBENCH_BUFFER_TABSbecomes
DOXBENCH_BUFFER_LABELS, a label lookup keyed onBUFFER_KINDSwitha self-naming fallback; it feeds accessible names and claims nothing about
being clickable.
BUFFER_KINDSindoxbench-state.jsis untouched.editarea.append(textarea, preview). Eachbuffer's textarea and preview container are still built ONCE at mount and
mutated afterwards through
textContent/.value/ attributes /classList;the preview container remains the sole exception and is still written only
through
mountSafeMarkdown. No new raw-markup sink.previewcalls the existingflushOnefor the active bufferbefore the pane is shown; switching into
editordoes not flush.schedulePreview/renderPreviewNow/previewDelayMsare reused as-is.predicate (this buffer is active AND
Editoris selected), so it survivesboth the buffer switch and the view switch. A hidden pane still never holds
focus; a pane that never held focus still never steals it.
state.active_buffer.Satisfies: "The doxBench canvas presents Editor and Preview view tabs" (all
four scenarios); the MODIFIED
doxBench scoped view's one-buffer clause andits no-second-tablist clause.
2. Selection moves to the context region (
staging-workbench.js, tasks 3.1–3.4)outlineselection tab sets the active bufferthrough the canvas's own
setActiveBuffer(both the pointer and the keyboardhandler bind, so they agree).
selectDocumentand now also makes the
documentbuffer active. The dirty-Document guard andthe scope refusal fire on this route exactly as on the picker's. The wheel's
own mount-time seed is deliberately not forwarded — a render is not a
human choosing a document, and forwarding it would pop the guard on a switch
nobody asked for.
so it is reachable from either view. Its refusal sentence moved INTO
selectDocument, so both routes share one refusal vocabulary and one guard.the source: two renderings of "the outline" survive on purpose.
Satisfies: "A document becomes active", "The outline selection tab becomes
the working context".
3. One Save, one Cancel (
doxbench-editor.js, tasks 4.1–4.7)save(): the dirty set overBUFFER_KINDS,one call to the seam,
SAVE_BUFFER_ORDERuntouched indoxbench-save.js,adoptSavedBasestill the only way a base advances, the session rekeyunchanged. No Save semantics changed — only the button count.
are both on screen, so a partial success stays separately readable with one
button.
discardBufferon the ACTIVE buffer only, throughreplaceBuffer, and names the buffer it reverted. It emits the sameonIdentitySettlednotification the guard's Discard does.aria-busy, bothcontrols withdrawn,
SAVE_BUSY_REASON,EDIT_DURING_SAVE_REASON,SAVE_UNAVAILABLE_REASONas visible text beside the control).Satisfies: "One Save and one Cancel govern the doxBench canvas" (all five
scenarios).
4. Chat binding and turn attribution (
doxbench-chat.js,doxbench_turns.py, tasks 5.1–5.5)state.active_bufferthrough theeditorStateseam it already had — nosecond context-tracking mechanism. The switch is immediate, with no confirm
step; the unsaved-edit guard on a different-DOCUMENT switch is untouched.
BufferBinding+resolve_turn_bindingrecord which buffer a turn was boundto on
PromptEnvelope.bound_buffer— repository-relative path, or buffer kindwhere the buffer has no path yet. Additive;
revalidate_scope's active-pathcheck,
require_outline_and_documentandPROPOSAL_TARGETSare unchanged,and the turn still carries BOTH buffers as grounding.
Satisfies: "The doxBench chat binds to the active buffer selection" (all five
scenarios) — see the flagged item below on where the per-turn record lives.
5. Staleness, unchanged and proven still there (tasks 6.1–6.3)
The per-buffer hash-generation guard is untouched. A new test drives the
RENDERED panel Save against a seam that refuses one buffer for a moved base and
proves the refused buffer keeps its text, base and dirty flag exactly while the
other still lands; a second proves neither control gained a force path, a
bypass, or a second write route (behaviourally and at the source).
6. Naming (tasks 7.1–7.3)
SELECTION tab (context region) / VIEW tab (
Editor/Preview) / BUFFER, inprose, code and accessible names. New class prefix
doxbench-viewtab; the viewtablist's
aria-labelnames the view choice.viewer.js's✎ editbecomes✎ open in editor— it never edited anything in-app.edit-documentandedit-applyare machine keys and are NOT renamed.Validation
python3 -m pytest tests/ -q— 4730 passed, 8 skipped, 1 failed. The onefailure is PRE-EXISTING and unrelated:
tests/hermes_runtime_contracts/test_release_inventory.py::test_validate_candidate_passes_on_the_realized_repositoryraises
ReleaseDependencyError: commit reachability could not be determinedfrom
scripts/hermes_runtime_validation/release.py:199. Proven by runningthat directory against a clean
mainworktree at119d94f:1 failed, 836 passed in 1279.97s— byte-identical to this branch's1 failed, 836 passed in 1331.12s, same single test. No file undertests/hermes_runtime_contracts/or
scripts/hermes_runtime_validation/is touched by this branch.Run as twelve per-directory invocations rather than one (the serial suite
exceeds an hour on this box;
pytest.inianchorsrootdirfrom anyinvocation, so the hermeticity conftest chain applies identically):
avatar_client_validator70 ·avatar_runtime97 ·conformance-gate13 (+2skipped) ·
credential_contracts2 ·doc-health628 ·document_catalog42·
hermes_runtime_contracts836 (+the pre-existing failure) ·ideation-dashboard2868 (+6 skipped) ·ideation_dashboard56 ·ideation_routing44 ·notebooklm64 ·proposal-support10.OPENSPEC_TELEMETRY=0 openspec validate --all --strict—Totals: 59 passed, 0 failed (59 items); the change itself validates--strictclean.scripts/doc-health.py --single-repo .pre/post — 51 findings before, 51after, byte-identical: zero NEW findings. (The baseline was taken from a
clean
mainworktree whose basename isopenxFactory; a first attempt from adifferently-named worktree produced nine spurious
register-lifecycle-consistencydeltas that are purely a path-resolution artifact of the directory name.)
scripts/validate-ideation-dashboard-contracts.py— 0 errors, 0 warnings.Smoke:
PYTHONPATH=scripts python3 -m ideation_dashboard.serve --helpworks.Pinned-test changes, each with its reason
Every moved assertion carries the reason in the test itself; none was deleted
to make a refactor pass.
test_doxbench_buffer_tabs_are_exactly_outline_and_documenttest_the_canvas_view_tabs_are_exactly_editor_and_preview+test_the_buffer_labels_survive_the_retired_tablist_without_being_a_controlBUFFER_KINDSlivessetActiveTab→setActiveBuffer, plus an explicitsetActiveView('editor')Preview, so a scenario about a TEXTAREA's focus/scroll has to stand where the textareas areactiveTab()→activeBuffer(),setActiveTab→setActiveBufferelements().save(kind)/.discard(kind)elements().save()/.cancel()test_with_a_save_seam_the_control_becomes_enableddiscardButtonscancelButtons(by class) +guardChoicestest_selected_tab_styling_rides_aria_selected_not_a_shadow_classdoxbench-viewtab-active, and pins the rule onto.doxbench-viewtabtest_the_buffer_tablist_implements_the_apg_roving_patterntest_the_view_tablist_implements_the_apg_roving_pattern(+ a new test that the buffer tablist is not rendered)setActiveBufferboth ways ANDsetActiveViewboth waystest_doxbench_state.pyactive_tab→active bufferin one test nametest_explorer_viewer.py✎ edit→✎ open in editorNew tests (not re-pins): the mount posture; the APG roving pattern measured on
the live DOM; flush-on-switch-into-Preview and its Editor counterpart; the two
selection routes plus the view-tab-cannot-choose-a-buffer refusal; Cancel's
scope and its identity notification; the panel Save against a moved identity;
the no-force/no-bypass rule; the view surface expressed over the buffer set;
the shell's selection wiring and the wheel-seed exclusion; the turn record's
bound buffer (four cases).
Flagged for review — where the spec under-determined the realization
design.mdsays "the RESPONSEnames WHICH buffer the turn was bound to", but the released
xfactory-workbench-chat-turnschema closes both the request and the successenvelope (
additionalProperties: false), so carrying the binding on the wirewould be a contract release — which the proposal explicitly forbids
(
target_release: none, task 9.3). Realized asPromptEnvelope.bound_buffer(the server's own per-turn record, whichdoxbench_turns.py— the file task 5.3 names — owns) plus a live"Working on —" statement in the rail header. Consequence to review: with
the envelope closed, the server can only read the binding the request
DECLARES (
active_document_path), so a human working on the outline while adocument is loaded for grounding is recorded server-side as bound to the
document. The code says so in
resolve_turn_binding's docstring. Annotatingeach transcript turn client-side was deliberately not done — the transcript
turn shape IS the wire shape.
Editorview. Resolving thedocument-switch guard returns focus to the Document buffer's text, and a
hidden pane cannot hold real focus, so
focusBufferEditorselectsEditorfirst. The guard is an argument about unsaved bytes and the answer belongs
where those bytes are — but the spec does not say this, so it is a call I
made.
both controls state the gate's absence; its own scenario names only Save, and
Cancel is a local discard that persists nothing (the pre-existing no-seam
posture kept Discard live). Realized per the scenario: Save states the
absence and is unreachable; Cancel stays live. The gate-OFF surface is
withheld one level up —
staging-workbench.jsnever mounts the canvas — whichis where the MODIFIED requirement's "no Save, Cancel, or other write-implying
control" clause is actually enforced, and that pin is unchanged.
say where. Left inside the Document buffer's Editor pane it would have been
reachable only while that buffer was active AND
Editorwas selected — areachability regression for a control D3 keeps precisely because it is
working and keyboard-reachable. It now sits in the chrome beside the panel
controls.
SAVE_WIRED_NOTEderives its order clause fromBUFFER_KINDS. It rendersthe identical sentence today ("Outline before Document"); it reads the
enumeration because it is a new panel-level surface and requirement five says
no new surface bakes the two names into itself.
Not done (deliberately)
that is the archive gate's, and needs the merged commit.
two-buffer invariant is asserted, not assumed.
Review fixes (commit
3017018)Adversarial review of this PR returned eight findings. All eight are resolved:
seven fixed in
3017018, and F2 resolved in5776398by Brett's 2026-08-15ruling — Option A, defer with an explicit carve-out.
focusBufferEditorcalledsetActiveBuffer("document"), so a human on the outline who DECLINED a document switch came back bound to the document — and it persisted.Editorview and focuses the buffer that is actually on screen (editorVisible(kind) ? kind : activeBuffer— a hidden pane holds no real focus). Where a switch really happened,switchDocumenthas already bound, so the switch arms are unaffected.PromptEnvelope.bound_buffer; review found it unreadable (nothing serializes, persists or renders it) and mis-derivable (the wire carries the document path, never which buffer the human selected).doxbench_turns.pyis byte-identical tomainagain —BufferBinding,resolve_turn_bindingandbound_bufferremoved with their four tests. See the section below.bindCanvasToDocumentnever refreshed the rail, so theunchangedroute (selecting the document already loaded) moved the binding while the header still said "Working on — outline".refreshRailFromCanvas()runs on EVERY outcome, before the outcome is even examined. Plus the mount-time half the review's reproduction exposed: the header names buffers the canvas does not have until its load settles, so the composition refreshes oncereadyresolves rather than rendering(absent)until something unrelated re-rendered it.doc-wheel.js'sselectPathhad zero callers, so wheel, picker and canvas could name three different documents.renderDocsPanelreturns a reconcile the shell adopts on each draw; a selection that does not land calls it, and so does every settled identity (which is how a guard resolved with Discard reaches the wheel). The reconcile is suppressed from binding — it is the canvas answering, not a human choosing.role=tabpanelwith notabIndex:Previewis where a mount lands, is scrollable, and contains nothing focusable (WCAG 2.1.1).viewPane.tabIndex = 0on both panes.selectDocumentrejected on an oversized/undecodable document, reached through handlers that drop the promise — nothing stated, control left showing a document that never loaded.switchDocumentinto the same stated refusal every other selection failure speaks, so BOTH routes (wheel and picker) are fixed at once and the buffer is provably untouched. The shell also awaits and catches as defence in depth.rememberedViewsurvived a whole-document replacement, so the previous document's caret/scroll were re-applied to new content.SAVE_WIRED_NOTEderived its ORDER clause fromBUFFER_KINDS(the buffer SET) while the order isSAVE_BUFFER_ORDER's.guardChoiceswas computed and never asserted.New/changed tests
test_declining_a_document_switch_does_not_move_the_chat_binding— F1'sregression, including the PERSISTED record (what a reload resurrects) and the
contrapositive that the Discard arm, which really switches, really binds.
guardFocusScenariore-pinned: the human now SELECTS the document beforetyping in it, which is how the binding is established in the product — focus
can only legitimately return to the buffer on screen.
selection_results) mounting the realmountStagingWorkbench:test_the_rail_states_the_buffer_the_chat_is_working_on(the header had no test at all),
test_a_docs_row_selection_moves_the_stated_binding,and
test_a_blocked_selection_leaves_wheel_picker_and_canvas_agreeing(blocked,then declined, all three still name the open document and the unsaved text
survives). The wheel's own selection is read through
pane.__docWheel.focused()— the handle the pane already keeps for teardown — so no test-only DOM was added.
test_the_view_tabpanels_are_reachable_by_keyboard(F5),test_a_document_that_cannot_be_loaded_refuses_visibly_instead_of_rejecting(F6, both routes),
test_a_document_switch_drops_the_previous_documents_caret_and_scroll(F7), and two shell doctrine pins:
test_every_selection_route_refreshes_the_stated_bindingandtest_a_selection_that_does_not_land_reconciles_the_docs_wheel.onIdentitySettled: refreshRailFromCanvas→syncContextFromCanvasre-pinnedwith the reason (a second thing now rides that callback).
F2 resolution — deferred, and recorded rather than dropped (
5776398)contracts/schemas/xfactory-workbench-chat-turn.schema.yamlcloses the requestand the success envelope (
additionalProperties: false, fixedrequired),so a turn record a reader can actually consult cannot carry the bound buffer's
name without a chat-turn contract release — which this change forbids
(
target_release: none, re-verified by task 9.3). A server-side-only fielddoes not substitute for it on two counts the review established: it is
unreadable, and it is mis-derivable. Dead code that is also wrong is worse than
an honest gap, so it is removed rather than kept as a placeholder.
Removed:
BufferBinding,resolve_turn_binding,PromptEnvelope.bound_buffer, and the four tests that exercised them(
test_the_turn_record_names_the_buffer_the_turn_was_bound_to,test_a_turn_that_names_no_document_records_the_outline_as_its_binding,test_binding_never_narrows_what_the_turn_is_grounded_on,test_a_declared_binding_that_does_not_match_its_buffer_still_refuses_first).revalidate_scope,require_outline_and_documentandPROPOSAL_TARGETSwerenever touched by this change and still are not.
Recorded — the obligation is written down four times, so no later reader has
to rediscover it:
design.mdgains "Turn-record naming — deferred (F2 carve-out, Brett2026-08-15)": the closed wire, the two defects, and where the obligation
goes. Clause 5 of the chat-binding rule now states what Phase A does ship.
The spec delta states the deferral in the requirement text, so a reader of
the promoted spec sees an obligation rather than a gap, and the scenario is
rewritten:
tasks.md5.3 is[~] DEFERREDwith the reasoning, not falsely ticked.ideation/staging/INDEX.mdrecords that Phase B inherits the obligation —it re-cuts the turn machinery and releases that contract anyway, so the naming
rides that release.
proposal.md(code_surface, What Changes item 4, Impact) and the READMErealization note stop claiming
doxbench_turns.pyand namedoxbench-chat.js'slive binding statement instead. Q4's other four clauses are unaffected: the
chat's context IS
state.active_buffer, the switch is immediate with no confirmstep, the binding is stated live above the transcript (and now tested), and the
active-path revalidation still refuses a mismatched binding before any provider
call.
Gates after the fixes
python3 -m pytest tests/ideation-dashboard/ -q→ 2873 passed, 6 skipped,exit 0. (2868 at first review → 2877 after the seven fixes → 2873 after F2
removed its four tests; +5 net against the pre-review count.)
OPENSPEC_TELEMETRY=0 openspec validate --all --strict→Totals: 59 passed, 0 failed (59 items).scripts/doc-health.py --single-repo .→ 51 findings, zero NEW against thesame clean-
mainbaseline.scripts/validate-ideation-dashboard-contracts.py→ 0 errors, 0 warnings.🤖 Generated with Claude Code