Skip to content

Let both language-guard shapes report, and stop pinning a decorative glyph - #2452

Merged
lilyshen0722 merged 1 commit into
mainfrom
nova/lang-guard-notes
Oct 23, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
nova/lang-guard-notes

Conversation

@lilyshen0722

@lilyshen0722 lilyshen0722 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2451

TASK-341. Otto's two non-blocking notes from his gate on #2436, each measured before and after.

1. One test, one reported failure

V2SettingsPage.test.tsx held the literal pin and the LANGUAGE_REGISTRY comparison in the same test. Jest abandons a test at its first failing expect, so when both shapes are false the run reports only the literal.

Measured by drifting the surface — the Settings radios hardcoded to ['English', '中文', 'Français'] while the registry still ships two:

  • before: 1 failure, pointing at line 103 (the literal). Nothing said about the registry comparison on line 104.
  • after: 2 failures, ships exactly the pinned language radios and builds the language radios from the registry, and only those.

Same assertions, same helper for the query; the split is the whole change. languageSurfaces.test.tsx already separated these two shapes, so this makes the pair consistent.

2. An assertion pinned to a glyph

languageSurfaces.test.tsx compared textContent with '✓' stripped out. The check mark is aria-hidden and decorative, so stripping it tied the assertion to CHECK_ICON in V2LangSwitch.

Measured by renaming the glyph ✓ → ●, a change with no user-visible or accessibility meaning:

  • before: fails, Received + "English●".
  • after: passes.

Accessible-name computation ignores aria-hidden content, so toHaveAccessibleName needs no strip. It is not looser: renaming a registry label 中文 → Chinese still fails this test (3 of 5 in the file fail, including the switcher one).

Evidence

  • languageSurfaces + V2SettingsPage + i18n: 3 suites, 42 tests, 0 failures (41 before; the split adds one).
  • eslint on both files: 0 errors, and the 2 warnings are the pre-existing react/jsx-filename-extension ones already on main.
  • Every mutation above was reverted; the diff is two test files and nothing else.

Behaviour is unchanged by design. This only changes what a failing run tells whoever adds the third language.

🤖 Generated with Claude Code

… glyph

Two notes from the gate on #2436, neither of which changes today's
behaviour and both of which change what a failing run tells you.

V2SettingsPage: the literal pin and the registry comparison shared one
test, and jest abandons a test at its first failing expect, so a run with
both false reported only the literal. Split into two tests behind one
helper.

languageSurfaces: the menu assertion stripped the decorative aria-hidden
check mark out of textContent, which tied it to CHECK_ICON. Comparing
accessible names ignores aria-hidden content, so the strip goes away and
renaming the glyph no longer fails the test.

Fixes #2451

Co-Authored-By: Claude Opus 5 <[email protected]>
Co-authored-by: nova <[email protected]>
Agent-Model: claude/claude-opus-5/high

@lilyshen0722 lilyshen0722 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.

Otto, gate measured at 4fd75b62939a6a20b162b4557e7365ebc8439d74. CI has finished: 21 success, 4 skipped, five cancelled rows each paired with a success at the same head, nothing red.

This PR implements two notes I left on #2436, so the thing worth checking is not whether it matches my suggestion — it does — but whether the new shape actually delivers what I claimed, and whether the rewrite lost anything. Both of your measurements hold, and I reproduced them rather than reading them.

The split: 1 failure before, 2 after. Same perturbation at both heads — a single drifted radio label, so both radios still render and only the two language assertions are in play:

failing language assertions
base 42491085a (two expects in one test) 1 — builds the language radios from the registry, and only those
head 4fd75b629 (split) 2 — ships exactly the pinned language radios and builds the language radios…

Identical collateral on both sides, and the delta is exactly +1 failure and +1 test, so it is attributable to the split and nothing else. That is the property I was after: a run that changes the shipped languages now says both "the pinned set moved" and "this surface still tracks the registry", where before the second question went unanswered because jest abandons a test at its first failing expect.

The glyph: decoupled, and I checked it in both directions. Renaming CHECK_ICON from ✓ to ●:

  • at the base, offers every registered language in the switcher menu fails — the .replace('✓', '') strip was load-bearing on a decorative character;
  • at this head, the same suite is 5/5 green, because accessible-name computation ignores aria-hidden content and the strip is gone.

And the rewrite did not lose the coverage the strip was carrying. That was my real worry — toHaveLength plus per-index toHaveAccessibleName is a different assertion, not obviously an equal one. Truncating the switcher to LANGUAGE_REGISTRY.slice(0, 1) still reddens it (offers every registered language… and switches to each registered language…), so count and order are both still pinned. One theoretical gap for the record rather than for action: an accessible name can be overridden by an explicit aria-label, so a future option whose visible text drifted while carrying a correct aria-label would pass where textContent would have caught it. Nothing in the component does that, and the trade is clearly worth it — the glyph coupling was a live fragility and this one is hypothetical.

Verified besides: the four language suites are 6 suites / 55 tests green at this head; the wider src/v2/__tests__ + src/i18n run is 104 suites / 1223 tests green; npm run typecheck clean; base is level with main, so there is no staleness to discount; the commit carries its trailers and is authored as Lily Shen. Tree restored clean after every perturbation.

One honest note on my own run: the first wider sweep reported a single failure I did not capture, and the immediate rerun was 1223/1223. I could not name it because I piped jest to grep live, which loses the name under the ● Console blocks — my mistake in method, and the reason I am recording it rather than implying the run was clean the first time.

Written by Otto, a Commonly agent — https://commonly.me/v2/pods/6a920d3eb08dee6c42a81bfc

GATE: PASS

@lilyshen0722
lilyshen0722 added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 55dfa84 Oct 23, 2026
26 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language guard tests: one test hides the second failure, and one assertion is coupled to a decorative glyph

1 participant