Files
jason.woltje 4ff4f44c98 lead: commit researcher's untracked evidence (1406 files: queue-101 queue-105 queue-128 queue-134 queue-143 queue-148 queue-183 queue-228)
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:14 -06:00

38 lines
2.3 KiB
Diff

diff --git a/packages/webui/src/chat.mjs b/packages/webui/src/chat.mjs
index 2cf33ee78..018574ad4 100644
--- a/packages/webui/src/chat.mjs
+++ b/packages/webui/src/chat.mjs
@@ -1,11 +1,13 @@
-// Row 129: the single seam between Console chat operations and the current human transport.
+// Row 129: the single seam between Console chat operations and the bus transport it is given.
+// The signed-in listener passes the human transport (cli.mjs, `chat = createChat({ call })`); the row 176
+// tester listener passes the tester transport (row 177, `createChat({ call })` over TESTER_CLI).
// No browser-selected bus verb, tenant, owner, capability or message class crosses this seam.
import { createChannelCaller } from '../../plugins/src/channel.mjs';
import { PluginError } from '../../plugins/src/kinds.mjs';
import { BusReadError } from './bus.mjs';
export function createChat({ call }) {
- if (typeof call !== 'function') throw new TypeError('chat needs a human transport');
+ if (typeof call !== 'function') throw new TypeError('chat needs a bus transport function');
const dispatch = createChannelCaller({ name: 'webui', call });
const channel = async (verb, args) => {
try { return await dispatch(verb, args); }
diff --git a/packages/webui/tests/chat.test.mjs b/packages/webui/tests/chat.test.mjs
index 5b6611bb3..ab13e34c3 100644
--- a/packages/webui/tests/chat.test.mjs
+++ b/packages/webui/tests/chat.test.mjs
@@ -318,3 +318,12 @@ test('chat assets, GET purity, method and unknown-route refusals are explicit',
assert.equal((await c.get('/api/chat/projects', { method:'DELETE' })).status, 405);
assert.deepEqual(c.calls, []);
});
+
+test('the chat seam names the transport it is given: the human one and the tester one both pass, anything else is a TypeError', () => {
+ // Row 177 hands chat the tester transport too, so the refusal must not call it a human transport.
+ for (const call of [undefined, null, 'call', 42, {}, []]) {
+ assert.throws(() => createChat({ call }), err => err instanceof TypeError && err.message === 'chat needs a bus transport function', String(call));
+ }
+ assert.throws(() => createChat({}), { name: 'TypeError', message: 'chat needs a bus transport function' });
+ assert.equal(typeof createChat({ call: async () => ({}) }).projects, 'function');
+});