Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
feat(shout): address item participants [B7,B21,B27,A2,N19]
Corey Olson3d8d27d1bd39
diff --git a/docs/formats.md b/docs/formats.mdindex 7cc0a2c2..f9b7a373 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -525,3 +525,5 @@ A row approved after the board’s compatibility baseline is reported as `agent-Engine 68 retains the existing validated verifier note in new acceptance-event detail. Earlier engines retain their original receipt shape; later person confirmations project current approval state beside that immutable history. No new row status or approval authority is inferred from a Git author or an unsigned receipt.The engine-68 `recordSpecApprovalBaseline` move carries `{agentId, baseline: {version: 1, file, anchor, rows: [{id, text, source}]}}`. `anchor` is the current commit or `null` before the first commit; exact source rows also cover uncommitted initial requirements. Only the authenticated coordinator may establish the snapshot; a person uses the main checkout’s coordinator path. Lane commands never seed or replace it. The first snapshot is indexed under `board_meta.spec_approval_baseline` with a `spec_approval_baseline` event. Replay writes metadata only, never checkout files. Sender attribution is authenticated normally, older engines refuse the new move, and later bootstrap attempts cannot replace or expand the original snapshot. No local sidecar establishes shared approval authority. The metadata snapshot must agree with its single original coordinator event; a partial restore with either half missing or changed is invalid. A malformed stored marker remains in place with an invalid-baseline diagnostic; it is not treated as an absent migration baseline or reseeded by later commands. Board imports remain trusted recovery operations; agreement of these records is a consistency check, not cryptographic authentication of an imported history.++Engine 93 adds item-addressed shouts. A shout move's optional `item` names an existing item; its event belongs to that item and includes the message text. Its canonical `shout_to` is `item:<id>`, read by the item's current builder and reviewer and the coordinator. Inbox, resume and seat watch use the same audience; an explicit seat or lane destination with `--item` still uses the item's audience. An item decision is answerable by its current participants or coordinator; replies stay in its thread and audience. The coordinator can still pass it to the person through the existing decision flow. Only the coordinator and person can broadcast `all`; recorded older-engine broadcasts retain their meaning. Main-checkout watch remains the person's board-wide observer. A joined seat's default watch filters shouts to its own address, lane, items and `all`, while ordinary lifecycle events remain visible.diff --git a/src/board.js b/src/board.jsindex c7db9cfb..e32ce322 100644--- a/src/board.js+++ b/src/board.js@@ -1,3 +1,10 @@+import { ITEM_SHOUT_ENGINE } from './item-shout-engine.js';+import {+ itemShoutTarget,+ itemShoutReader,+ shoutItemId,+ UNREAD_SHOUT_SQL,+} from './shout-audience.js';import { logEvent } from './board-event-log.js';export { logEvent };/**@@ -1881,10 +1888,20 @@ export function getItem(board, id) {* Insert a shout within the caller's transaction.** @param {any} board- * @param {{ from: string, to: string, text: string, lanes: string[], decision?: boolean, answers?: number | null, evidence?: any, request?: boolean, channel?: 'terminal' | 'view', detail?: object }} message - detail: extra event fields+ * @param {{ from: string, to: string, text: string, lanes: string[], item?: number, decision?: boolean, answers?: number | null, evidence?: any, request?: boolean, channel?: 'terminal' | 'view', detail?: object }} message - detail: extra event fields* @returns {number}*/-function insertShout(board, { from, to, text, lanes, decision = false, answers = null, evidence = null, request = false, channel = 'terminal', detail = {} }) {+function insertShout(board, { from, to, text, lanes, item, decision = false, answers = null, evidence = null, request = false, channel = 'terminal', detail = {} }) {+ const engine = board.executionEngineVersion ?? ENGINE_VERSION;+ if (item !== undefined) {+ if (engine < ITEM_SHOUT_ENGINE) throw new Refused('ENGINE_VERSION', 'item messages require engine 93; upgrade every linked device before sending one');+ to = itemShoutTarget(board.db, item);+ detail = { ...detail, item, text: text.trim() };+ }+ if (engine >= ITEM_SHOUT_ENGINE && to === 'all' && from !== COORDINATOR && from !== PERSON+ && board.db.prepare('SELECT 1 FROM agent WHERE agent_id = ?').get(from)) {+ throw new Refused('BROADCAST_FORBIDDEN', 'only the coordinator or person broadcasts; address an item with pullboard shout --item <id> \"text\", or name a seat');+ }if (!text.trim()) throw new Refused('EMPTY_SHOUT', 'a shout needs text');if (to === from) throw new Refused('SELF_SHOUT', `a shout cannot be addressed to its sender ${from}; name another agent, a lane or all`);if (request && (from !== 'person' || to !== COORDINATOR || decision || answers !== null)) {@@ -1893,7 +1910,7 @@ function insertShout(board, { from, to, text, lanes, decision = false, answers =const ask = answers === null ? null : getShout(board, answers);const isAgent = board.db.prepare('SELECT 1 FROM agent WHERE agent_id = ?').get(to);const requestReply = ask?.shout_request && to === ask.shout_from;- if (to !== 'all' && to !== PERSON && !lanes.includes(to) && !isAgent && !requestReply) {+ if (item === undefined && to !== 'all' && to !== PERSON && !lanes.includes(to) && !isAgent && !requestReply) {throw new Refused('NO_READER', `nobody reads "${to}": name a lane, an agent or all`);}if (to === PERSON && decision && from !== COORDINATOR) {@@ -1933,7 +1950,7 @@ function persistShout(board, { from, to, text, decision = false, answers = null,).run(from, to, text.trim(), now(board), decision ? 1 : 0, answers, evidence?.kind ?? null, evidence ? evidence.outcome.trim() : null, evidence?.item ?? null, evidence?.commit ?? null, request ? 1 : 0, outcome);const id = Number(result.lastInsertRowid);- logEvent(board, from, answers === null ? 'shout' : decision ? 'pass' : 'answer', null, { shout: id, to, decision: Boolean(decision), request: Boolean(request), answers, ...(outcome ? { outcome } : {}), ...(personAnswer ? { channel } : {}), ...detail });+ logEvent(board, from, answers === null ? 'shout' : decision ? 'pass' : 'answer', detail.item ?? null, { shout: id, to, decision: Boolean(decision), request: Boolean(request), answers, ...(outcome ? { outcome } : {}), ...(personAnswer ? { channel } : {}), ...detail });return id;}@@ -1941,7 +1958,7 @@ function persistShout(board, { from, to, text, decision = false, answers = null,* Shout to a lane, an agent, `all`, or the person (B7, B25, B26). The caller passes declared lanes.** @param {any} board- * @param {{ from: string, to: string, text: string, lanes: string[], decision?: boolean, answers?: number | null, evidence?: any, request?: boolean, channel?: 'terminal' | 'view' }} message+ * @param {{ from: string, to: string, text: string, lanes: string[], item?: number, decision?: boolean, answers?: number | null, evidence?: any, request?: boolean, channel?: 'terminal' | 'view' }} message* @returns {number}*/export function shout(board, message) {@@ -1999,11 +2016,11 @@ export function passDecision(board, id, { agentId, note, lanes }) {return atomic(board, () => {if (agentId !== COORDINATOR) throw new Refused('COORDINATOR_ONLY', 'only the coordinator can pass a decision up');const ask = getShout(board, id);- if (!ask.shout_decision || ask.shout_to !== COORDINATOR) throw new Refused('NOT_COORDINATOR_DECISION', `shout #${id} is not a decision waiting for the coordinator`);+ if (!ask.shout_decision || (ask.shout_to !== COORDINATOR && shoutItemId(ask.shout_to) === null)) throw new Refused('NOT_COORDINATOR_DECISION', `shout #${id} is not a decision waiting for the coordinator`);if (board.db.prepare('SELECT 1 FROM shout WHERE shout_answers = ?').get(id)) throw new Refused('ALREADY_ANSWERED', `shout #${id} already has an answer`);const text = `Passed up from ${ask.shout_from}: ${ask.shout_text}\nCoordinator note: ${String(note ?? '').trim()}`;if (!String(note ?? '').trim()) throw new Refused('EMPTY_NOTE', 'include a note with the reason for passing this decision');- return insertShout(board, { from: COORDINATOR, to: PERSON, text, lanes, decision: true, answers: id });+ return insertShout(board, { from: COORDINATOR, to: PERSON, text, lanes, decision: true, answers: id, detail: shoutItemId(ask.shout_to) === null ? {} : { item: shoutItemId(ask.shout_to), text } });});}@@ -2029,16 +2046,18 @@ export function answerDecision(board, id, { agentId, text, lanes, asPerson = falif (!asPerson && ask.shout_to === PERSON && agentId === COORDINATOR) throw new Refused('B26_PERSON_ANSWER', `this decision is addressed to the person; answer from the main checkout: pullboard answer ${id} "<answer>" --as person`);const personAnswer = asPerson;const caller = personAnswer ? null : board.db.prepare('SELECT agent_lane FROM agent WHERE agent_id = ?').get(agentId);- const ownsDecision = ask.shout_to === agentId || ask.shout_to === caller?.agent_lane;+ const addressedItem = shoutItemId(ask.shout_to);+ const ownsDecision = ask.shout_to === agentId || ask.shout_to === caller?.agent_lane+ || (addressedItem !== null && itemShoutReader(board.db, addressedItem, agentId));if (!ownsDecision && !personAnswer) {const lane = caller?.agent_lane ? `your ${caller.agent_lane} lane` : 'a lane you do not belong to';throw new Refused('NOT_YOUR_DECISION', `shout #${id} is addressed to ${ask.shout_to}, not ${lane} (agent ${agentId})`);}const from = personAnswer ? PERSON : agentId;- const answerId = tellAnswerImplications(board, (by, itemId, fact) => logEvent(board, by, 'fact', itemId, fact), insertShout(board, { from, to: ask.shout_from, text, lanes, answers: id, channel, detail: { ...(implies?.length ? { implies } : {}), ...(supersedes !== null ? { supersedes } : {}) } }), { seed: impliesId, implies, supersedes, from, person: PERSON });+ const answerId = tellAnswerImplications(board, (by, itemId, fact) => logEvent(board, by, 'fact', itemId, fact), insertShout(board, { from, to: ask.shout_from, text, lanes, answers: id, channel, ...(addressedItem === null ? {} : { item: addressedItem }), detail: { ...(implies?.length ? { implies } : {}), ...(supersedes !== null ? { supersedes } : {}) } }), { seed: impliesId, implies, supersedes, from, person: PERSON });if (personAnswer && ask.shout_answers !== null) {const original = getShout(board, ask.shout_answers);- insertShout(board, { from: PERSON, to: original.shout_from, text: `Person answered #${id}: ${String(text).trim()}`, lanes, answers: original.shout_id, channel });+ insertShout(board, { from: PERSON, to: original.shout_from, text: `Person answered #${id}: ${String(text).trim()}`, lanes, answers: original.shout_id, channel, ...(shoutItemId(original.shout_to) === null ? {} : { item: shoutItemId(original.shout_to) }) });}return answerId;});@@ -2107,10 +2126,8 @@ export function openDecisions(board, recipient = null) {}const recipients = [...new Set(Array.isArray(recipient) ? recipient : [recipient])];if (!recipients.length) return [];- const marks = recipients.map(() => '?').join(', ');- return board.db- .prepare(`SELECT * FROM shout ask WHERE ask.shout_decision = 1 AND ask.shout_to IN (${marks}) AND NOT EXISTS (SELECT 1 FROM shout reply WHERE reply.shout_answers = ask.shout_id) ORDER BY ask.shout_id`)- .all(...recipients);+ return openDecisions(board).filter((ask) => recipients.includes(ask.shout_to)+ || (shoutItemId(ask.shout_to) !== null && recipients.some((agent) => itemShoutReader(board.db, shoutItemId(ask.shout_to), agent))));}/** Requests remain visible to the coordinator until a done or declined answer closes them (A2). */@@ -2121,9 +2138,9 @@ export function openRequests(board) {}/**- * The SQL that picks an agent's unread shouts: to it, to its lane, or to all, from anyone else.+ * The SQL that picks an agent's unread shouts: its seat, lane, item roles or all, from anyone else.*/-const UNREAD_SQL = `FROM shout WHERE shout_id > ? AND shout_from != ? AND shout_to IN ('all', ?, ?)`;+const UNREAD_SQL = UNREAD_SHOUT_SQL;/*** Unread shouts for an agent, oldest first, then marked read.diff --git a/src/commands/shout.js b/src/commands/shout.jsindex 1c1d5dc7..ba71893b 100644--- a/src/commands/shout.js+++ b/src/commands/shout.js@@ -23,9 +23,9 @@ export async function run(io, { first, second, rest, values }) {const evidence = values.evidence === undefined ? null : evidenceFrom(ctx, values);const recipients = ['all', 'person', ...laneNames(ctx.config), ...board.db.prepare('SELECT agent_id FROM agent').all().map((agent) => agent.agent_id)];const hasRecipient = first && recipients.includes(first);- const to = hasRecipient ? first : values.decision ? (me.id === COORDINATOR ? 'person' : COORDINATOR) : first ?? '';+ const to = values.item !== undefined ? `item:${values.item}` : hasRecipient ? first : values.decision ? (me.id === COORDINATOR ? 'person' : COORDINATOR) : first ?? '';const text = [hasRecipient ? second : first, ...(hasRecipient ? rest : [second, ...rest])].filter(Boolean).join(' ');- const id = await ordered(ctx, board, 'shout', [{ from: personShout(io, me) ? store.PERSON : me.id, to, text, lanes: laneNames(ctx.config), decision: Boolean(values.decision), evidence }]);+ const id = await ordered(ctx, board, 'shout', [{ from: personShout(io, me) ? store.PERSON : me.id, to, text, ...(values.item !== undefined ? { item: Number(values.item) } : {}), lanes: laneNames(ctx.config), decision: Boolean(values.decision), evidence }]);io.result?.({ id, decision: Boolean(values.decision) });const agents = store.listAgents(board);const recipient = agents.some((agent) => agent.agent_id === to) ? agentDisplayName(agents, ctx.config, to) : to;diff --git a/src/engine.js b/src/engine.jsindex be957778..2f0cdace 100644--- a/src/engine.js+++ b/src/engine.js@@ -1,3 +1,4 @@+import { ITEM_SHOUT_ENGINE } from './item-shout-engine.js';/** Versioned, deterministic replay through the CLI's existing board engine [H3,H16]. */import {createHash,@@ -98,6 +99,7 @@ function minimumOperationEngine(operation, args, board, at) {const id = operation === 'recordLandingBatch' ? args[0]?.batch?.id : args[0]?.id;if (store.landingBatches(board).some(batch => batch.id === id && carriesLandingEnvironment(batch))) return LANDING_ENVIRONMENT_ENGINE;}+ if (operation === 'shout' && args[0]?.item !== undefined) return ITEM_SHOUT_ENGINE;if (operation === 'landingLeaseMove' || args[0]?.landingFence !== undefined) return LANDING_LEASE_ENGINE;if (['verify', 'reopen'].includes(operation) && args[1]?.reopenFirstRefusalMinutes !== undefined|| ['claim', 'release'].includes(operation) && board && firstRefusal(board, args[0], at)) return REOPEN_FIRST_REFUSAL_ENGINE;diff --git a/src/help.js b/src/help.jsindex 9b6e5ae5..4ecd7615 100644--- a/src/help.js+++ b/src/help.js@@ -131,6 +131,7 @@ Worka verdict takes --implies <ids>; a later verdict on the item supersedes itany --note can be --note-file <file>, which keeps quotes, $ and backticks intactpullboard shout <lane|agent|person|all> <text> pullboard inbox+ pullboard shout --item <id> <text> message the item builder, reviewer and coordinatorpullboard shout [<to>] <text> --decision ask for a decision; defaults to your coordinator or the personpullboard shout <to> <text> --evidence attempt|receipt --outcome <word> --item <id> --commit <rev>pullboard answer <shout-id> <text> [--as person] [--implies <ids>] [--supersedes <answer-id>]diff --git a/src/item-shout-engine.js b/src/item-shout-engine.jsnew file mode 100644index 00000000..2ca8b4d2--- /dev/null+++ b/src/item-shout-engine.js@@ -0,0 +1,2 @@+/** The engine where item shouts reach their participants and agent broadcasts are refused [B7,N19]. */+export const ITEM_SHOUT_ENGINE = 93;diff --git a/src/next-steps.js b/src/next-steps.jsindex b5d879ae..eb6f8e4c 100644--- a/src/next-steps.js+++ b/src/next-steps.js@@ -284,6 +284,8 @@ export const NEXT_STEPS = Object.freeze({FIT_TARGET: 'pick a target the message lists, or read the waiting batch with pullboard spec fit',NO_FIT_PROPOSALS: 'have a seat record proposals with pullboard blueprint fit <name or file> <target> keep|adapt|drop|answer',EMPTY_NOTE: 'say why: pullboard pass <id> --note "<reason>"',+ BAD_SHOUT_ITEM: 'name an existing positive item: pullboard shout --item <id> "<text>"',+ BROADCAST_FORBIDDEN: 'address the people on an item: pullboard shout --item <id> "<text>"',EMPTY_SHOUT: 'give the shout text: pullboard shout <to> "<text>"',EMPTY_SIGNERS: 'restore the signer list from Git: git restore --source=HEAD -- .pullboard/signers',ENGINE_VERSION: 'upgrade Pullboard: npm install -g pullboard@latest',diff --git a/src/shout-audience.js b/src/shout-audience.jsnew file mode 100644index 00000000..7a347463--- /dev/null+++ b/src/shout-audience.js@@ -0,0 +1,36 @@+/** Shared item-message addressing for the board's inbox, resume and live watch [B7,N19,A2]. */+import { Refused } from './refused.js';++/** Validate an explicit item address against this board before writing its message. */+export function itemShoutTarget(db, value) {+ if (!Number.isSafeInteger(value) || value < 1) throw new Refused('BAD_SHOUT_ITEM', 'an item message needs an existing positive item id; run pullboard shout --item <id> "text"');+ if (!db.prepare('SELECT 1 FROM item WHERE item_id = ?').get(value)) throw new Refused('NO_ITEM', `no item #${value}; run pullboard list, then address an existing item`);+ return `item:${value}`;+}++/** Decode only the canonical item address; ordinary seats and lanes keep their old names. */+export function shoutItemId(to) {+ const match = /^item:([1-9]\d*)$/u.exec(String(to));+ const id = match ? Number(match[1]) : null;+ return Number.isSafeInteger(id) ? id : null;+}++/** Whether a seat currently builds or reviews this item, or coordinates its work. */+export function itemShoutReader(db, id, agent) {+ const item = db.prepare('SELECT item_owner, item_built_by, item_review_by, item_verified_by FROM item WHERE item_id = ?').get(id);+ return Boolean(item && (agent === 'coordinator' || (item.item_owner ?? item.item_built_by) === agent+ || (item.item_review_by ?? item.item_verified_by) === agent));+}++/** Match one live shout against an explicit seat or lane audience, including its item roles. */+export function shoutMatchesAudience(db, to, audience) {+ if (audience.has(to)) return true;+ const item = shoutItemId(to);+ if (item === null) return false;+ return [...audience].some((agent) => itemShoutReader(db, item, agent));+}++/** Existing four inbox parameters stay cursor, seat, lane, seat; indexed parameters reuse the seat identity. */+export const UNREAD_SHOUT_SQL = `FROM shout WHERE shout_id > ?1 AND shout_from != ?2 AND+ (shout_to IN ('all', ?3, ?4) OR EXISTS (SELECT 1 FROM item WHERE shout_to = 'item:' || item_id AND+ (?2 = 'coordinator' OR COALESCE(item_owner, item_built_by) = ?2 OR COALESCE(item_review_by, item_verified_by) = ?2)))`;diff --git a/src/watch.js b/src/watch.jsindex d77a106c..defa74d8 100644--- a/src/watch.js+++ b/src/watch.js@@ -1,3 +1,4 @@+import { shoutMatchesAudience } from './shout-audience.js';/*** pullboard watch: follow the board's own live event stream and print one line per event [A2,N26].*@@ -82,7 +83,7 @@ function readBoard(file, read) {export function watchStart(file) {return readBoard(file, (db) => ({id: db.prepare('SELECT meta_value FROM board_meta WHERE meta_key = ?').get('board_id').meta_value,- agents: db.prepare('SELECT agent_id, agent_lane FROM agent').all(),+ agents: db.prepare('SELECT agent_id, agent_lane, agent_path FROM agent').all(),sequence: db.prepare('SELECT COALESCE(MAX(event_id), 0) AS id FROM event').get().id,}));}@@ -217,7 +218,8 @@ export async function followBoard({ file, mainRoot, commonDir, config, isMain, r/** Whether an event passes the --kinds, --item and --to filters. */const wanted = (event, to) => (!options.kinds || options.kinds.has(event.event_kind))&& (options.item === null || event.item_id === options.item)- && (!options.to || (SHOUT_KINDS.has(event.event_kind) && options.to.has(to)));+ && (!options.to || (options.seatDefault && !SHOUT_KINDS.has(event.event_kind))+ || (SHOUT_KINDS.has(event.event_kind) && readBoard(file, (db) => shoutMatchesAudience(db, to, options.to))));let work = null;let mainHead = null;@@ -325,6 +327,12 @@ export async function watchCommand({ io, values, words, ctx, primaryCheckoutRootif (words.some((word) => word !== undefined)) throw new Refused('USAGE', 'pullboard watch takes flags only, such as pullboard watch --to core; run pullboard help watch');const start = watchStart(file);const options = watchOptions(values, { config, agents: start.agents });+ // The person's main-checkout stream remains the board-wide observer; a joined seat follows its own audience.+ const seat = !isMain && start.agents.find((agent) => agent.agent_path === info.root);+ if (seat && values.to === undefined) {+ options.to = new Set(['all', seat.agent_id, seat.agent_lane]);+ options.seatDefault = true;+ }const abort = new AbortController();const stop = () => abort.abort();process.once('SIGINT', stop);diff --git a/test/board.test.js b/test/board.test.jsindex ccba134b..691d78d4 100644--- a/test/board.test.js+++ b/test/board.test.js@@ -569,12 +569,13 @@ test('shouts reach a lane, an agent or all; inbox marks them read [B7]', () => {const lanes = ['coordinator', 'web', 'api'];store.shout(board, { from: 'coordinator', to: 'web', text: 'web: rebase', lanes });store.shout(board, { from: 'api-1', to: 'web-2', text: 'web-2: schema changed', lanes });- store.shout(board, { from: 'web-1', to: 'all', text: 'all: gate is slow', lanes });+ assert.throws(() => store.shout(board, { from: 'web-1', to: 'all', text: 'all: gate is slow', lanes }), /BROADCAST_FORBIDDEN/);+ store.shout(board, { from: 'coordinator', to: 'all', text: 'all: gate is slow', lanes });assert.throws(() => store.shout(board, { from: 'web-1', to: 'nobody', text: 'x', lanes }), /NO_READER/);assert.equal(store.unreadCount(board, 'web-2'), 3);assert.deepEqual(store.inbox(board, 'web-2').map((shout) => shout.shout_text), ['web: rebase', 'web-2: schema changed', 'all: gate is slow']);assert.equal(store.unreadCount(board, 'web-2'), 0);- assert.deepEqual(store.inbox(board, 'web-1').map((shout) => shout.shout_text), ['web: rebase']);+ assert.deepEqual(store.inbox(board, 'web-1').map((shout) => shout.shout_text), ['web: rebase', 'all: gate is slow']);});test('a shout can ask for a decision; it stays open until someone answers it [B21]', () => {@@ -1487,3 +1488,28 @@ test('direct branch board opens preserve shared DDL while private databases stilconst { assertDirectOpenBoardIsolation } = await import('./direct-open-board-regression.js');assertDirectOpenBoardIsolation(t, fileURLToPath(new URL('..', import.meta.url)));});+++test('item decisions authorize participants, retain their thread and can pass to the person [B7,B21,B27]', () => {+ const lanes = ['coordinator', 'web', 'api'];+ const id = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Item decision' });+ claimAs(id, 'web-1', 'web');+ const ask = store.shout(board, { from: 'api-1', to: 'web', item: id, text: 'Choose the item direction', lanes, decision: true });+ assert.deepEqual(store.openDecisions(board, 'web-1').map(row => row.shout_id), [ask]);+ assert.deepEqual(store.openDecisions(board, 'web-2'), []);+ assert.throws(() => store.answerDecision(board, ask, { agentId: 'web-2', text: 'No standing', lanes }), /NOT_YOUR_DECISION/);+ const answer = store.answerDecision(board, ask, { agentId: 'web-1', text: 'Use the agreed direction', lanes });+ assert.equal(store.getShout(board, answer).shout_to, `item:${id}`);+ assert.equal(store.events(board, { itemId: id }).at(-1).event_kind, 'answer');+ assert.deepEqual(store.openDecisions(board, 'coordinator'), []);+ const second = store.shout(board, { from: 'web-1', to: 'coordinator', item: id, text: 'Person choice', lanes, decision: true });+ const passed = store.passDecision(board, second, { agentId: 'coordinator', note: 'Needs the person', lanes });+ assert.equal(store.getShout(board, passed).shout_to, 'person');+ store.answerDecision(board, passed, { agentId: 'coordinator', asPerson: true, text: 'Person chose', lanes });+ assert.equal(store.events(board, { itemId: id }).at(-1).event_kind, 'answer');+ assert.deepEqual(store.openDecisions(board), []);+ for (const item of [0, -1, 1.5, NaN, Number.MAX_SAFE_INTEGER + 1]) {+ assert.throws(() => store.shout(board, { from: 'web-1', to: 'web', item, text: 'invalid', lanes }), /BAD_SHOUT_ITEM/);+ }+ assert.throws(() => store.shout(board, { from: 'web-1', to: 'web', item: id + 1000, text: 'missing', lanes }), /NO_ITEM/);+});diff --git a/test/engine.test.js b/test/engine.test.jsindex 9fe2af2d..a08932a7 100644--- a/test/engine.test.js+++ b/test/engine.test.js@@ -110,7 +110,7 @@ test('authenticated relay senders bind every move and refusals preserve replicaassert.deepEqual(claimOne, claimTwo);assert.equal(store.getItem(one, item).item_owner, 'web-1');- const shout = prepareEngineMove(one, 'shout', [{ from: 'web-1', to: 'all', text: 'authenticated fixture', lanes: ['web'] }], { id: 'valid-shout-after-refusals' });+ const shout = prepareEngineMove(one, 'shout', [{ from: 'web-1', to: 'coordinator', text: 'authenticated fixture', lanes: ['web'] }], { id: 'valid-shout-after-refusals' });const shoutOne = applyRelayMove(one, shout, { sequence: cases.length + 2, at: CLAIM_AT, kind: 'move', sender: agent });const shoutTwo = applyRelayMove(two, shout, { sequence: cases.length + 2, at: CLAIM_AT, kind: 'move', sender: agent });assert.deepEqual(shoutOne, shoutTwo);@@ -679,3 +679,19 @@ test('a feature engine or command file name outside letters, digits, underscoreassert.deepEqual(discovered(['index.js', 'add.js', 'two-words.js'], COMMAND_CANDIDATE, COMMAND_FILE, 'command'), ['add.js', 'two-words.js']);assert.throws(() => discovered(['index.js', 'add.js', 'a.b.js'], COMMAND_CANDIDATE, COMMAND_FILE, 'command'), /a\.b\.js cannot be a command/u, 'a dotted command file is refused by name');});+++test('engine 93 item messages replay and older broadcasts keep their recorded meaning [B7,H3,H16]', (t) => {+ const { copies, item } = engineCopies(t);+ const [one, two] = copies;+ const legacy = { ...prepareEngineMove(one, 'shout', [{ from: 'web-1', to: 'all', text: 'old broadcast', lanes: ['web'] }]), engine: 92 };+ for (const board of copies) applyEngineMove(board, legacy, { sequence: 1, at: CLAIM_AT });+ assert.equal(store.inbox(one, 'web-2')[0].shout_text, 'old broadcast');+ const message = prepareEngineMove(one, 'shout', [{ from: 'web-1', to: 'web', item, text: 'item message', lanes: ['web'] }]);+ assert.throws(() => applyEngineMove(two, { ...message, engine: 92 }, { sequence: 2, at: CLAIM_AT }), /RELAY_MOVE/);+ const first = applyEngineMove(one, message, { sequence: 2, at: CLAIM_AT });+ const second = applyEngineMove(two, message, { sequence: 2, at: CLAIM_AT });+ assert.deepEqual(first, second);+ assert.equal(store.getShout(one, first.result).shout_to, `item:${item}`);+ assert.equal(store.getShout(two, second.result).shout_to, `item:${item}`);+});