Files
jason.woltje 068d868a99 lead: commit rocko's untracked evidence (4471 files: queue-124 queue-129 queue-171 queue-178 queue-280 queue-31 queue-84 queue-85 queue-94)
Unclaimed files left in the canonical checkout. Inventory: canonical-cleanup-inventory.md (commit-as-evidence groups). detect-secrets scan clean on 2026-11-02: hits are sha256 pins, git object ids, test sentinels already in tracked tests and unit-file lines.
2026-11-02 15:05:15 -06:00

18 KiB
Raw Permalink Blame History

Row 129 / #1623 — Console chat area

Brief: docs/plans/2026-10-14_prd-1.2-build.md, The WebUI chat area, pin 333adea856b1; REQ-WEB-1, REQ-THREAD-2 and REQ-USER-2. Reviewer Filbert, gate owner Sage. Design: ../DESIGN.md, approved sage-0724. Claim rev 1737. Base 70504d23a, after row 124, as sage-0742 requires. Detached worktree /mnt/storage/src/mosaic-stack-rocko-129-r1. Source is staged, not committed. No credentials, push or live action.

Approved scope and behavior

sage-0724 keeps this row UI-only on the current human transport. Q156's channel kind and CLI/WebUI channel modules belong to a separate brief. chat.mjs is the single HTTP-to-bus seam: fixed project.list/create and thread.list/create/ messages/send/open calls, never a browser-provided verb. The configured Console entrypoint builds it from the existing busCaller. No broker, schema, role, harness, sandbox or channel interface changes.

Chat is its own section and command-palette destination. The business project catalog and the human's named threads lead to distinct project/thread URLs. Names are creation-only. The optional repository link is a configured key from the existing business read, never a filesystem path. No implicit project/thread creation. The thread composer sends exact text as REQUEST, with one attempt per explicit submit. Resume is an explicit POST; every read is pure.

chat-http.mjs exposes the fixed routes documented in DESIGN.md and README. The four POSTs share a chat-local copy of the existing Console send fence: --send, named Host, one exact proxy identity, exact HTTPS Origin, same-origin Fetch Metadata, JSON, 16 KiB and strict fields. Existing routes keep their branches. IDs/queries/names/body are validated before transport. A repeated or unknown query is refused. The broker remains the ownership authority. Same-business wrong-owner messages/send/open are 403 thread-not-owned; foreign or missing ids are 404. Refusals use fixed text and expose no private body/name/ owner. Definite refusals are sent:false; lost/malformed receipts are unknown, never retried. Logs carry operation, signed-in user and verified id/outcome only.

chat.js holds drafts, receipts and pending state per thread in memory. Reads use AbortController and generations. Late reads, refusals or writes cannot paint another thread or navigate away after the user has moved. A send receipt means accepted, not answered; it changes to shown once that id is read. Polling preserves draft/caret/scroll. Explicit tail actions and an own send scroll to the end; an arrival while scrolled keeps position and offers New messages. Sign-out and global refusal forget private chat state. A thread ownership refusal forgets that thread; ordinary read failures retain its draft.

Forward paging starts oldest-first, 100 messages per request, with conservative hasMore and id de-duplication. The display retains at most 200 messages while paging through history, preserving the forward cursor. No latest-first broker cursor or rename is added, per sage-0724. HTML/control/bidi content is rendered as inert text. Read-only mode disables creation, Resume and Send, including a synthetic submit event. CSS stays scoped to chat classes/ids and uses the existing Console tokens.

Rebase and shared paths

Initial source base was 5e0437659 (own logs after landed 640f4cef5). Before the final runs, rebuilt on row 124's landing 70504d23a, sage-0742. The original candidate is retained as before-124.patch with its base.

  • serve.mjs: row 124's usage BUS_VERBS entry and read branch remain intact. Chat adds an import, static JS/CSS, the chat option and its fixed route branch before generic preview refusal. Different hunks; applied unchanged.
  • public/bus.js: row 124's tokenUsage function and Settings read/render remain intact. Chat changes navigation/palette, forget, route delegation and the send-config refresh hook. Different hunks; applied unchanged.
  • docs/TOOLS.md: both rows append at EOF; retained row 124's usage paragraph and manually appended Chat after it. No content from 124 was replaced.
  • index.html adds chat assets before bus.js. cli.mjs injects the adapter. README documents the UI/routes. All implementation/tests are otherwise in new chat files. The initial patch has 12 paths; the final packet has 15 with the three existing navigation expectation tests described below.

