fix(twitch): preserve intraword underscores in outbound text#108548
Conversation
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
44957e8 to
12cb70a
Compare
Preserve multiline emphasis stripping and combining-mark identifiers. Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
|
Codex review: needs maintainer review before merge. Reviewed July 16, 2026, 1:21 AM ET / 05:21 UTC. Summary PR surface: Source 0, Tests +20. Total +20 across 2 files. Reproducibility: yes. Current main’s formatter and production caller establish the failing path, and the PR provides direct before/after production-chunker output for intraword identifiers and URL paths. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the Twitch-local Unicode-boundary fix with its focused regression tests, keeping shared Markdown parsing, configuration, transport, and double-underscore behavior unchanged. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s formatter and production caller establish the failing path, and the PR provides direct before/after production-chunker output for intraword identifiers and URL paths. Is this the best way to solve the issue? Yes. Tightening the existing Twitch-local emphasis boundary is the narrowest maintainable fix and avoids introducing shared-parser, transport, configuration, or compatibility surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8c95491039db. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0, Tests +20. Total +20 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
Merged via squash.
|
…w#108548) * fix(twitch): preserve intraword underscores Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> * fix(twitch): tighten underscore emphasis boundaries Preserve multiline emphasis stripping and combining-mark identifiers. Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> --------- Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an issue where Twitch users could receive altered outbound text when an identifier, filename, or URL contained single underscores inside a word. The Markdown stripping step interpreted pairs such as
_bar_infoo_bar_bazas emphasis, so the delivered text becamefoobarbaz;https://cdn.example/my_file_name.pngbecamehttps://cdn.example/myfilename.png.This is reachable before the Twitch transport is called:
Why This Change Was Made
The Twitch-local Markdown stripper now recognizes single-underscore emphasis only when the markers are not adjacent to Unicode letters, numbers, or combining marks. It retains the previous underscore-free capture behavior so standalone emphasis can still span input lines before Twitch's existing newline normalization runs.
The change stays inside the Twitch helper. Double underscores continue to follow the existing bold-markup path; changing that behavior is outside this PR. Shared Markdown parsing, Twitch authentication, message transport, and chunk-size behavior are unchanged.
User Impact
Twitch chat messages can now carry single-underscore identifiers and URL paths such as
foo_bar_bazandmy_file_name.pngwithout silently losing underscores. Standalone_italic_, multiline underscore emphasis, and existing__bold__markup are still converted to plain text.Evidence
Actual pre-transport behavior on
mainversus this branch:The exported Twitch chunker also preserves the adjacent behaviors that bound this fix:
The focused regression test covers ASCII, URL paths, Cyrillic, CJK, NFD combining marks, multiline emphasis, and unchanged standalone italic/bold behavior. Validation on Node
v24.15.0and pnpm11.2.2:node scripts/run-vitest.mjs run extensions/twitch/src/utils/markdown.test.ts- 1 file, 8/8 tests passedpnpm exec vitest run --config test/vitest/vitest.extension-messaging.config.ts extensions/twitch- 19 files, 203/203 tests passedpnpm exec oxlint extensions/twitch/src/utils/markdown.ts extensions/twitch/src/utils/markdown.test.ts- passedpnpm exec oxfmt --check extensions/twitch/src/utils/markdown.ts extensions/twitch/src/utils/markdown.test.ts- passedgit diff --check- passedLocal limitation: the
pnpm test:extension twitchwrapper previously did not complete within the Windows command timeout. Its resolved Vitest command is listed above and passed all Twitch tests.codex review --base upstream/mainwas also attempted, but the localcodex.execould not start because Windows returnedAccess is denied.AI-assisted: this patch and its tests were prepared with Codex. The author reviewed the production change, caller paths, edge-case probes, diff, and validation output.