Files

27 KiB
Raw Permalink Blame History

Row 164 / #1661 — channel kind, round 1

Base 850484a7d, the landed row 129; detached worktree /mnt/storage/src/mosaic-stack-rocko-164-r1. Claim rev 1793. Reviewer Dewey; Sage gates; accepted design ../DESIGN.md (mos-0768, mos-0773, sage-0770). Implementation is complete in the detached tree; source staged, not committed. Focused and full verification are complete under sage-0801/0807/0809/0820. Final package sum: 875/875; final mutants: 50/50 killed; empty process sweep. The stage notes below retain intermediate waits/failures. Final results and verification.json describe the current candidate, now 21 paths.

Scope and acceptance

channel interfaceVersion 1, dispatch(request,{call}), list switch, cli and webui modules. Per-operation organization settings read through existing plugins verb; only the channel key reaches the loader. Empty or absent selection is off. The additive synchronous loader.snapshot(kind) returns its immutable matched {name,module} array. Existing loaded(), modules(), path/version and last-good logic remain byte-identical. Capture once, then dispatch with no lock. A slow send must not block a list. Last-good and first-load fail-closed are retained.

Management plugins/plugins.set stay on the existing core transport, independent of both switches. Off refusals name mosaic plugins and mosaic plugins set with the channel list; CLI exit 3, WebUI 503, no chat/delivery/read side effects. The fixed WebUI recovery message never echoes error input. Conversion remains only project/thread surfaces and thread talk/follow; legacy human management and non-thread messages stay core. Discord stays out. No implicit defaults.

No edit to serve.mjs, public/chat.js, any proof/transport file, broker/runtime, unit, wrapper, sandbox, role, schema or live configuration. Mos F4 is out because chat.js stays untouched (sage-0794). Source is staged, not committed, at handoff.

New owned helper: packages/plugins/src/channel.mjs. Additive owned loader edit: packages/plugins/src/loader.mjs snapshot getter only. Approved chat HTTP mapping: packages/webui/src/chat-http.mjs status entry and fixed recovery message only. Other source: kinds.mjs; channel/cli and channel/webui index.mjs; CLI cli.mjs and WebUI chat.mjs. thread.mjs needs no edit if caller injection suffices. Docs: plugins README, PRD Technical considerations channels line, this packet.

Tests: plugins/tests/channel.test.mjs; CLI channel-cli.test.mjs, channel-recovery.test.mjs and shared private channel-fixture.mjs; WebUI channel-chat.test.mjs; bus channel-proof.test.mjs. Existing kind/loader key expectations change exactly as listed below. The only CLI/WebUI parity fixture changes are approved additions in thread-cli.test.mjs and chat.test.mjs.

Landed-tree evidence recheck

On 850484a7d, chat.mjs:3-12 still exposes the seven fixed operations; its send is REQUEST at :11. chat-http.mjs:12-22 owns the closed status/fixed-message map, and :114-119 ignores arbitrary transport text. cli.mjs:180-186 still creates core callFor; :345 is thread talk's injection point; :541-546 dispatch project, threads/thread and the independent administrative plugins command. All match the accepted DESIGN references. Runtime verifier path remains runtime.mjs:116, binding via:'cli' at :121, broker checks at :330/:472/:530 and event at :1887, landing predicate at landing.mjs:107. These files will remain unchanged.

All four SHA-256 proof baselines match DESIGN.md before edits. The proof tests also retain the literal-path requirement and reject absent/forged proof through a private real socket. As in existing stack-copy.test.mjs, only fixture ancestry is truncated to pid 1 using module mocks: actual PID/UID/argv/start/nonce and verifyHuman run unchanged. Fixtures never read the live store/config/tokens.

Existing exact-key expectation edits (sage-0798)

These assertions now include the new kind; no other plugins assertions change. Machine-readable old/new lines are in expectation-edits.json.

