Repository navigation
fix(PowerSearch): the popover token reads its value in the provider locale - #13131
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| PowerSearch · Storybook | 317.1 kB (+62 B) · 27.1 kB CSS (0) | 7,198 (−22) | ✓ · ✓ · ✓ |
| FileInput | 77.0 kB (+9 B) · 12.6 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 7.90 MB packed (+572 B); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested. The locale fix itself restores the documented token behavior; one structural point needs a record before approval.
packages/core/src/i18n/listFormat.tsis a new internal module that PowerSearch imports from another folder, and no current record names it. Name it, withcreateListFormatter, inarchitecture:internationalization(Owning code, besidei18n/useCollator.ts) in this pull request, with its usage and the reason theuseListFormatterhook cannot serve the server-safePowerSearch/utilsentry, so an engineering owner can approve it with/approve-specfor the head commit.
The popover token now matches the sheet's rows as FR11 and FR12 describe, and the ten new or updated tests fail before the change and pass after it. Two small comment-style suggestions are inline.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claims
- Release note: the popover token's summaries come from the catalog, lists join in the locale, numbers use its decimal mark, and a relative date reads as its choice. Verified:
formatTokenValue.ts:115-136,:167,:225-248;PowerSearchTokenText.test.tsx. - Release note:
formatFilterValuejoins lists and reads relative dates the same way. Verified:formatFilterValue.ts:156,:175,:199,:224-227;formatFilterValue.test.ts. - Release note: in English only the relative date and the grouping of counts of 1,000 or more change. Verified: the catalog counts use
{count, number}; the English token and row cases pass. - Cause: the formatter used the catalog and the locale only when handed a translator, and the popover token passed none. Verified against the base call in
PowerSearch.tsx. formatTokenValueTextalways takes the translator; the three lint suppressions and the English literals are gone. Verified:formatTokenValue.ts:149-157.- The list format moves into a new internal module that the hook now calls, and the raw-Intl allowlist moves with it. Verified:
listFormat.ts:27-35,useListFormatter.ts,no-raw-intl-locale.js:129. - The relative-date choices move into a shared server-safe module used by the editors, the sheet and both formatters; the sheet's private lookup is removed;
buildRelativeDateOptionskeeps its signature. Verified:relativeDateOptions.ts:46-84;PowerSearchBottomSheet.tsx:1365-1376. - The record's known gap is rewritten to the four remaining differences, with the number difference stated in full. Verified against
formatFilterValue.ts:41-44andformatTokenValue.ts:106-136. - No API, prop, layout or interaction change. Verified: the API surface generator lists no row for any published package.
- German reads "a, b und c" and "2,5"; Chinese and Japanese join with "、"; other digits and decimal marks are unrounded and ungrouped. Verified by the tests and the platform list and number formats.
- Before the change, a German token showed English summaries, a literal list join and the stored relative-date key. Verified by running the new tests on the base.
- Ten tests fail before the change and pass after it. Verified: 10 fail on the base and all pass on the head.
formatFilterValuecollapses a German list a little sooner and a Chinese or Japanese one later, and needs the caller's translator for the relative-date keys. Verified:formatFilterValue.ts:156-162; the module registers its English.- Testing: the UI suites (35 files, 804 tests), the node identity and swizzle suites, the core typecheck, strict lint, the comment-provenance baseline, and the knowledge, catalog, runtime and changeset checks pass. Verified by rerunning each.
- Release note: the popover token's summaries come from the catalog, lists join in the locale, numbers use its decimal mark, and a relative date reads as its choice. Verified:
- Files
.changeset/powersearch-token-text-locale.md: cleardocs/specs/components/PowerSearch/PowerSearch.spec.md: clearinternal/eslint-plugin-astryx/no-raw-intl-locale.js: clearinternal/eslint-plugin-astryx/no-raw-intl-locale.test.mjs: clearpackages/core/locales/en.json: clearpackages/core/src/PowerSearch/PowerSearch.tsx: clearpackages/core/src/PowerSearch/PowerSearchBottomSheet.test.tsx: clearpackages/core/src/PowerSearch/PowerSearchBottomSheet.tsx: clearpackages/core/src/PowerSearch/PowerSearchTokenText.test.tsx: clearpackages/core/src/PowerSearch/PowerSearchValueEditor.tsx: clearpackages/core/src/PowerSearch/formatFilterValue.test.ts: clearpackages/core/src/PowerSearch/formatFilterValue.ts: clearpackages/core/src/PowerSearch/formatTokenValue.ts: clearpackages/core/src/PowerSearch/relativeDateOptions.ts: comment-style suggestion (non-blocking)packages/core/src/i18n/listFormat.ts: blocking (no record names the new module); comment-style suggestionpackages/core/src/i18n/useListFormatter.ts: clear
There was a problem hiding this comment.
Changes requested. The locale fix restores the documented token behavior, and the new Owning code entry gives the module the record content it needed; one approval remains.
packages/core/src/i18n/listFormat.tsis a new internal module that PowerSearch imports from another folder, and only this pull request's own Owning code entry inarchitecture:internationalizationnames it, which no engineering owner has approved yet: an engineering owner (the author is one) approves the record change by commenting/approve-specwith the head commit.
The ten new or updated tests fail before the change and pass after it, and the two comment-style suggestions from the last review are applied.
Claims and files checked
Review mode: full; reason: spec-record
- Claims
- Release note: the popover token's summaries come from the catalog, a list joins in the locale's list format, a number uses the locale's decimal mark, and a relative date reads as its choice. Verified:
formatTokenValue.ts:115-136,:167,:225-248;PowerSearchTokenText.test.tsx; captured frames. - Release note:
formatFilterValuejoins lists and reads relative dates the same way. Verified:formatFilterValue.ts:156,:175,:199,:224-227;formatFilterValue.test.ts. - Release note: in English only the relative date and the grouping of counts of 1,000 or more change. Verified:
en.json:238-251({count, number}); the English token and row cases pass. - Cause: the formatter used the catalog and the locale only when handed a translator, the popover token passed none, and English literals sat behind three lint suppressions. Verified against the base call in
PowerSearch.tsxand the baseformatTokenValue.ts. formatTokenValueTextalways takes the translator, the popover token passes it, and the suppressions and literals are gone. Verified:formatTokenValue.ts:149-157;PowerSearch.tsx:762.- The list format moves into a new internal module that the hook now calls, and the raw-Intl allowlist moves with it. Verified:
listFormat.ts:25-33;useListFormatter.ts:35;no-raw-intl-locale.js:129. - The relative-date choices move into a shared server-safe module for the editors, the sheet and both formatters; the sheet's private lookup is removed;
buildRelativeDateOptionskeeps its signature. Verified:relativeDateOptions.ts:46-84;PowerSearchValueEditor.tsx:68;PowerSearchBottomSheet.tsx:94. - The sheet's rows call the same function with the same arguments, and the sheet's editors interface drops
buildRelativeDateOptions. Verified:PowerSearchBottomSheet.tsx:142-145,:1365-1376. - The internationalization record's Owning code gains one entry for the new module, which needs an engineering owner's approval. Verified:
internationalization.md:412-417; not yet approved (the blocking finding). - The component record already specifies the row text as the token's, and the token now reads the same. Verified: six sheet cases assert the trigger's token equals the Filters row.
- The record's known gap is rewritten to the four remaining differences, with the number difference stated in full. Verified:
formatFilterValue.ts:41-44,:203;formatTokenValue.ts:72-76,:106-136. - No API, prop, layout or interaction change. Verified: the API surface comparison lists no row in any published package; the source adds no prop or handler.
- Other locales: German reads "a, b und c" and "2,5", Chinese and Japanese join with "、", and other digits are unrounded and ungrouped. Verified: the sheet and token tests; the platform list and number formats.
- Before the change a German token read the English summaries,
3d_agoand "2.5"; after it, the German words and "2,5". Verified: captured frames of both trees;PowerSearchTokenText.test.tsx. - Ten tests fail before the change and pass with it. Verified: 10 of 250 fail on the base with the head's three test files; all pass on the head.
formatFilterValuemeasures the locale-joined text against the width budget, and a relative date needs the caller's translator; Core's translators resolve it. Verified:formatFilterValue.ts:156-162;relativeDateOptions.ts:18.- Testing: the PowerSearch, i18n and FileInput suites (35 files, 804 tests), the node suites, typecheck, strict lint, the provenance baseline, and the knowledge, catalog, runtime-map and changeset checks pass. Verified: all pass at the head; the three unused-type warnings in
PowerSearch.tsxare on the base too.
- Release note: the popover token's summaries come from the catalog, a list joins in the locale's list format, a number uses the locale's decimal mark, and a relative date reads as its choice. Verified:
- Files
.changeset/powersearch-token-text-locale.md: cleardocs/architecture/internationalization.md: the Owning code entry awaits an engineering owner's approval (blocking)docs/specs/components/PowerSearch/PowerSearch.spec.md: clearinternal/eslint-plugin-astryx/no-raw-intl-locale.js: clearinternal/eslint-plugin-astryx/no-raw-intl-locale.test.mjs: clearpackages/core/locales/en.json: clearpackages/core/src/PowerSearch/PowerSearch.tsx: clearpackages/core/src/PowerSearch/PowerSearchBottomSheet.test.tsx: clearpackages/core/src/PowerSearch/PowerSearchBottomSheet.tsx: clearpackages/core/src/PowerSearch/PowerSearchTokenText.test.tsx: clearpackages/core/src/PowerSearch/PowerSearchValueEditor.tsx: clearpackages/core/src/PowerSearch/formatFilterValue.test.ts: clearpackages/core/src/PowerSearch/formatFilterValue.ts: clearpackages/core/src/PowerSearch/formatTokenValue.ts: clearpackages/core/src/PowerSearch/relativeDateOptions.ts: clearpackages/core/src/i18n/listFormat.ts: new internal module with no approved record yet (blocking)packages/core/src/i18n/useListFormatter.ts: clear
|
/approve-spec c3f2975 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because the pull request is still a draft; marking it ready for review starts it.
The locale fix restores the documented token behavior, and the engineering owner's approval of the new internationalization Owning code entry settles the one change requested earlier. The ten new or updated tests fail before the change and pass with it.
Claims and files checked
Review mode: same-head; reason: none
- Claims
- Release note: the popover token's summaries come from the catalog, a list joins in the locale's list format, a number uses the locale's decimal mark, and a relative date reads as its choice. Verified:
formatTokenValue.ts:115-136,:165-167,:225-248;PowerSearchTokenText.test.tsx; captured frames. - Release note:
formatFilterValuejoins lists and reads relative dates the same way. Verified:formatFilterValue.ts:156,:175,:199,:224-227;formatFilterValue.test.ts. - Release note: in English only the relative date and the grouping of counts of 1,000 or more change. Verified:
en.json:238-251({count, number}); the English token case passes. - Cause: the formatter used the catalog and the locale only when handed a translator, the popover token passed none, and English literals sat behind three lint suppressions. Verified against the base call in
PowerSearch.tsxand the baseformatTokenValue.ts. formatTokenValueTextalways takes the translator, the popover token passes it, and the suppressions and literals are gone. Verified:formatTokenValue.ts:149-157;PowerSearch.tsx:762.- The list format moves into a new internal module that the hook now calls, and the raw-Intl allowlist moves with it. Verified:
listFormat.ts:25-33;useListFormatter.ts:35;no-raw-intl-locale.js:129. - The relative-date choices move into a shared server-safe module for the editors, the sheet and both formatters; the sheet's private lookup is removed;
buildRelativeDateOptionskeeps its signature. Verified:relativeDateOptions.ts:46-84;PowerSearchValueEditor.tsx:68;PowerSearchBottomSheet.tsx:94. - The sheet's rows call the same function with the same arguments, and the sheet's editors interface drops
buildRelativeDateOptions. Verified:PowerSearchBottomSheet.tsx:142-145,:1365-1373. - The internationalization record's Owning code gains one entry for the new module, which needs an engineering owner's approval. Verified:
internationalization.md:412-417; an engineering owner approved the record change for this head. - The component record already specifies the row text as the token's, and the token now reads the same. Verified: six sheet cases assert the trigger's token equals the Filters row.
- The record's known gap is rewritten to the four remaining differences, with the number difference stated in full. Verified:
PowerSearch.spec.md:986-1002againstformatFilterValue.ts:41-44,:203andformatTokenValue.ts:72-76,:106-136. - No API, prop, layout or interaction change. Verified: the API surface comparison lists no row in any published package; the source adds no prop or handler.
- English lists and numbers read as before. Verified: the English token case; the four English number row cases.
- Other locales: German reads "a, b und c" and "2,5", Chinese and Japanese join with "、", and other digits are unrounded and ungrouped. Verified: the sheet and token tests.
- Before the change a German token read the English summaries, the stored relative-date key and "2.5"; after it, the German words and "2,5". Verified: captured frames of both trees;
PowerSearchTokenText.test.tsx. - Ten tests fail before the change and pass with it. Verified: 10 of 250 fail on the base with the head's three test files; all pass on the head.
formatFilterValuemeasures the locale-joined text against the width budget, and a relative date needs the caller's translator; Core's translators resolve it. Verified:formatFilterValue.ts:156-162;relativeDateOptions.ts:18.- Testing: the PowerSearch, i18n and FileInput suites (35 files, 804 tests) and the raw-Intl lint rule's tests pass; typecheck, strict lint, the provenance baseline, and the knowledge, catalog, runtime-map and changeset checks pass. Verified: the suites and the lint rule's tests pass at this head; the other checks passed at this same head before.
- Release note: the popover token's summaries come from the catalog, a list joins in the locale's list format, a number uses the locale's decimal mark, and a relative date reads as its choice. Verified:
- Files
.changeset/powersearch-token-text-locale.md: cleardocs/architecture/internationalization.md: cleardocs/specs/components/PowerSearch/PowerSearch.spec.md: clearinternal/eslint-plugin-astryx/no-raw-intl-locale.js: clearinternal/eslint-plugin-astryx/no-raw-intl-locale.test.mjs: clearpackages/core/locales/en.json: clearpackages/core/src/PowerSearch/PowerSearch.tsx: clearpackages/core/src/PowerSearch/PowerSearchBottomSheet.test.tsx: clearpackages/core/src/PowerSearch/PowerSearchBottomSheet.tsx: clearpackages/core/src/PowerSearch/PowerSearchTokenText.test.tsx: clearpackages/core/src/PowerSearch/PowerSearchValueEditor.tsx: clearpackages/core/src/PowerSearch/formatFilterValue.test.ts: clearpackages/core/src/PowerSearch/formatFilterValue.ts: clearpackages/core/src/PowerSearch/formatTokenValue.ts: clearpackages/core/src/PowerSearch/relativeDateOptions.ts: clearpackages/core/src/i18n/listFormat.ts: clearpackages/core/src/i18n/useListFormatter.ts: clear
c3f2975 to
3b3a676
Compare
|
/approve-spec 3b3a676 |
There was a problem hiding this comment.
Approved pending CI: the heavy test suites have not finished on this head yet, and merge waits for them to pass.
The locale fix restores the documented token behavior, and the engineering owner's approval of the new internationalization Owning code entry for this head keeps the one earlier requested change settled. The ten new or updated tests fail before the change and pass with it.
Claims and files checked
Review mode: carry-forward; reason: none
- Claims
- Release note: the popover token's summaries come from the catalog, a list joins in the locale's list format, a number uses the locale's decimal mark, and a relative date reads as its choice. Verified:
formatTokenValue.ts:115-136,:165-167,:225-248;PowerSearchTokenText.test.tsx; captured frames. - Release note:
formatFilterValuejoins lists and reads relative dates the same way. Verified:formatFilterValue.ts:156,:175,:199,:224-227;formatFilterValue.test.ts. - Release note: in English only the relative date and the grouping of counts of 1,000 or more change. Verified:
en.json:238-251({count, number}); the English token case passes. - Cause: the formatter used the catalog and the locale only when handed a translator, the popover token passed none, and English literals sat behind three lint suppressions. Verified against the base call in
PowerSearch.tsxand the baseformatTokenValue.ts. formatTokenValueTextalways takes the translator, the popover token passes it, and the suppressions and literals are gone. Verified:formatTokenValue.ts:149-157;PowerSearch.tsx:762.- The list format moves into a new internal module that the hook now calls, and the raw-Intl allowlist moves with it. Verified:
listFormat.ts:25-33;useListFormatter.ts:35;no-raw-intl-locale.js:129. - The relative-date choices move into a shared server-safe module for the editors, the sheet and both formatters; the sheet's private lookup is removed;
buildRelativeDateOptionskeeps its signature. Verified:relativeDateOptions.ts:46-84;PowerSearchValueEditor.tsx:68;PowerSearchBottomSheet.tsx:94. - The sheet's rows call the same function with the same arguments, and the sheet's editors interface drops
buildRelativeDateOptions. Verified:PowerSearchBottomSheet.tsx:142-145,:1365-1373. - The internationalization record's Owning code gains one entry for the new module, which needs an engineering owner's approval. Verified:
internationalization.md:412-417; an engineering owner approved the record change for this head. - The component record already specifies the row text as the token's, and the token now reads the same. Verified: six sheet cases assert the trigger's token equals the Filters row.
- The record's known gap is rewritten to the four remaining differences, with the number difference stated in full. Verified:
PowerSearch.spec.md:986-1002againstformatFilterValue.ts:41-44,:203andformatTokenValue.ts:72-76,:106-136. - No API, prop, layout or interaction change. Verified: the API surface comparison lists no row in any published package; the source adds no prop or handler.
- English lists and numbers read as before. Verified: the English token case; the four English number row cases.
- Other locales: German reads "a, b und c" and "2,5", Chinese and Japanese join with "、", and other digits are unrounded and ungrouped. Verified: the sheet and token tests.
- Before the change a German token read the English summaries, the stored relative-date key and "2.5"; after it, the German words and "2,5". Verified: captured frames of both trees;
PowerSearchTokenText.test.tsx. - Ten tests fail before the change and pass with it. Verified: 10 of 250 fail on the base with the head's three test files; all pass on the head.
formatFilterValuemeasures the locale-joined text against the width budget, and a relative date needs the caller's translator; Core's translators resolve it. Verified:formatFilterValue.ts:156-162;relativeDateOptions.ts:18.- Testing: the PowerSearch, i18n and FileInput suites (35 files, 804 tests) and the raw-Intl lint rule's tests pass; typecheck, strict lint, the provenance baseline, and the knowledge, catalog, runtime-map and changeset checks pass. Verified: the suites and the lint rule's tests pass with this patch; the other checks passed earlier with the same patch.
- Release note: the popover token's summaries come from the catalog, a list joins in the locale's list format, a number uses the locale's decimal mark, and a relative date reads as its choice. Verified:
- Files
.changeset/powersearch-token-text-locale.md: cleardocs/architecture/internationalization.md: cleardocs/specs/components/PowerSearch/PowerSearch.spec.md: clearinternal/eslint-plugin-astryx/no-raw-intl-locale.js: clearinternal/eslint-plugin-astryx/no-raw-intl-locale.test.mjs: clearpackages/core/locales/en.json: clearpackages/core/src/PowerSearch/PowerSearch.tsx: clearpackages/core/src/PowerSearch/PowerSearchBottomSheet.test.tsx: clearpackages/core/src/PowerSearch/PowerSearchBottomSheet.tsx: clearpackages/core/src/PowerSearch/PowerSearchTokenText.test.tsx: clearpackages/core/src/PowerSearch/PowerSearchValueEditor.tsx: clearpackages/core/src/PowerSearch/formatFilterValue.test.ts: clearpackages/core/src/PowerSearch/formatFilterValue.ts: clearpackages/core/src/PowerSearch/formatTokenValue.ts: clearpackages/core/src/PowerSearch/relativeDateOptions.ts: clearpackages/core/src/i18n/listFormat.ts: clearpackages/core/src/i18n/useListFormatter.ts: clear
User impact
A PowerSearch filter token in the popover presentation shows parts of its value in English under every locale:
.decimal mark;3d_ago) instead of the choice the person picked ("3 days ago").The sheet presentation's Filters rows already read all of these in the provider locale. The two presentations of one field disagree, and no translation or override reaches the popover token.
Problem and solution fit
formatTokenValueTextresolved those parts through the catalog and the locale only when it was handed a translator. The sheet passed one and the popover token did not, so the token fell back to English literals behind threeeslint-disablecomments.architecture:internationalizationINV1a (Astryx-owned text is a catalog message) and INV8 (locale-sensitive formatting goes through the shared helpers with the provider locale).formatTokenValueTextalways takes the translator. The popover token passes it. The threeeslint-disablecomments and the English literals are gone.Intl.ListFormatmoves from theuseListFormatterhook into a new internali18n/listFormat.ts(createListFormatter(locale)), which the hook now calls. The PowerSearch formatters call it directly:formatFilterValueis on the server-safePowerSearch/utilsentry, which cannot import a client hook. The raw-Intl lint allowlist moves from the hook to the new file.relativeDateLabel. The relative-date choices move fromPowerSearchValueEditor.tsxinto a small server-safe module,relativeDateOptions.ts, which the editors, the sheet and both token formatters share. The sheet's private copy of the lookup is removed.formatFilterValue, used by the exportedPowerSearchToken, joins lists and reads relative dates the same way.PowerSearchSheetEditorsdropsbuildRelativeDateOptions, which the sheet now imports from the small shared module (it is already in the sheet's graph throughformatTokenValue.ts).Expected behavior and authority
architecture:internationalizationOwning code gains one entry for the new internali18n/listFormat.ts(createListFormatter): the one narrow conjunction list format, whichuseListFormatterbinds to the provider locale and the PowerSearch value formatters call directly because the server-safePowerSearch/utilsentry cannot import a client hook. This record edit needs an engineering owner's/approve-spec.component:PowerSearchFR12 already specifies the Filters row's value text "as the trigger's token shows it — the same formatter, so the same words", with the summaries from the catalog, lists in the locale's narrow conjunction list, numbers in the locale's digits and decimal mark, and a relative date as its choice. The token now reads the same way.formatFilterValueand the token's text (entity wording, number rounding and units, the collapse rule, the cut mark) stay in the gap. The number difference is now stated in full:formatFilterValuerounds to three fraction digits, the token does not.Smallest restoration
formatTokenValueTextandrelativeDateOptions.tsare internal;buildRelativeDateOptionskeeps its signature.3d_ago, and a count of 1,000 or more items or filters groups its digits ("1,000 items"), as the catalog's{count, number}writes it. English lists and numbers read as before ("a, b, c",2.3456,1e-7).1e-7in German).Evidence
3d_agoand "2.5".mainand pass with the change.PowerSearchTokenText.test.tsx: the German case, and the English case for the relative date.formatFilterValue.test.ts: the German list join, and a relative date read as its choice. A value no choice offers still reads as stored.PowerSearchBottomSheet.test.tsxcases now assert that the trigger's token reads the same text as the Filters row, where they used to assert the token kept its English literals. One is renamed to say so.formatFilterValueside effects: it now measures the locale-joined text against the width budget, so German (" und ") collapses to a count a little sooner and Chinese and Japanese ("、") later; English is unchanged. A relative date now needs the caller's translator to resolve@astryx.powersearch.sheet.relative*; Core's translators do.Scope
Components: PowerSearch (popover token value text, shared relative-date choices,
formatFilterValuelist join and relative date; record gap), i18n (listFormat.ts,useListFormatter; record Owning code)Writing rubric results
Record edits:
component:PowerSearchknown gap (rewritten to the four remaining differences);architecture:internationalizationOwning code (one entry fori18n/listFormat.ts).Testing
vitest --project uion PowerSearch, i18n, FileInput (the otheruseListFormattercaller) and the ESLint plugin: 35 files, 804 tests pass.vitest --project nodeonscripts/shared-identity.test.mjs, the swizzle proof samples andpackages/cli/api/swizzle: pass.tsc --noEmit(core): clean.CI=true eslint(strict) on every changed file: no new findings. The three unused-type warnings inPowerSearch.tsxare onmain.no-comment-provenance.baseline.mjs --check: up to date.pnpm check:knowledge,node scripts/check-i18n-catalog.mjs,node scripts/generate-i18n-runtime.mjs(English fallback maps and their wiring checks) andcheck:changesets: pass.