✔ isRunId accepts the run id shape and nothing else (1.054784ms)
✔ a missing data root or runs directory lists nothing (1.652336ms)
✔ runs as a regular file lists nothing, as before (0.551128ms)
✔ listRunIds keeps r- names only, sorted oldest first (1.225706ms)
✔ listRunRecords returns each result, or null for an incomplete or unreadable one (1.355194ms)
✔ readRunRecord returns documents and artifacts in directory order (0.964287ms)
✔ readRunRecord is null for a missing run, a dangling link or a file (0.660858ms)
✔ readRunRecord and readRunDocument refuse an invalid run id before touching the disk (0.691905ms)
✔ readRunDocument reads only the three run documents (0.56909ms)
✔ a link inside the data root is followed (0.880389ms)
✖ a data root that is itself a link is trusted as configured (0.699319ms)
✖ a run directory linked out of the data root is never read (1.673175ms)
✖ a document linked out of the data root reads as null (0.958721ms)
✖ a runs directory linked out of the data root refuses (0.510659ms)
✖ a relative link that climbs out of the data root refuses (0.603903ms)
✖ a sibling whose name starts with the data root's name is outside it (0.702796ms)
✔ a link loop refuses instead of reading as missing (0.614909ms)
✔ an unreadable runs directory refuses instead of listing nothing (0.453137ms)
✔ an unreadable run directory refuses instead of reading as missing (0.602137ms)
✖ a link to the data root's parent is outside it (0.550265ms)
✔ listRunIds sorts whatever order the directory returns (0.752446ms)
✔ listRunRecords lists an r- name that isn't a valid run id, as before (0.486875ms)
✔ the readers write nothing (2.072302ms)
✖ no pointer is null (1.751412ms)
✔ the pointer release.sh writes reads back (1.046095ms)
✔ a pointer that isn't the version 1 shape refuses with exit 2 (1.648482ms)
✔ a pointer that is a directory refuses with exit 4 (0.585862ms)
✖ a state file linked out of the data root refuses (1.759557ms)
✖ a state directory linked out of the data root refuses (0.604972ms)
✖ a state directory linked out to nothing reads as no release and an empty log (0.425196ms)
✖ a missing log is empty (0.475951ms)
✔ the log reads oldest first and counts malformed lines (0.961794ms)
✔ last must be a positive integer (0.506807ms)
✔ the state readers write nothing (0.83569ms)
✔ list prints each run in the established format (82.854009ms)
✔ show prints the run in the established format (77.561091ms)
✔ show of a missing run and an invalid id exit 4 as before (119.793186ms)
✖ list and show refuse a runs directory linked out of the data root (92.256203ms)
✖ show refuses a run linked out of the data root; list reports it unknown (80.040594ms)
✔ list shows an r- name that isn't a valid run id, as before (72.307362ms)
✔ show refuses an invalid id before reading the config (47.222817ms)
ℹ tests 41
ℹ suites 0
ℹ pass 27
ℹ fail 14
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 641.071641

✖ failing tests:

test at packages/runs/tests/runs.test.mjs:111:1
✖ a data root that is itself a link is trusted as configured (0.699319ms)
  Error [RunsError]: /home/jwoltje/darkwing-scratch/r56b/tmp/mosaic-runs-test-J1fCqk/alias/runs resolves outside the data root (/home/jwoltje/darkwing-scratch/r56b/tmp/mosaic-runs-test-J1fCqk/data)
      at resolveInside (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/src/paths.mjs:33:11)
      at listRunIds (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/src/runs.mjs:20:16)
      at listRunRecords (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/src/runs.mjs:44:10)
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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 (1.673175ms)
  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/r56b/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 (0.958721ms)
  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/r56b/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.510659ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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 (0.603903ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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 (0.702796ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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.550265ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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 (1.751412ms)
  Error [RunsError]: cannot read /home/jwoltje/darkwing-scratch/r56b/tmp/mosaic-runs-test-Hvm8Hi/data/state/active.json: ENOENT
      at readStateFile (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/src/state.mjs:21:11)
      at readActivePointer (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/src/state.mjs:29:17)
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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 (1.759557ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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 (0.604972ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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 state directory linked out to nothing reads as no release and an empty log (0.425196ms)
  Error [RunsError]: cannot read /home/jwoltje/darkwing-scratch/r56b/tmp/mosaic-runs-test-SAMKL6/data/state/active.json: ENOENT
      at readStateFile (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/src/state.mjs:21:11)
      at readActivePointer (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/src/state.mjs:29:17)
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/tests/state.test.mjs:78:16)
      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/state.test.mjs:82:1
✖ a missing log is empty (0.475951ms)
  Error [RunsError]: cannot read /home/jwoltje/darkwing-scratch/r56b/tmp/mosaic-runs-test-YDcaud/data/state/activation-log.jsonl: ENOENT
      at readStateFile (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/src/state.mjs:21:11)
      at readActivationLog (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/src/state.mjs:72:17)
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/tests/state.test.mjs:84: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 (92.256203ms)
  AssertionError [ERR_ASSERTION]: list
  
  0 !== 4
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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 (80.040594ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  
  0 !== 4
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/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'
  }
