✔ isRunId accepts the run id shape and nothing else (1.680565ms)
✔ a missing data root or runs directory lists nothing (1.794757ms)
✔ runs as a regular file lists nothing, as before (0.731147ms)
✔ listRunIds keeps r- names only, sorted oldest first (0.864372ms)
✔ listRunRecords returns each result, or null for an incomplete or unreadable one (3.326643ms)
✔ readRunRecord returns documents and artifacts in directory order (1.783473ms)
✔ readRunRecord is null for a missing run, a dangling link or a file (1.188716ms)
✔ readRunRecord and readRunDocument refuse an invalid run id before touching the disk (1.093319ms)
✔ readRunDocument reads only the three run documents (0.846733ms)
✔ a link inside the data root is followed (1.17458ms)
✔ a data root that is itself a link is trusted as configured (0.781634ms)
✔ a run directory linked out of the data root is never read (0.777016ms)
✔ a document linked out of the data root reads as null (1.278597ms)
✔ a runs directory linked out of the data root refuses (0.649479ms)
✔ a relative link that climbs out of the data root refuses (0.502717ms)
✔ a sibling whose name starts with the data root's name is outside it (0.58152ms)
✔ a link loop refuses instead of reading as missing (0.775651ms)
✔ an unreadable runs directory refuses instead of listing nothing (0.659139ms)
✔ an unreadable run directory refuses instead of reading as missing (1.013293ms)
✔ a link to the data root's parent is outside it (0.653539ms)
✔ listRunIds sorts whatever order the directory returns (1.135619ms)
✔ the readers write nothing (2.823246ms)
✔ no pointer is null (2.918785ms)
✔ the pointer release.sh writes reads back (1.860026ms)
✔ a pointer that isn't the version 1 shape refuses with exit 2 (2.823183ms)
✔ a pointer that is a directory refuses with exit 4 (1.736666ms)
✔ a state file linked out of the data root refuses (1.677527ms)
✔ a state directory linked out of the data root refuses (0.987759ms)
✔ a missing log is empty (0.672303ms)
✖ the log reads oldest first and counts malformed lines (3.332551ms)
✔ last must be a positive integer (0.804321ms)
✔ the state readers write nothing (2.095782ms)
✔ list prints each run in the established format (98.447736ms)
✔ show prints the run in the established format (94.546953ms)
✔ show of a missing run and an invalid id exit 4 as before (141.127685ms)
✔ list and show refuse a runs directory linked out of the data root (186.311477ms)
✔ show refuses a run linked out of the data root; list reports it unknown (200.292033ms)
ℹ tests 37
ℹ suites 0
ℹ pass 36
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 810.059294

✖ failing tests:

test at packages/runs/tests/state.test.mjs:80:1
✖ the log reads oldest first and counts malformed lines (3.332551ms)
  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: 5
    }
  
      at TestContext.<anonymous> (file:///home/jwoltje/darkwing-scratch/r56a/mutwt/packages/runs/tests/state.test.mjs:102: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: 5 },
    expected: { entries: [ [Object], [Object] ], malformed: 5 },
    operator: 'deepStrictEqual',
    diff: 'simple'
  }
