Skip to content

[bug] jsx-tags.ts does not treat a backtick as a delimiter, so one apostrophe in a template literal drops a whole tag from two source guards #536

Description

@serge-ivo

One apostrophe in a template literal deletes a whole tag from two source guards

store/console/src/lib/jsx-tags.ts:67:

if (c === '"' || c === "'") quote = c;

A backtick is not tracked as a string delimiter. So inside a template literal, an ordinary apostrophe — title={`the agent's runner`} — opens a quote state that the closing backtick never clears, and the scanner swallows the rest of the tag.

The consequence is not a parse error. It is a silently smaller input: the <button> simply is not seen, so the control-shapes ratchet and the design-token guard both pass while measuring less than they claim.

Found by the #530/#531 lane, which hit it on a real title string. Not folded into #531 — that issue is closed and this is a different file with a different blast radius.

Why this matters more than its size

This is the third guard found lying in one day, and all three failed the same way — green while measuring nothing:

A guard that under-reports is worse than no guard, because the number it prints is trusted. check-file-size.mjs, check-design-tokens.mjs and check-bare-catch.mjs all exist because someone was surprised; a guard that quietly measures a subset re-opens exactly the ground those were written to hold.

Acceptance criteria

  1. A backtick is tracked as a string delimiter, and ${…} interpolation inside one is handled (an apostrophe inside an interpolated expression is a third nesting case — decide it deliberately).
  2. A fixture with title={`the agent's runner`} is counted by both consumers of this module.
  3. The fix is proven non-vacuous the way the other two were: assert the tag count rises on that fixture against the current lexer, so the test fails before the fix.
  4. Check whether the tag count changes across the repo once fixed. If it does, the pinned numbers in the guards that consume this were set against an undercount and need re-pinning with that stated — not silently adjusted.

Verified

jsx-tags.ts:67 reads exactly as quoted. That both consumers under-report as a result is the lane's report and follows from the lexer, but I have not measured the repo-wide delta — criterion 4 exists to establish it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfrontendFrontend / UI work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions