Repository navigation
Commit bfc464a
authored
test(capture-kit): pin the ax1 digest wire format the daemon persists (#2941)
`computeAxDigest` returns a ~50-byte string that is persisted as post-action evidence and
compared across daemon restarts (#1047), yet nothing in the suite pinned the bytes. Every
test but two compared one invocation against another, so a change to the construction
moved both sides and the file stayed green.
Proven by mutant: deleting the NUL separators from `hashNode` — which makes the tuple
('ab', '', '') hash the same bytes as ('a', 'b', ''), i.e. two different trees reporting
identical evidence — leaves `ax-digest.test.ts` at 9 passed. It is the only cross-field
collision guard in the function and no test could see it go.
Three additions, each with a named mutant:
- field separation: ('ab','','') vs ('a','b','') vs ('a','','b') must differ.
Separator removal now fails 2 tests.
- fixed width: `ax1:` + exactly 16 hex, replacing the `startsWith('ax1:')` probe, which
a widened `slice()` or a dropped prefix would survive.
- a golden for a fixed 3-node set, so XOR width, separator placement, and the count
folding are all contract. Narrowing `PER_NODE_HASH_BYTES` to 8 fails only this one.
Test-only: no production line changes.1 parent 21d959e commit bfc464a
1 file changed
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
66 | 90 | | |
67 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
68 | 95 | | |
69 | 96 | | |
70 | 97 | | |
| |||
0 commit comments