shared-paths-after-124.patch records the rebased shared-source diff. Row 154 remains unlanded and none of its source is applied. A later landing overlap requires the ordinary rebase/recheck; no authority to deploy is implied.

Acceptance evidence

chat.test.mjs uses actual HTTP, plus an injected verified-human transport and real Broker/Store on private fixtures. It covers fixed calls; list/filter; create/name/repository; duplicate names; missing/ambiguous assistant; deep URLs; forward paging and invalid/cross-thread cursor; pure GET; all POST fences; strict shape/byte bounds; verified/uncertain receipts; and exact once-only calls. An extra admitted-request unit boundary pins repeated identity and named-Host checks even though the outer server also guards them. A configured Console child proves actual adapter wiring via no-bus-host, rather than not-configured. A wrong-owner thread has a private sentinel message, and a separate business has a foreign project/thread. Lists omit them, direct operations refuse without private data or message/open/allowed-action mutation. Refusal audit events are legitimate and are not mistaken for allowed writes.

chat-browser.test.mjs runs the actual assets with the repository's fixture-only CDP helper. It covers the lists/forms/palette, optional repo, independent drafts, all receipts, Resume, paging/de-duplication/200-row bound, polling a real timer, read-only, caret/scroll, late read and creation responses, refused ownership, global refusal, sign-out during a pending write, hostile HTML/ids/control text, and encoded-byte bounds. Refresh checks wait for the shared Board button to be enabled and for a new DOM generation, so unchanged DOM cannot pass them.

The early real-Broker fixture needed the required arbiters and a new Broker for each configuration variant (the constructor clones businesses). The first browser extension found actual tail/receipt/late-create defects; red logs are retained and their fixes have direct tests. Palette reads initially exposed that the fixture had a working chat but no other bus reads; the fixture now answers its ordinary bus reads consistently and has a separate explicit refusal switch. None of these is a tracked #258/#261/#262/#263 recurrence.

Gate and mutants

sage-0735 granted the first six focused files; their final script sum was 53/53 (focused-counts.json), with a clean sweep at 15:59:22Z. sage-0742 granted the post-rebase slot. Busy check CLEAR/exit 0, gated with &&, at 2026-10-18T16:09:48Z. The order is focused extension, targeted gate, mutants. TMPDIR=/mnt/storage/scratch/rocko-129/tmp throughout. DOCKER_HOST=unix:///nonexistent.sock. No Docker, live files/stores/units or actions.

Targeted gate: the full WebUI package (browser files included), bus threads.test and CLI thread-cli.test parity. A direct shell-reader search found no import of the changed WebUI files in scripts/test-*.sh; its only webui hits are unrelated via-webui fixture values in test-land-work.sh. No shell suite is run in this builder gate. Sage retains the full landing gate. All steps use pipefail and exit-status gating; no output pipe hides a test exit.

Each mutant names its killing test in mutants.py/results. Edits require one exact source match; each runner gets a new process group, with descendant/group kill on timeout and restoration in finally. Syntax/import/runner timeouts do not count as kills. A literal escaped test-name pattern runs the owning check. Results, counts, restored hashes and final process sweep follow below once observed. Public landing waits for Mos's decision 123 go; activation is separate.

Existing navigation expectation updates

The first full WebUI gate found 5 failures, all traceable to the new Chat UI (first-navigation logs retained). Three existing test files join the packet:

  • browser.test.mjs: the static script count is 5, previously 4; index.html now includes chat.js. The no-inline-script and remaining browser assertions stay.
  • shell.test.mjs: section SVG count is 10, previously 9; Chat adds one section. The exact command-palette views list gains #/chat, matching its new entry.
  • views.test.mjs: page readiness waits for 10 section links, previously 9. Queue/Business/Settings/refusal/security assertions are unchanged.

No failure is reclassified as a flake. These changes preserve the existing test intent on the expanded navigation. The final candidate has 15 paths (the earlier 12-path count above describes source before these expectations).

sage-0747 named checks and exact edit map

After the full targeted gate passed at 16:24:07Z, added the requested name checks to those three test files, with product source unchanged. Ran all three singly: browser 1, shell 5, views 3, all green (9 total; these are subsets of the 177 WebUI tests, not nine additional package tests).

