#33: harden author-coloring PUA sentinels against intra-emphasis markdown #53
Reference in New Issue
Block a user
Delete Branch "s33-sentinel-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#33 (task, P3) — harden the F9/F10 author-coloring PUA sentinels against intra-emphasis markdown, via the token-aware approach recommended in the issue comment.
Fixes both characterized failure modes (session 0032):
a**b**c, between the two*) split**, breaking markdown-it's pairing (stray<em></em>, raw**).**bold**covering**bo) rendered the emphasis but misnested span/element (<strong>bo</span>ld</strong>).Fix (
trackChangesModel.ts, pure)injectSentinels— clamp any sentinel offset landing strictly inside a delimiter run (`* _ ~ ``) to the run's start, so a sentinel never splits a run (CASE1). Delimiters are invisible once rendered, so this only shifts the colored boundary across markup; drop spans that clamp to empty.sentinelsToSpans— replace the naive global split/join with a token-aware walker over the rendered HTML: emit thecw-by-*span only around TEXT runs, closing it before any<tag>and reopening after, so a span is always well-nested within inline elements (one span segment per text run — CASE3). Tags copied verbatim with any stray sentinel stripped (no PUA leakage).Pure / vscode-free / deterministic (INV-33). No regression — existing
colorByAuthor/renderReviewcases stay green; the common no-emphasis case is byte-identical.Tests
222 unit + 74/5 host E2E green. New unit: CASE1 (emphasis intact, no stray
<em></em>), CASE3 (<span class="cw-by-human">bo</span>ld</strong>, no misnest), CASE2 regression, no-PUA-leak.Session 0047.
🤖 Generated with Claude Code