File:line on base Old exact expectation New exact expectation
packages/plugins/tests/kinds.test.mjs:9 assert.deepEqual(Object.keys(KINDS), ["usage-source", "limit-check", "search-source"]); assert.deepEqual(Object.keys(KINDS), ["usage-source", "limit-check", "search-source", "channel"]);
packages/plugins/tests/loader.test.mjs:15 const GOOD_LOADED = { ...GOOD, "search-source": [] }; const GOOD_LOADED = { ...GOOD, "search-source": [], channel: [] };
packages/plugins/tests/loader.test.mjs:59 assert.deepEqual(result.loaded, { ...doc.plugins, "search-source": [] }); assert.deepEqual(result.loaded, { ...doc.plugins, "search-source": [], channel: [] });
packages/plugins/tests/loader.test.mjs:173 assert.deepEqual(s.loader.loaded(), { "usage-source": ["meter"], "limit-check": [], "search-source": [] }); assert.deepEqual(s.loader.loaded(), { "usage-source": ["meter"], "limit-check": [], "search-source": [], channel: [] });
packages/plugins/tests/loader.test.mjs:217 assert.deepEqual(result.loaded, { "usage-source": [], "limit-check": ["cap"], "search-source": [] }); assert.deepEqual(result.loaded, { "usage-source": [], "limit-check": ["cap"], "search-source": [], channel: [] });
packages/plugins/tests/loader.test.mjs:245 assert.deepEqual(result.loaded, { "usage-source": [], "limit-check": ["cap"], "search-source": [] }); assert.deepEqual(result.loaded, { "usage-source": [], "limit-check": ["cap"], "search-source": [], channel: [] });

Additions-only parity fixture hunks (sage-0766 / sage-0770)

  • packages/cli/tests/thread-cli.test.mjs, setup immediately before/inside the Broker constructor: add a separate managementReads list and an organization read adapter which requires plugins and returns the two enabled channels.
  • packages/webui/tests/chat.test.mjs, setup callback: add managementReads and a plugins response before the existing calls recording; every chat operation still reaches the original callback and every existing assertion unchanged.
  • Same chat.test.mjs, real-Broker callback: the same separate plugins response and management read list, before the existing verb accounting.

parity-fixture-additions.patch records the exact hunks. A static diff check rejects any removed line, so every existing assertion, payload and expected result remains byte-identical. The second WebUI hunk is needed because this file constructs a separate seam for its real-Broker HTTP acceptance case. The admitted-request fence callback is unchanged: it must never call anything.

Verification plan and boundaries

Focused red/green ran under sage-0801; observed results below. Later builder gate: plugins, cli, bus and webui including browser parity, plus one mutant per acceptance or guard, each named with its exact killing test. Sage retains all scripts/test-*.sh in their landing gate; request the full slot before suites or mutants. Scratch TMPDIR only; DOCKER_HOST dead socket; process groups killed on timeout; restore mutant bytes and staged blobs; sweep cwd-scoped node/chromium before saying slot clear. No Docker or live action. Two tracked-flake recurrences in one gate stop the run. The full package gate and 50 mutants are not yet run.

Cut-over — human action only

Per sage-0769 / mos-0768, in the Mos-run re-pin window that takes row 164 live:

  1. Mos runs the approved activation. No development seat activates anything.
  2. Right after activate, Jason uses the existing proved human management path: mosaic plugins --business BUSINESS --json, then mosaic plugins set --business BUSINESS --file PATCH, with the freshly read revision and plugins.channel set to ["cli", "webui"] in the patch.
  3. Smoke CLI thread listing (mosaic threads --business BUSINESS) and Console chat with the approved human access. Confirm both are usable.

No agent runs step 2 or edits the live organization file. Until the explicit enablement, absent-key-off refusals name mosaic plugins and mosaic plugins set with the channel list as the recovery. If either channel is later disabled, that same independent core management path restores it.

Fixture exception

In thread-cli.test.mjs and chat.test.mjs, additions only: organization read adapter or plugins response, plus a separate record of management reads. Every existing assertion, payload and expected result stays byte-identical. The build packet will list each exact hunk for Dewey's line-by-line review.

Focused red/green evidence (sage-0801)

Span 17:51:18Z–17:53:46Z; busy check CLEAR/0 gated with &&. channel-red.log records 0/9 before implementation: the registry/module/snapshot/helper were missing. channel-green-first.log records 9/9 after the accepted implementation. The final nine focused files sum to 71/71 via awk: channel 9, CLI channel 2, WebUI channel 3, CLI parity 11, WebUI parity 22, kinds 5, loader 16, actual-writer recovery 1, proof 2. Each final log has zero failures/cancellations/skips. focused-verification.json records the counts and empty before/after cwd sweep. Slot clear was sent after all runners exited; no browser/Docker/sandbox/live use.