Final candidate file:line Old New Reason
packages/webui/tests/browser.test.mjs:21 4 scripts 5 scripts; next assertion pins /chat.js exactly once index.html adds only chat.js
packages/webui/tests/shell.test.mjs:266 9 nav SVGs 10; next assertion pins Chat href and /icons.svg#i-inbox Chat adds its own section and existing inbox icon
packages/webui/tests/shell.test.mjs:463 9 palette hrefs 10, exact list includes #/chat Chat is a command-palette destination
packages/webui/tests/views.test.mjs:59 wait for 9 links wait for 10 AND the #/chat link named Chat shared readiness for Queue/Business/Settings test
packages/webui/tests/views.test.mjs:59 same 9-link shared wait same count AND named Chat wait shared readiness for seeded secrets/refusals test

Final results

The final gate passed at 2026-10-18T16:24:07Z: WebUI 177, bus threads 14, CLI thread parity 11, total 202. Every suite has zero failed/cancelled/skipped. The named expectation reruns add 9 successful executions of those same tests; the final malformed-list assertions rerun chat.test.mjs, 20/20. These are subsets and are not added to the 202 package/parity count.

Mutant 16 first survived: the malformed-response case covered only messages, whose later .at operation also refuses a non-array. Added project.list and thread.list malformed-response checks to the same owning test; source was already correct. Kept read-array-survivor.log, mutants-first.txt and first results. chat-final-shape.log is green (20/20), and unchanged mutant 16 is killed on the resumed run. No product fix or weaker expectation was used. The final results below include 01–15 and resumed 16–64.

