Files
stack/agents/gizmoduck/work/queue-302/ASSERTION-PRESERVATION.md

3.9 KiB

Row 302 (#1809): assertion preservation

Base 0e30a85fa. git diff 0e30a85fa -- 'packages/*/tests/*' on an existing file changes four lines and nothing else. Each one is ruled by Mos (mos-1414, amended by mos-1415 and mos-1416, relayed in sage-3206, sage-3209 and sage-3210). No assertion is removed or loosened. Each one now pins the new code or exit for the same call.

1. packages/bus/tests/threads.test.mjs:394 (mos-1414 a)

Old:

  assert.throws(() => call('a', 'message.receive'), { code: 'not-holder' });

New:

  assert.throws(() => call('a', 'message.receive'), { code: 'launcher-released' });

:392 (threadIdle's own second refusal, not-holder) and :395 (the pending check) are unchanged.

2. packages/harness/tests/runner.test.mjs:771 (mos-1415)

Old:

  assert.equal(out.code, EXIT.session, out.stderr);

New:

  assert.equal(out.code, 0, out.stderr);

out.stderr stays as the message.

3. packages/harness/tests/runner.test.mjs:772 (mos-1415)

Old:

  assert.match(out.stderr, new RegExp(`runner: landing turn 1 for decision ${d1.id} \\(vikunja:1/2\\): ok\n[\\s\\S]*runner: session stopped working: not-holder\n`));

New:

  assert.match(out.stderr, new RegExp(`runner: landing turn 1 for decision ${d1.id} \\(vikunja:1/2\\): ok\n[\\s\\S]*runner: session released by the launcher\n`));

Only the last line of the pattern changes. The landing-turn part is the same, word for word.

4. packages/bus/tests/land.test.mjs:464 (mos-1416)

Old:

  assert.throws(() => w.call('merge-gate', 'message.receive'), /not-holder/);

New:

  assert.throws(() => w.call('merge-gate', 'message.receive'), /launcher-released/);

:457, :463 and :466 are unchanged.

The not-holder grep, rerun on the build (mos-1414)

git grep -n "not-holder\|session stopped working\|session-invalid" over packages/cli, seat and harness tests and scripts/, outside the new files:

  • runner.test.mjs:558, session stopped working: unauthenticated. Not a release. Stays.
  • runner.test.mjs:628 (a comment) and :647, the limit stop. The limit revoke isn't threadIdle or landRelease, so it stays not-holder and exit 22 (Dewey Q3).
  • session.test.mjs:116, a list of end reasons. No call.

In packages/bus/tests, only end-launch, land and threads call threadIdle or landRelease. Their other not-holder pins: end-launch:198, threads:383-385 and :392, land:457 and :463 are the ops' own refusals. threads:493 follows assistant.stop. threads:416 releases a2-run as the test's last line. The fix reaches none of them, so no hit goes to Mos.

5. packages/bus/tests/launcher-released.test.mjs:89, a new test's own line (d6, sage-3294, Mos ruling sage-3293)

This file is new in row 302, so nothing at the base changes. The line changed between the pushed tests commit f799e8b15 and d6, after the first gate run went red on it (gizmoduck-0388). It's recorded here because the change narrows what the line counts.

Old:

  assert.equal(store.get('SELECT count(*) AS n FROM deliveries WHERE message=?', later.id).n, 0, 'nothing delivered to the released run');

New:

  assert.equal(store.get('SELECT count(*) AS n FROM deliveries WHERE message=? AND holder_run=?', later.id, 'a-run').n, 0, 'nothing delivered to the released run');
  assert.deepEqual(store.all('SELECT op, holder_run FROM deliveries WHERE message=?', later.id).map((r) => ({ ...r })), [{ op: 'routed', holder_run: null }]);

The old line counted every delivery row for the message. #route (broker.mjs:6482) writes one routed row for each message, and #recipient (:832-834) gives it holder_run null when no run holds the role. After threadIdle no run holds thread A, so the count was 1, with no row for a-run. The first new line keeps the claim it was meant to make: no row names the released run. The second pins the whole set, one routed row held by nobody. That is tighter than the old line on everything except the null-holder row, which it requires.