✔ isRunId accepts the run id shape and nothing else (1.849966ms)
✔ a missing data root or runs directory lists nothing (1.966701ms)
✔ runs as a regular file lists nothing, as before (1.044085ms)
✔ listRunIds keeps r- names only, sorted oldest first (1.404037ms)
✔ listRunRecords returns each result, or null for an incomplete or unreadable one (3.671713ms)
✔ readRunRecord returns documents and artifacts in directory order (1.978123ms)
✔ readRunRecord is null for a missing run, a dangling link or a file (1.320202ms)
✔ readRunRecord and readRunDocument refuse an invalid run id before touching the disk (1.202015ms)
✔ readRunDocument reads only the three run documents (0.982657ms)
✔ a link inside the data root is followed (1.840354ms)
✔ a data root that is itself a link is trusted as configured (1.271595ms)
✔ a run directory linked out of the data root is never read (1.363834ms)
✔ a document linked out of the data root reads as null (1.561635ms)
✔ a runs directory linked out of the data root refuses (0.727258ms)
✔ a relative link that climbs out of the data root refuses (0.670099ms)
✔ a sibling whose name starts with the data root's name is outside it (0.641573ms)
✔ a link loop refuses instead of reading as missing (0.934577ms)
✔ an unreadable runs directory refuses instead of listing nothing (0.850297ms)
✔ an unreadable run directory refuses instead of reading as missing (0.87724ms)
✔ a link to the data root's parent is outside it (0.770198ms)
✔ listRunIds sorts whatever order the directory returns (1.036885ms)
✔ the readers write nothing (3.831769ms)
✔ no pointer is null (2.316454ms)
✔ the pointer release.sh writes reads back (1.598365ms)
✔ a pointer that isn't the version 1 shape refuses with exit 2 (2.175811ms)
✔ a pointer that is a directory refuses with exit 4 (0.778144ms)
✔ a state file linked out of the data root refuses (2.517371ms)
✔ a state directory linked out of the data root refuses (0.870816ms)
✔ a missing log is empty (0.611372ms)
✖ the log reads oldest first and counts malformed lines (2.862969ms)
✔ last must be a positive integer (0.64267ms)
✔ the state readers write nothing (1.472105ms)
✔ list prints each run in the established format (103.761545ms)
✔ show prints the run in the established format (97.443115ms)
✔ show of a missing run and an invalid id exit 4 as before (161.288152ms)
✔ list and show refuse a runs directory linked out of the data root (176.117228ms)
✔ show refuses a run linked out of the data root; list reports it unknown (238.782496ms)
ℹ tests 37
ℹ suites 0
ℹ pass 36
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 865.082532

✖ failing tests:

test at packages/runs/tests/state.test.mjs:80:1
✖ the log reads oldest first and counts malformed lines (2.862969ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
  + actual - expected
  ... Skipped lines
  
    {
      entries: [
        {
          at: '2026-09-03T20:57:00Z',
          event: 'package',
  ...
        {
  +       at: '2026-09-03T20:57:47Z',
  +       event: 'activate',
  +       imageTag: 'mosaic-poc-agent:0.84.4-r0.0.12',
  +       note: null,
  +       release: '0.0.12'
  +     },
  +     {
          at: '2026-09-03T20:57:50Z',
          event: 'refused',
          imageTag: 'mosaic-poc-agent:0.84.4-r0.0.11',
          note: 'health check failed (fault-injected)',
          release: '0.0.11'
  ...
      ],
  +   malformed: 4
  -   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], [Object] ], malformed: 4 },
    expected: { entries: [ [Object], [Object], [Object], [Object] ], malformed: 5 },
    operator: 'deepStrictEqual',
    diff: 'simple'
  }
