✔ isRunId accepts the run id shape and nothing else (2.337061ms)
✔ a missing data root or runs directory lists nothing (2.812348ms)
✔ runs as a regular file lists nothing, as before (0.989212ms)
✔ listRunIds keeps r- names only, sorted oldest first (1.36075ms)
✔ listRunRecords returns each result, or null for an incomplete or unreadable one (3.67149ms)
✔ readRunRecord returns documents and artifacts in directory order (2.491353ms)
✔ readRunRecord is null for a missing run, a dangling link or a file (1.899895ms)
✔ readRunRecord and readRunDocument refuse an invalid run id before touching the disk (1.568632ms)
✔ readRunDocument reads only the three run documents (1.626551ms)
✔ a link inside the data root is followed (1.731397ms)
✖ a data root that is itself a link is trusted as configured (1.465017ms)
✖ a run directory linked out of the data root is never read (3.090379ms)
✖ a document linked out of the data root reads as null (1.761344ms)
✖ a runs directory linked out of the data root refuses (0.967405ms)
✖ a relative link that climbs out of the data root refuses (1.918539ms)
✖ a sibling whose name starts with the data root's name is outside it (1.08471ms)
✔ a link loop refuses instead of reading as missing (1.050719ms)
✔ an unreadable runs directory refuses instead of listing nothing (0.697011ms)
✔ an unreadable run directory refuses instead of reading as missing (0.878691ms)
✖ a link to the data root's parent is outside it (0.945372ms)
✔ listRunIds sorts whatever order the directory returns (1.249209ms)
✔ the readers write nothing (2.766612ms)
✖ no pointer is null (3.426697ms)
✔ the pointer release.sh writes reads back (2.049083ms)
✔ a pointer that isn't the version 1 shape refuses with exit 2 (3.05565ms)
✔ a pointer that is a directory refuses with exit 4 (1.036013ms)
✖ a state file linked out of the data root refuses (2.970028ms)
✖ a state directory linked out of the data root refuses (2.142321ms)
✖ a missing log is empty (0.990974ms)
✔ the log reads oldest first and counts malformed lines (2.655752ms)
✔ last must be a positive integer (0.876981ms)
✔ the state readers write nothing (2.744ms)
✔ list prints each run in the established format (170.137522ms)
✔ show prints the run in the established format (120.109446ms)
✔ show of a missing run and an invalid id exit 4 as before (151.012044ms)
✖ list and show refuse a runs directory linked out of the data root (124.06692ms)
✖ show refuses a run linked out of the data root; list reports it unknown (140.926544ms)
ℹ tests 37
ℹ suites 0
ℹ pass 24
ℹ fail 13
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 811.148685

✖ failing tests:

test at packages/runs/tests/runs.test.mjs:111:1
✖ a data root that is itself a link is trusted as configured (1.465017ms)
  Error [RunsError]: /home/jwoltje/darkwing-scratch/r56a/tmp/mosaic-runs-test-4NH1n7/alias/runs resolves outside the data root (/home/jwoltje/darkwing-scratch/r56a/tmp/mosaic-runs-test-4NH1n7/data)
      at resolveInside (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/src/paths.mjs:33:11)
      at listRunIds (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/src/runs.mjs:20:16)
      at listRunRecords (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/src/runs.mjs:44:10)
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/runs.test.mjs:116:20)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    exitCode: 4
  }

test at packages/runs/tests/runs.test.mjs:119:1
✖ a run directory linked out of the data root is never read (3.090379ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
  + actual - expected
  
    [
      {
  +     result: {
  +       durationMs: 1000,
  +       exitCode: 0,
  +       expectedExact: null,
  +       finishedAt: '2026-01-01T00:00:01.000Z',
  +       missionId: null,
  +       model: 'm',
  +       provider: 'zai',
  +       reason: null,
  +       request: 'hi',
  +       response: 'hi',
  +       runId: 'r-20260101T000000Z-aaaaaa',
  +       runVersion: 1,
  +       session: null,
  +       sessionForkFrom: null,
  +       signal: null,
  +       startedAt: '2026-01-01T00:00:00.000Z',
  +       status: 'succeeded',
  +       taskId: 't-one',
  +       tools: null,
  +       workspace: null
  +     },
  -     result: null,
        runId: 'r-20260101T000000Z-aaaaaa'
      }
    ]
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/runs.test.mjs:125:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: [ { runId: 'r-20260101T000000Z-aaaaaa', result: [Object] } ],
    expected: [ { runId: 'r-20260101T000000Z-aaaaaa', result: null } ],
    operator: 'deepStrictEqual',
    diff: 'simple'
  }