The first new HTTP fixture used fetch, which did not preserve the named Host; its three failures were fixed by using the existing tests' raw-HTTP pattern. The first recovery fixture needed its private data directory explicitly created; that one failure was fixed in the fixture. Logs are retained. Neither was a product defect or a tracked flake. Existing parity assertions were unchanged.

After the focused slot was released, strengthened the new channel file with four further tests: swapped index after component checks, constructor input, selected-loader-module dispatch, and the module's operation filter. Added empty and directory-valued index cases plus exact first-unsafe-component messages. These additions are not run yet; the full grant will validate them. Module operation sets were formatted one verb per line, with no semantic change.

Mutant inventory — prepared, unrun

50 exact-once sites in mutant-sites.json; read-only preflight: PREFLIGHT_OK 50. mutants.py selects the named killing test only, rejects invalid/syntax/import failures or timeouts as kills, starts each runner in its own process group, kills its group/descendants on timeout, and restores original bytes in finally. No mutation run occurred after returning the focused slot.

Mutant Owning test file Named killing test prefix
01-kind-version packages/plugins/tests/channel.test.mjs channel registry requires
02-kind-switch packages/plugins/tests/channel.test.mjs channel registry requires
03-cli-forward-verb packages/plugins/tests/channel.test.mjs channel shipped modules load
04-webui-forward-verb packages/plugins/tests/channel.test.mjs channel shipped modules load
05-cli-forward-args packages/plugins/tests/channel.test.mjs channel shipped modules load
06-webui-forward-args packages/plugins/tests/channel.test.mjs channel shipped modules load
07-cli-filter packages/plugins/tests/channel.test.mjs channel shipped modules load
08-webui-filter packages/plugins/tests/channel.test.mjs channel shipped modules load
09-cli-result packages/plugins/tests/channel.test.mjs channel shipped modules load
10-webui-refusal packages/plugins/tests/channel.test.mjs channel shipped modules load
11-bad-name packages/plugins/tests/channel.test.mjs channel guards refuse bad names
12-directory-check packages/plugins/tests/channel.test.mjs channel guards refuse symlinked module, index and kind directories
13-index-check packages/plugins/tests/channel.test.mjs channel guards refuse bad names
14-symlink-check packages/plugins/tests/channel.test.mjs channel guards refuse symlinked
15-realpath-check packages/plugins/tests/channel.test.mjs channel last realpath check
16-export-check packages/plugins/tests/channel.test.mjs channel guards refuse bad names
17-function-check packages/plugins/tests/channel.test.mjs channel guards refuse bad names
18-version-check packages/plugins/tests/channel.test.mjs channel guards refuse bad names
19-snapshot-pair packages/plugins/tests/channel.test.mjs channel snapshot is
20-snapshot-array-freeze packages/plugins/tests/channel.test.mjs channel snapshot is
21-snapshot-entry-freeze packages/plugins/tests/channel.test.mjs channel snapshot is
22-snapshot-unknown packages/plugins/tests/channel.test.mjs channel snapshot is
23-constructor-name packages/plugins/tests/channel.test.mjs channel caller refuses invalid core
24-constructor-call packages/plugins/tests/channel.test.mjs channel caller refuses invalid core
25-settings-verb packages/plugins/tests/channel.test.mjs channel caller re-reads settings
26-settings-shape packages/plugins/tests/channel.test.mjs channel caller malformed settings
27-kind-isolation packages/plugins/tests/channel.test.mjs channel caller malformed settings
28-named-selection packages/plugins/tests/channel.test.mjs channel caller re-reads settings
29-absent-is-off packages/plugins/tests/channel.test.mjs channel caller re-reads settings
30-empty-is-off packages/plugins/tests/channel.test.mjs channel caller re-reads settings
31-settings-reread packages/plugins/tests/channel.test.mjs channel caller re-reads settings
32-last-good packages/plugins/tests/channel.test.mjs channel caller uses last good
33-dispatch-bypass packages/plugins/tests/channel.test.mjs channel caller invokes the selected loaded module
34-module-operation-filter packages/plugins/tests/channel.test.mjs channel caller keeps the selected module operation filter
35-cli-project packages/cli/tests/channel-cli.test.mjs CLI off, absent
36-cli-threads packages/cli/tests/channel-cli.test.mjs CLI off, absent
37-cli-thread packages/cli/tests/channel-cli.test.mjs CLI off, absent
38-cli-talk packages/cli/tests/channel-cli.test.mjs CLI off, absent
39-core-recovery packages/cli/tests/channel-recovery.test.mjs both channels off recover
40-cli-exit packages/cli/tests/channel-cli.test.mjs CLI off, absent
41-webui-bypass packages/webui/tests/channel-chat.test.mjs WebUI channel off returns
42-webui-error-envelope packages/webui/tests/channel-chat.test.mjs WebUI channel off returns
43-webui-status packages/webui/tests/channel-chat.test.mjs WebUI channel off returns
44-webui-reflection packages/webui/tests/channel-chat.test.mjs WebUI channel-disabled recovery text
45-proof-admission packages/bus/tests/channel-proof.test.mjs channel recovery still requires
46-proof-path packages/bus/tests/channel-proof.test.mjs channel recovery still requires
47-proof-bytes packages/bus/tests/channel-proof.test.mjs channel conversion preserves the four
48-dispatch-lock packages/plugins/tests/channel.test.mjs channel dispatch holds no selection lock
49-cli-recovery-text packages/cli/tests/channel-cli.test.mjs CLI off, absent
50-webui-recovery-text packages/webui/tests/channel-chat.test.mjs WebUI channel off returns

