Repository navigation
Conversation
…resource tag With a plugin language pack active, i18n.language is the synthetic plugin<hex> resource id, which Intl.DateTimeFormat rejects with a RangeError. ProjectRoadmap passed it straight to the tick formatter, crashing the Tasks page. Route it through getIntlLocale() and add an AST guard against raw i18n language reaching Intl. Co-Authored-By: Claude <noreply@anthropic.com>
|
This run hit its time limit while still working, so it stopped before finishing. Give runs longer with
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughProjectRoadmap now gets its formatting locale from getIntlLocale(). A renderer test checks month formatting with an active pt-BR plugin pack. A new test scans renderer source files for raw i18n or i18next language values passed to locale APIs or assigned to variables named locale. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The change addresses the reported plugin-language crash, with no identified issue requiring a fix before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing this PR as superseded by the merged PR #26860. It retains the same roadmap fix using the existing Intl locale resolver. The regression coverage was reworked into the existing roadmap suite; the broad renderer AST scanner from this PR was not included. The original m4air author identity is preserved in the co-author trailer. |

ELI5
The Tasks page shows GitHub Project roadmaps with date labels. To format those dates, the code asked "what language is the app in?" and passed the answer to the browser's date formatter. When you install a community language pack (for example Portuguese), the app's internal answer is a long made-up id like
plugin0070006c..., not a real language code likept-BR. The date formatter doesn't understand that id, throws an error, and the whole Tasks page crashes. The fix asks the app's existing "what real locale should dates use?" function instead, which returnspt-BR(or English if that can't be used).What Changed
Before: With a plugin language pack active (seen in the field on Windows with the Portuguese pack), opening a GitHub Project roadmap view on the Tasks page crashed the page into the error boundary with
RangeError: Invalid language tag: plugin....After: The roadmap renders, and its date ticks are formatted in the pack's declared locale (
pt-BR). If the runtime can't format that locale, it falls back to the default locale (en).Mechanism:
ProjectRoadmap.tsx:51usedi18n.resolvedLanguage ?? i18n.languageas the Intl locale. With a plugin pack, that value is the synthetic i18next resource id (pluginLanguageResourceId("plugin:stablyai.orca-portuguese/pt-BR")), whichnew Intl.DateTimeFormat()rejects. It now calls the existinggetIntlLocale()fromsrc/renderer/src/i18n/i18n.ts. That function maps the plugin resource id to the pack'slocaleand checks it withIntl.DateTimeFormat.supportedLocalesOf, falling back toDEFAULT_LOCALE. Other renderer formatters (relative time, weekday names, chat timestamps, the branch line total chip) already use it.Guard: New AST test
src/renderer/src/i18n/no-raw-language-intl-locale.test.ts. It fails wheni18n.language/i18n.resolvedLanguageis passed straight to anIntl.*constructor or atoLocale*/localeComparecall, or stored in a variable namedlocale.Why
toLocale*/Collator/localeComparecall site already usesgetIntlLocale(), passesundefined, or hardcodes'en'. The remaining reads ofi18n.languageare only cache or memo keys. ProjectRoadmap was the only call site still crashing.plugin<hex>resource id that reached Intl here.Linked Issue
Field crash report from the Orca crash channel (report
20a1bb20-039d-4f3d-9ada-e4781be5b603, v1.4.219, Windows). No GitHub issue.Fix evidence
Field crash (v1.4.219, win32 10.0.26200 x64):
The hex decodes to
plugin:stablyai.orca-portuguese/pt-BR, which is the plugin resource id.Before the fix (
ProjectRoadmap.tsxchecked out fromorigin/main, new tests kept):The render test reproduces the exact field error string.
After the fix (this branch):
Visual Proof
N/A. This is a crash fix. Without a plugin pack, the UI looks the same. With one, the roadmap now renders instead of the error boundary. The render test above shows this.
Testing
pnpm test src/renderer/src/components/github-project/ProjectRoadmap.plugin-locale.test.tsx src/renderer/src/i18n/no-raw-language-intl-locale.test.ts: passes on this branch and fails with the fix reverted (output above).oxlinton the 3 changed files: exit 0.pnpm tc:web: passes.Platforms: run on macOS (vitest/jsdom). The field crash was on Windows, and the code path doesn't depend on the platform.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Trade-offs
getIntlLocale()now runs on every ProjectRoadmap render: onesupportedLocalesOfcall plus a short search of the installed packs. The cost is negligible, and other components already do the same on every render.eninstead of whatever the runtime would pick. This matches every othergetIntlLocale()caller.en,zh-CNand the pseudo-localeen-XAare unchanged.Review
Adversarial review: 1 loop until clean.
Round 1: CLEAN
getIntlLocale(), which maps the plugin resource tag topack.localeand falls back toDEFAULT_LOCALEwhen Intl rejects or has no data for the tag (this covers packs with an invalid or unsupported locale field).getIntlLocale(). automation-list-view takes locale as a parameter by design. The otheri18n.languagereads (activity-standalone-worktree, rich-markdown-code-block-languages, settings navigation, LinearIssueMarkdownDescriptionEditor) only use it as a cache or memo key, never as an Intl argument. The remainingtoLocale*()calls pass no locale.supportedLocalesOfkeepsen,zh-CNand the pseudo-localeen-XAunchanged, so behavior matches the othergetIntlLocaleconsumers. Language changes at runtime: locale is read on every render and is not memoized, same as before the fix, and roadmap-tick-format caches formatters per locale.as const. Comments are brief and file names are specific.filePath.includes('/i18n/locales/')exclusion uses POSIX separators and has no effect, because the locales folder holds only.jsonfiles and the.ts/.tsxfilter already skips them.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Security: no impact. Cross-platform: platform-independent renderer code. SSH/remote: renderer-only, no effect. Mobile: not affected. Backwards compatibility: no wire or settings changes. Performance: negligible (see Trade-offs).
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)