✔ isRunId accepts the run id shape and nothing else (1.81005ms)
✔ a missing data root or runs directory lists nothing (3.788851ms)
✔ runs as a regular file lists nothing, as before (1.332528ms)
✔ listRunIds keeps r- names only, sorted oldest first (1.521814ms)
✔ listRunRecords returns each result, or null for an incomplete or unreadable one (4.886328ms)
✔ readRunRecord returns documents and artifacts in directory order (3.564755ms)
✔ readRunRecord is null for a missing run, a dangling link or a file (2.859036ms)
✔ readRunRecord and readRunDocument refuse an invalid run id before touching the disk (1.951484ms)
✔ readRunDocument reads only the three run documents (1.289383ms)
✔ a link inside the data root is followed (3.726081ms)
✔ a data root that is itself a link is trusted as configured (5.725889ms)
✔ a run directory linked out of the data root is never read (2.611536ms)
✔ a document linked out of the data root reads as null (2.941983ms)
✔ a runs directory linked out of the data root refuses (1.42401ms)
✔ a relative link that climbs out of the data root refuses (0.981488ms)
✔ a sibling whose name starts with the data root's name is outside it (1.093183ms)
✔ a link loop refuses instead of reading as missing (1.426419ms)
✔ an unreadable runs directory refuses instead of listing nothing (0.900191ms)
✔ an unreadable run directory refuses instead of reading as missing (1.392808ms)
✔ a link to the data root's parent is outside it (0.919184ms)
✔ listRunIds sorts whatever order the directory returns (1.382679ms)
✔ the readers write nothing (3.80633ms)
✔ no pointer is null (3.365628ms)
✔ the pointer release.sh writes reads back (2.160411ms)
✔ a pointer that isn't the version 1 shape refuses with exit 2 (4.729941ms)
✔ a pointer that is a directory refuses with exit 4 (2.975348ms)
✔ a state file linked out of the data root refuses (1.960951ms)
✔ a state directory linked out of the data root refuses (1.362152ms)
✔ a missing log is empty (0.915277ms)
✖ the log reads oldest first and counts malformed lines (4.787537ms)
✔ last must be a positive integer (1.174335ms)
✔ the state readers write nothing (8.296235ms)
✔ list prints each run in the established format (135.967139ms)
✔ show prints the run in the established format (126.514675ms)
✔ show of a missing run and an invalid id exit 4 as before (248.881535ms)
✔ list and show refuse a runs directory linked out of the data root (178.634661ms)
✔ show refuses a run linked out of the data root; list reports it unknown (318.758144ms)
ℹ tests 37
ℹ suites 0
ℹ pass 36
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 1106.083123

✖ failing tests:

test at packages/runs/tests/state.test.mjs:80:1
✖ the log reads oldest first and counts malformed lines (4.787537ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
  + actual - expected
  ... Skipped lines
  
    {
      entries: [
        {
          at: '2026-09-03T20:57:00Z',
          event: 'package',
  ...
      ],
  +   malformed: 6
  -   malformed: 5
    }
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/state.test.mjs:101: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: { entries: [ [Object], [Object], [Object], [Object] ], malformed: 6 },
    expected: { entries: [ [Object], [Object], [Object], [Object] ], malformed: 5 },
    operator: 'deepStrictEqual',
    diff: 'simple'
  }