Full grant — sage-0807 / sandbox clarification sage-0809

Separate full slot granted at 18:00Z: plugins, bus, WebUI and CLI package suites, then the 50 named mutants. First busy check CLEAR/0, gated with &&; full-start.txt records the actual start. Initial grant said no sandbox. Before starting CLI, identified its existing launcher/thread-launch fixture bwrap sessions and asked Sage; sage-0809 explicitly permits those unchanged fixture-only sessions. No policy or mount edits; TMPDIR remains in scratch rather than private /tmp. A sandbox failure stops and releases the slot before retry. No Docker/live action. Darkwing priority after about 18:10: if requested while packages run, finish the packages and release before mutants. No new tests are skipped for these limits.

Exact additions-only fixture hunk coordinates

File Old hunk starts New hunk starts Change
packages/cli/tests/thread-cli.test.mjs 32 32 Management read adapter/response and separate record only; no removed lines.
packages/webui/tests/chat.test.mjs 33 33 Management read adapter/response and separate record only; no removed lines.
packages/webui/tests/chat.test.mjs 189 194 Management read adapter/response and separate record only; no removed lines.

Full package result and third-fixture boundary

Full run began 18:01:08Z, package processes all exited by 18:05:44Z. Plugins 77/77, bus 369/369, WebUI 182/182, CLI 246/247. Awk sum 875 executions: 874 pass, 1 fail, 0 cancelled/skipped. Every fixture sandbox case passed; no tracked flake. Cwd sweep empty at 18:06:29Z; slot clear sent to Sage. Mutants have not run and no retry has occurred.

The only failure is packages/cli/tests/project.test.mjs:37-51, the valid list part of the argument-validation test. Its :47 transport answers every verb []; the new plugins read therefore refuses channel-config and returns exit3, where :49 expects0. Existing :50 expects only project.list in accounting; :51 expects no projects. This is the same fixture gap as the accepted parity exceptions, but it is a third file not yet authorized. No product workaround was applied.

proposed-project-fixture.patch is a concrete fixture-only proposal, NOT applied: answer the management read with enabled channels and record it separately, otherwise retain the original listed.push/[] behavior. All existing assertions, payloads and expected results remain byte-identical. Sent Sage the scope/slot request after releasing; project.test single and CLI suite must pass before the 50 mutants. The other three package results need no repeat for a fixture-only change. No final candidate or completion claim follows from this partial gate.

Third fixture exception approved — sage-0813

