Skip to content

🌱 test(sanitize): pin each stripTerminalEscapes recogniser with a direct assertion - #411

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-strip-terminal-escapes
Oct 29, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-strip-terminal-escapes

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds a direct describe('stripTerminalEscapes') block to src/sanitize.test.ts that 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, rest shard) leaves src/sanitize.ts at 81.82% with 8 surviving mutants — 7 of them Regex mutants 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 sanitizeForTerminal tests 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…). sanitizeForTerminal also collapses runs of spaces, which hides whether the C0/C1 sweep is a + run or per-byte, so the new cases call stripTerminalEscapes directly and assert exact strings.

Re-running Stryker on src/sanitize.ts alone with this branch: 100.00% (41 killed, 3 timeout, 0 survived).

No shipped code changes; test-only, so no CHANGELOG.md entry.


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 29, 2026
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct to me — test-only, and the tests do what they claim.

What I verified at 2258b6b:

  • Read src/sanitize.ts:44-62 alongside each new case in src/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 .replace at src/sanitize.ts:55 and re-ran: only strips charset-designation sequences whole fails ('a (Bb' leaks the (B payload, 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

@hivecommons-hive
hivecommons-hive Bot merged commit 81bbc12 into main Oct 29, 2026
16 of 17 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-strip-terminal-escapes branch October 29, 2026 05:52
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#4112258b6b` sha256:66d73e411560311f900e5c16a7162c4ae93fd63392de5d57c1bbe8a46e55e6c2 — download from the dashboard or `hivectl review evidence #411`.

@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants