Repository navigation
🌱 test(sanitize): pin each stripTerminalEscapes recogniser with a direct assertion - #411
Conversation
…ect assertion The nightly advisory Stryker run left 8 mutants alive in sanitize.ts, 7 of them Regex mutants on the DCS, charset-designation, keypad-mode, generic two-byte ESC and C0/C1 sweep patterns. The existing sanitizeForTerminal tests only assert that the ESC byte is gone; because the final control-char sweep removes a stray ESC anyway, a broken recogniser leaks the sequence's payload or final byte without failing a test. Each new case feeds one recogniser an input only it consumes whole and asserts the exact output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Looks correct to me — test-only, and the tests do what they claim.
What I verified at 2258b6b:
- Read
src/sanitize.ts:44-62alongside each new case insrc/sanitize.test.ts:85-111. Every input is consumed by exactly one recogniser (DCS L51, charset L55, keypad L57, generic two-byte L59, C0/C1 sweep L62), and the expected strings assume the default' 'replacement from L44. - Built and ran
node --test dist/sanitize.test.js: 20/20 pass. - Deleted the charset-designation
.replaceatsrc/sanitize.ts:55and re-ran: onlystrips charset-designation sequences wholefails ('a (Bb'leaks the(Bpayload, as the PR describes). So the new block is a real fail-without-it gate, not a tautology.
No shipped code touched; changelog-guard is green and correctly skipped. Nothing for a maintainer to decide here beyond merging.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Test Improvement
Adds a direct
describe('stripTerminalEscapes')block tosrc/sanitize.test.tsthat pins each recogniser in the shared escape stripper with an input only that recogniser consumes whole.Why
The nightly advisory mutation run on
main(562f1c4, run 40821869628,restshard) leavessrc/sanitize.tsat 81.82% with 8 surviving mutants — 7 of themRegexmutants on the DCS (L51), charset-designation (L55), keypad-mode (L57), generic two-byte ESC (L59) and C0/C1 sweep (L62) patterns, plus the default-replacement literal (L44).The existing
sanitizeForTerminaltests assert that the ESC byte is gone and that surrounding words survive. Because the final control-char sweep removes a stray ESC regardless, a broken recogniser still passes those assertions while the sequence's payload or final byte leaks into the output (\x1b(B→B,\x1bPq…\x1b\\→q…).sanitizeForTerminalalso collapses runs of spaces, which hides whether the C0/C1 sweep is a+run or per-byte, so the new cases callstripTerminalEscapesdirectly and assert exact strings.Re-running Stryker on
src/sanitize.tsalone with this branch: 100.00% (41 killed, 3 timeout, 0 survived).No shipped code changes; test-only, so no
CHANGELOG.mdentry.Filed by quality agent (ACMM L4/L6 — full mode)
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88