packages/cli/tests/project.test.mjs:47 is a REWRITTEN LINE, not a pure addition. Only that original line changes: it declares a separate managementReads array and answers plugins with the full enabled-channel response while recording that read there. Every other verb keeps (listed.push(verb), []). Original lines48–51 are byte-identical, including deepEqual(listed,['project.list']). One new assertion immediately after original line51 requires managementReads=['plugins'], so skipping the settings read cannot pass. project-fixture-approved.patch shows the exact diff; project-fixture-scope-check.json records the byte comparison.

Sage approved this exception in sage-0813. Mos acknowledged the one-line rewrite in mos-0789, relayed by sage-0818; that landing wait is cleared, subject to Dewey's line-by-line check of this same hunk. The ack covers original line47 only, with the separately required one-read assertion after original line51. No rewrite may drop or weaken an assertion. If a fourth fixture needs changing, stop and send it to Sage for Mos's decision. Dewey reviews this third fixture file line by line alongside thread-cli.test.mjs and chat.test.mjs. The earlier proposed-project-fixture.patch remains a historical, unapplied proposal; the approved single-line rewrite above supersedes it.

Candidate now has 21 paths. No product source changed for this fix. project.test single, CLI package and all50 mutants await the next explicit slot grant. The other three package passes remain applicable; no test has run since the edit.

Mutant filter correction

Initial mutants01–11 killed. 12-directory-check survived because its test-name filter selected the missing-path cases, where later index checks also return missing. The already-written and package-green symlink-component test asserts the first unsafe component's refusal; it is the intended killer for removing component(nameDir,true). Corrected only the mutant's named filter to that test; no product or test source changed. Retained mutants-first.txt, mutants-first-results.json and directory-check-wrong-filter.log, then resume from12 with the original11 kills retained. Final results supersede the initial filtered-run survivor rather than hiding it.

Final verified results — sage-0820

Resume began at the time in resume-start.txt and ended with an empty cwd sweep at 2026-10-18T18:16:44Z. project.test.mjs passes 4/4, including the exact-once management read assertion. CLI package passes 247/247, including its unchanged fixture sandbox/PID-namespace cases. Existing unchanged-source package passes: plugins 77/77, bus 369/369, WebUI 182/182 (browser files included). Awk sum: 875/875, zero failure/cancelled/skipped. The project single is a subset rerun, not four additional package tests. No tracked flake or sandbox failure occurred.

Final mutants: 50/50 killed, zero invalid/timeout/survivor. mutants/results.json combines the first11 kills and the resumed12–50; mutants.txt is the complete final table. Initial filter-only survivor is preserved as described above. Every final mutant log names its intended failing test; see mutant-killers-verified.json. No candidate/test source changed to kill a mutant.

verify.py checked all21 worktree and staged hashes, reconstructed all21 paths from base+patch, and found no remaining cwd-scoped node/chromium process. No Docker/live action, sandbox policy or mount edit. Slot clear sent after the sweep. Source stays staged/uncommitted. All live enablement remains Jason's step in Mos's re-pin window; this packet never runs it.

Mos acknowledged the third fixture rewrite in mos-0789; Dewey must still audit all three fixture files line by line, including unchanged original lines48–51 in project.test and the new read-once assertion. A fourth fixture is not allowed without stopping for Sage/Mos. Row125 is still an overlapping future landing: if it lands first, rebase, preflight and final-gate again on that tree.

Final kill table

