✔ isRunId accepts the run id shape and nothing else (1.07446ms)
✔ a missing data root or runs directory lists nothing (9.100856ms)
✔ runs as a regular file lists nothing, as before (5.813261ms)
✔ listRunIds keeps r- names only, sorted oldest first (17.34251ms)
✔ listRunRecords returns each result, or null for an incomplete or unreadable one (1.86616ms)
✔ readRunRecord returns documents and artifacts in directory order (26.002078ms)
✔ readRunRecord is null for a missing run, a dangling link or a file (3.693151ms)
✔ readRunRecord and readRunDocument refuse an invalid run id before touching the disk (1.008653ms)
✔ readRunDocument reads only the three run documents (0.813628ms)
✔ a link inside the data root is followed (1.508103ms)
✔ a data root that is itself a link is trusted as configured (1.817532ms)
✔ a run directory linked out of the data root is never read (1.130005ms)
✔ a document linked out of the data root reads as null (22.199116ms)
✔ a runs directory linked out of the data root refuses (1.18345ms)
✔ a relative link that climbs out of the data root refuses (0.698018ms)
✔ a sibling whose name starts with the data root's name is outside it (0.773861ms)
✔ a link loop refuses instead of reading as missing (1.009039ms)
✔ an unreadable runs directory refuses instead of listing nothing (0.659472ms)
✔ an unreadable run directory refuses instead of reading as missing (0.692031ms)
✔ a link to the data root's parent is outside it (0.58212ms)
✔ listRunIds sorts whatever order the directory returns (1.167948ms)
✔ listRunRecords lists an r- name that isn't a valid run id, as before (0.76835ms)
✔ the readers write nothing (3.410202ms)
✔ no pointer is null (5.069465ms)
✔ the pointer release.sh writes reads back (6.698682ms)
✔ a pointer that isn't the version 1 shape refuses with exit 2 (48.474502ms)
✔ a pointer that is a directory refuses with exit 4 (1.375452ms)
✔ a state file linked out of the data root refuses (0.982791ms)
✔ a state directory linked out of the data root refuses (0.595852ms)
✔ a state directory linked out to nothing reads as no release and an empty log (0.475898ms)
✔ a missing log is empty (1.243422ms)
✖ the log reads oldest first and counts malformed lines (2.965998ms)
✔ last must be a positive integer (0.75225ms)
✔ the state readers write nothing (1.350016ms)
✔ list prints each run in the established format (78.922855ms)
✔ show prints the run in the established format (95.821873ms)
✔ show of a missing run and an invalid id exit 4 as before (127.675112ms)
✔ list and show refuse a runs directory linked out of the data root (177.883313ms)
✔ show refuses a run linked out of the data root; list reports it unknown (197.934639ms)
✔ list shows an r- name that isn't a valid run id, as before (99.346507ms)
✔ show refuses an invalid id before reading the config (67.610285ms)
ℹ tests 41
ℹ suites 0
ℹ pass 40
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 908.204283

✖ failing tests:

test at packages/runs/tests/state.test.mjs:87:1
✖ the log reads oldest first and counts malformed lines (2.965998ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
  + actual - expected
  
    {
      entries: [
        {
  +       at: '2026-09-03T20:57:00Z',
  +       event: 'package',
  +       imageTag: 'mosaic-poc-agent:0.84.4-r0.0.12',
  +       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'
        },
        {
  +       at: '2026-09-03T20:57:47Z',
  +       event: 'activate',
  +       imageTag: 'mosaic-poc-agent:0.84.4-r0.0.12',
  +       release: '0.0.12'
  -       at: '2026-09-03T20:58:15Z',
  -       event: 'rollback',
  -       imageTag: 'mosaic-poc-agent:0.84.4-r0.0.11',
  -       release: '0.0.11'
        }
      ],
      malformed: 7
    }
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56b/mutwt/packages/runs/tests/state.test.mjs:111: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] ], malformed: 7 },
    expected: { entries: [ [Object], [Object] ], malformed: 7 },
    operator: 'deepStrictEqual',
    diff: 'simple'
  }