Mutant Owning file Killing test name/prefix Result
01-project-list packages/webui/tests/chat.test.mjs chat reads map only fixed verbs KILLED
02-thread-filter packages/webui/tests/chat.test.mjs chat reads map only fixed verbs KILLED
03-project-repo packages/webui/tests/chat.test.mjs chat project.create: one verified write KILLED
04-thread-name packages/webui/tests/chat.test.mjs chat thread.create: one verified write KILLED
05-request-class packages/webui/tests/chat.test.mjs chat thread.send: one verified write KILLED
06-thread-target packages/webui/tests/chat.test.mjs chat thread.send: one verified write KILLED
07-resume-verb packages/webui/tests/chat.test.mjs chat thread.open: one verified write KILLED
08-owner-status packages/webui/tests/chat.test.mjs REQ-USER-2 real broker KILLED
09-foreign-status packages/webui/tests/chat.test.mjs REQ-USER-2 real broker KILLED
10-strict-query packages/webui/tests/chat.test.mjs chat refuses malformed and repeated query/id values KILLED
11-uuid packages/webui/tests/chat.test.mjs chat refuses malformed and repeated query/id values KILLED
12-page-limit packages/webui/tests/chat.test.mjs chat refuses malformed and repeated query/id values KILLED
13-default-page packages/webui/tests/chat.test.mjs chat reads map only fixed verbs KILLED
14-cursor packages/webui/tests/chat.test.mjs chat reads map only fixed verbs KILLED
15-more-metadata packages/webui/tests/chat.test.mjs chat reads map only fixed verbs KILLED
16-read-array packages/webui/tests/chat.test.mjs chat read failures redact ownership KILLED
17-send-mode packages/webui/tests/chat.test.mjs chat repeats every POST boundary KILLED
18-named-host packages/webui/tests/chat.test.mjs chat repeats every POST boundary KILLED
19-single-identity packages/webui/tests/chat.test.mjs chat repeats every POST boundary KILLED
20-origin packages/webui/tests/chat.test.mjs chat repeats every POST boundary KILLED
21-fetch-metadata packages/webui/tests/chat.test.mjs chat repeats every POST boundary KILLED
22-json-type packages/webui/tests/chat.test.mjs chat project.create: each existing Console write fence KILLED
23-json-byte-bound packages/webui/tests/chat.test.mjs chat thread.send: each existing Console write fence KILLED
24-strict-shape packages/webui/tests/chat.test.mjs chat validates names, body, project KILLED
25-name-length packages/webui/tests/chat.test.mjs chat validates names, body, project KILLED
26-nonempty-body packages/webui/tests/chat.test.mjs chat validates names, body, project KILLED
27-verified-ack packages/webui/tests/chat.test.mjs chat project.create: refusal or lost/malformed receipt KILLED
28-opened-ack packages/webui/tests/chat.test.mjs chat thread.open: refusal or lost/malformed receipt KILLED
29-no-retry packages/webui/tests/chat.test.mjs chat project.create: refusal or lost/malformed receipt KILLED
30-uncertain-state packages/webui/tests/chat.test.mjs chat project.create: refusal or lost/malformed receipt KILLED
31-private-errors packages/webui/tests/chat.test.mjs chat project.create: refusal or lost/malformed receipt KILLED
32-dispatch packages/webui/tests/chat.test.mjs chat reads map only fixed verbs KILLED
33-cli-adapter packages/webui/tests/chat.test.mjs configured Console process injects chat KILLED
34-static-script packages/webui/tests/chat.test.mjs chat assets, GET purity KILLED
35-nav packages/webui/tests/chat-browser.test.mjs chat browser: list/create named projects KILLED
36-inert-bodies packages/webui/tests/chat-browser.test.mjs chat browser: thread drafts, receipts and cursor history KILLED
37-thread-drafts packages/webui/tests/chat-browser.test.mjs chat browser: thread drafts, receipts and cursor history KILLED
38-submit-once packages/webui/tests/chat-browser.test.mjs chat browser: page forward and deduplicate replies KILLED
39-browser-byte-bound packages/webui/tests/chat-browser.test.mjs chat browser: page forward and deduplicate replies KILLED
40-manual-redirect packages/webui/tests/chat-browser.test.mjs chat browser: thread drafts, receipts and cursor history KILLED
41-stale-read-refusal packages/webui/tests/chat-browser.test.mjs chat browser: a late read from A cannot paint B KILLED
42-owner-cache packages/webui/tests/chat-browser.test.mjs chat browser: uncertain writes retain draft KILLED
43-bounded-display packages/webui/tests/chat-browser.test.mjs chat browser: display stays bounded KILLED
44-no-write-get packages/webui/tests/chat.test.mjs chat reads map only fixed verbs KILLED
45-inert-labels packages/webui/tests/chat-browser.test.mjs chat browser: list/create named projects KILLED
46-thread-repo-ui packages/webui/tests/chat-browser.test.mjs chat browser: list/create named projects KILLED
47-abort-old-reads packages/webui/tests/chat-browser.test.mjs chat browser: a late read from A cannot paint B KILLED
48-forget-private-cache packages/webui/tests/chat-browser.test.mjs chat browser: a refusal elsewhere forgets private chat drafts KILLED
49-polling packages/webui/tests/chat-browser.test.mjs chat browser: automatic polling follows a reply KILLED
50-control-visibility packages/webui/tests/chat-browser.test.mjs chat browser: list/create named projects KILLED
51-safe-link-id packages/webui/tests/chat-browser.test.mjs chat browser: list/create named projects KILLED
52-name-controls packages/webui/tests/chat.test.mjs chat validates names, body, project KILLED
53-after-id packages/webui/tests/chat.test.mjs chat refuses malformed and repeated query/id values KILLED
54-readonly-controls packages/webui/tests/chat-browser.test.mjs chat browser: uncertain writes retain draft KILLED
55-ui-ack packages/webui/tests/chat-browser.test.mjs chat browser: a confirmed visible message replaces its pending receipt KILLED
56-explicit-tail packages/webui/tests/chat-browser.test.mjs chat browser: scrolled history stays put KILLED
57-own-send-tail packages/webui/tests/chat-browser.test.mjs chat browser: scrolled history stays put KILLED
58-shown-receipt packages/webui/tests/chat-browser.test.mjs chat browser: a confirmed visible message replaces its pending receipt KILLED
59-late-create packages/webui/tests/chat-browser.test.mjs chat browser: a late project creation receipt KILLED
60-static-style packages/webui/tests/chat.test.mjs chat assets, GET purity KILLED
61-cli-adapter-option packages/webui/tests/chat.test.mjs configured Console process injects chat KILLED
62-palette packages/webui/tests/chat-browser.test.mjs chat browser: list/create named projects KILLED
63-caret packages/webui/tests/chat-browser.test.mjs chat browser: thread drafts, receipts and cursor history KILLED
64-readonly-submit packages/webui/tests/chat-browser.test.mjs chat browser: uncertain writes retain draft KILLED

64/64 final kills, no survivor, runner timeout or invalid mutation. All 15 candidate hashes and staged blobs match; clean-index reconstruction from base 70504d23a reproduces every path. Final own-cwd/argv process sweep is empty at 2026-10-18T16:29:04Z. All runners exited; no Docker network was created. Candidate manifest SHA-256: cfbadbd49902f5f3740392fec9218279adc2a661cfb28341fba02790f327232b.