test at packages/runs/tests/runs.test.mjs:129:1
✖ a document linked out of the data root reads as null (1.761344ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  + actual - expected
  
  + {
  +   durationMs: 1000,
  +   exitCode: 0,
  +   expectedExact: null,
  +   finishedAt: '2026-01-01T00:00:01.000Z',
  +   missionId: null,
  +   model: 'm',
  +   provider: 'zai',
  +   reason: null,
  +   request: 'hi',
  +   response: 'hi',
  +   runId: 'r-20260101T000000Z-aaaaaa',
  +   runVersion: 1,
  +   session: null,
  +   sessionForkFrom: null,
  +   signal: null,
  +   startedAt: '2026-01-01T00:00:00.000Z',
  +   status: 'succeeded',
  +   taskId: 't-one',
  +   tools: null,
  +   workspace: null
  + }
  - null
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/runs.test.mjs:137:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: { runVersion: 1, runId: 'r-20260101T000000Z-aaaaaa', taskId: 't-one', missionId: null, status: 'succeeded', reason: null, request: 'hi', response: 'hi', expectedExact: null, workspace: null, tools: null, session: null, sessionForkFrom: null, exitCode: 0, signal: null, provider: 'zai', model: 'm', startedAt: '2026-01-01T00:00:00.000Z', finishedAt: '2026-01-01T00:00:01.000Z', durationMs: 1000 },
    expected: null,
    operator: 'strictEqual',
    diff: 'simple'
  }

test at packages/runs/tests/runs.test.mjs:143:1
✖ a runs directory linked out of the data root refuses (0.967405ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/runs.test.mjs:147:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: undefined,
    expected: /runs resolves outside the data root/,
    operator: 'throws',
    diff: 'simple'
  }

test at packages/runs/tests/runs.test.mjs:152:1
✖ a relative link that climbs out of the data root refuses (1.918539ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/runs.test.mjs:156:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: undefined,
    expected: /resolves outside the data root/,
    operator: 'throws',
    diff: 'simple'
  }

test at packages/runs/tests/runs.test.mjs:159:1
✖ a sibling whose name starts with the data root's name is outside it (1.08471ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/runs.test.mjs:165:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: undefined,
    expected: /resolves outside the data root/,
    operator: 'throws',
    diff: 'simple'
  }

test at packages/runs/tests/runs.test.mjs:201:1
✖ a link to the data root's parent is outside it (0.945372ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/runs.test.mjs:205:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: undefined,
    expected: /resolves outside the data root/,
    operator: 'throws',
    diff: 'simple'
  }

test at packages/runs/tests/state.test.mjs:18:1
✖ no pointer is null (3.426697ms)
  Error [RunsError]: cannot read /home/jwoltje/darkwing-scratch/r56a/tmp/mosaic-runs-test-jLz66S/data/state/active.json: ENOENT
      at readStateFile (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/src/state.mjs:21:11)
      at readActivePointer (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/src/state.mjs:29:17)
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/state.test.mjs:20:16)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.start (node:internal/test_runner/test:1262:17)
      at startSubtestAfterBootstrap (node:internal/test_runner/harness:387:17) {
    exitCode: 4
  }

test at packages/runs/tests/state.test.mjs:57:1
✖ a state file linked out of the data root refuses (2.970028ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/state.test.mjs:64:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: undefined,
    expected: /resolves outside the data root/,
    operator: 'throws',
    diff: 'simple'
  }

test at packages/runs/tests/state.test.mjs:68:1
✖ a state directory linked out of the data root refuses (2.142321ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/state.test.mjs:72:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: undefined,
    expected: /state\/active.json resolves outside the data root/,
    operator: 'throws',
    diff: 'simple'
  }

test at packages/runs/tests/state.test.mjs:75:1
✖ a missing log is empty (0.990974ms)
  Error [RunsError]: cannot read /home/jwoltje/darkwing-scratch/r56a/tmp/mosaic-runs-test-2x3xPI/data/state/activation-log.jsonl: ENOENT
      at readStateFile (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/src/state.mjs:21:11)
      at readActivationLog (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/src/state.mjs:71:17)
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/state.test.mjs:77:20)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    exitCode: 4
  }

test at packages/runs/tests/task-cli.test.mjs:70:1
✖ list and show refuse a runs directory linked out of the data root (124.06692ms)
  AssertionError [ERR_ASSERTION]: list
  
  0 !== 4
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/task-cli.test.mjs:76:12)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: 0,
    expected: 4,
    operator: 'strictEqual',
    diff: 'simple'
  }

test at packages/runs/tests/task-cli.test.mjs:82:1
✖ show refuses a run linked out of the data root; list reports it unknown (140.926544ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  
  0 !== 4
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/task-cli.test.mjs:88:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: 0,
    expected: 4,
    operator: 'strictEqual',
    diff: 'simple'
  }