Mutant Owning test file Killing test prefix Result
01-kind-version packages/plugins/tests/channel.test.mjs channel registry requires KILLED
02-kind-switch packages/plugins/tests/channel.test.mjs channel registry requires KILLED
03-cli-forward-verb packages/plugins/tests/channel.test.mjs channel shipped modules load KILLED
04-webui-forward-verb packages/plugins/tests/channel.test.mjs channel shipped modules load KILLED
05-cli-forward-args packages/plugins/tests/channel.test.mjs channel shipped modules load KILLED
06-webui-forward-args packages/plugins/tests/channel.test.mjs channel shipped modules load KILLED
07-cli-filter packages/plugins/tests/channel.test.mjs channel shipped modules load KILLED
08-webui-filter packages/plugins/tests/channel.test.mjs channel shipped modules load KILLED
09-cli-result packages/plugins/tests/channel.test.mjs channel shipped modules load KILLED
10-webui-refusal packages/plugins/tests/channel.test.mjs channel shipped modules load KILLED
11-bad-name packages/plugins/tests/channel.test.mjs channel guards refuse bad names KILLED
12-directory-check packages/plugins/tests/channel.test.mjs channel guards refuse symlinked module, index and kind directories KILLED
13-index-check packages/plugins/tests/channel.test.mjs channel guards refuse bad names KILLED
14-symlink-check packages/plugins/tests/channel.test.mjs channel guards refuse symlinked KILLED
15-realpath-check packages/plugins/tests/channel.test.mjs channel last realpath check KILLED
16-export-check packages/plugins/tests/channel.test.mjs channel guards refuse bad names KILLED
17-function-check packages/plugins/tests/channel.test.mjs channel guards refuse bad names KILLED
18-version-check packages/plugins/tests/channel.test.mjs channel guards refuse bad names KILLED
19-snapshot-pair packages/plugins/tests/channel.test.mjs channel snapshot is KILLED
20-snapshot-array-freeze packages/plugins/tests/channel.test.mjs channel snapshot is KILLED
21-snapshot-entry-freeze packages/plugins/tests/channel.test.mjs channel snapshot is KILLED
22-snapshot-unknown packages/plugins/tests/channel.test.mjs channel snapshot is KILLED
23-constructor-name packages/plugins/tests/channel.test.mjs channel caller refuses invalid core KILLED
24-constructor-call packages/plugins/tests/channel.test.mjs channel caller refuses invalid core KILLED
25-settings-verb packages/plugins/tests/channel.test.mjs channel caller re-reads settings KILLED
26-settings-shape packages/plugins/tests/channel.test.mjs channel caller malformed settings KILLED
27-kind-isolation packages/plugins/tests/channel.test.mjs channel caller malformed settings KILLED
28-named-selection packages/plugins/tests/channel.test.mjs channel caller re-reads settings KILLED
29-absent-is-off packages/plugins/tests/channel.test.mjs channel caller re-reads settings KILLED
30-empty-is-off packages/plugins/tests/channel.test.mjs channel caller re-reads settings KILLED
31-settings-reread packages/plugins/tests/channel.test.mjs channel caller re-reads settings KILLED
32-last-good packages/plugins/tests/channel.test.mjs channel caller uses last good KILLED
33-dispatch-bypass packages/plugins/tests/channel.test.mjs channel caller invokes the selected loaded module KILLED
34-module-operation-filter packages/plugins/tests/channel.test.mjs channel caller keeps the selected module operation filter KILLED
35-cli-project packages/cli/tests/channel-cli.test.mjs CLI off, absent KILLED
36-cli-threads packages/cli/tests/channel-cli.test.mjs CLI off, absent KILLED
37-cli-thread packages/cli/tests/channel-cli.test.mjs CLI off, absent KILLED
38-cli-talk packages/cli/tests/channel-cli.test.mjs CLI off, absent KILLED
39-core-recovery packages/cli/tests/channel-recovery.test.mjs both channels off recover KILLED
40-cli-exit packages/cli/tests/channel-cli.test.mjs CLI off, absent KILLED
41-webui-bypass packages/webui/tests/channel-chat.test.mjs WebUI channel off returns KILLED
42-webui-error-envelope packages/webui/tests/channel-chat.test.mjs WebUI channel off returns KILLED
43-webui-status packages/webui/tests/channel-chat.test.mjs WebUI channel off returns KILLED
44-webui-reflection packages/webui/tests/channel-chat.test.mjs WebUI channel-disabled recovery text KILLED
45-proof-admission packages/bus/tests/channel-proof.test.mjs channel recovery still requires KILLED
46-proof-path packages/bus/tests/channel-proof.test.mjs channel recovery still requires KILLED
47-proof-bytes packages/bus/tests/channel-proof.test.mjs channel conversion preserves the four KILLED
48-dispatch-lock packages/plugins/tests/channel.test.mjs channel dispatch holds no selection lock KILLED
49-cli-recovery-text packages/cli/tests/channel-cli.test.mjs CLI off, absent KILLED
50-webui-recovery-text packages/webui/tests/channel-chat.test.mjs WebUI channel off returns KILLED