fix(app-bundle): guard tool-count-label split() against undefined translations (#987) - #988
Merged
Merged
Conversation
…nslations (#987) The hub panel threw `TypeError: Cannot read properties of undefined (reading 'startsWith')` on cold page load (recurring, restart-masked), hit live during #955's cutover smoke: when the i18n dict hasn't loaded yet or a key is missing, i18n.t(...) returns undefined and the base tool-count-label.tsx's split() coerced it into {after: undefined}, throwing inside a Solid effect. The fix rides as an overlay twin (session-ui materializes from the overlay like every other app-graph package): split() guards falsy text and returns the honest empty render {before: "", after: ""} — the language.tsx fallback discipline — until the translation exists. Manifest re-registered (refresh_manifest); drift gate PASS; the twin materializes byte-identical into the composed tree. Test guard (#964 contract/source pattern) extracts the twin's real split/common and runs the memo derivations for missing keys — the unguarded base reproduces the production crash under the same harness, the twin does not. NOTE: the fork→overlay sync treats the fork as authoritative for session-ui files — mirror this fix to the fork's local/amicode branch (per #964) so the next sync brings the fix, not the regression.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #987 — the production hub-panel crash Aaron hit live during #955's cutover smoke.
What
TypeError: Cannot read properties of undefined (reading 'startsWith')on cold page load, recurring and restart-masked. Mechanism: the basesession-ui/src/components/tool-count-label.tsxrenders viasplit(i18n.t(...))— with the i18n dict not yet loaded (async resource) or a key missing,i18n.t(...)returnsundefined;split(undefined)produced{before: "", after: undefined}and the memos'one().after.startsWith(...)threw inside a Solid effect.The fix (overlay twin)
overlay/packages/session-ui/src/components/tool-count-label.tsx— the base file plus a guard:split(text: string | undefined)returns{before: "", after: ""}for falsy text (honest empty render until the translation exists, thelanguage.tsxfallback discipline), with a header comment naming the bug and mechanism.materialize.mjswalks the entireoverlay/tree recursively and applies every package —session-uiis a first-class overlay package (25A/29M→30M in the manifest). The twin materializes byte-identical into the composed tree.refresh_manifest.mjs(620 files); drift gate PASS.Tests
packages/extension/test/tool_count_label_guard_987.test.ts(vitest, the #964 contract/source pattern — the app has no render harness):split/commoncode is extracted from the file, transpiled, and exercised — not a re-typed copy;t → undefined) across all six plural categories — no throw, empty render;Verification
pnpm run typecheckgreen (schema, amico-run, extension).origin/mainbaseline, both with the suite's overlay-mutatingoverlay_sync.test.tsbenched (see hazard note): identical pre-existing failure set of 17 tests / 9 files (auth/bootstrap/service/terminal/cli_gate — environment-dependent: localOPENCODE_DB, fork checkout presence). Zero new failures;overlay_known_fixes_964,editable_diffs_wiring,packaging,yellow_chunks_853all pass.overlay_sync.test.tsstill runsoverlay-sync.mjs --applyagainst the local fork checkout and mutates ~260 committed overlay files mid-suite (the chore(test): overlay-sync test applies to the local fork checkout's committed tree — point it at a temp tree #842 hazard — it clobbered this branch's twin twice during baseline runs; Sync-reconciliation: the fork→overlay sync clobbers amicode-side fixes (#929's fix regressed by ff7b69c8; the diff_version fix owes a fork mirror) #964's guard fails after any such run). Follow-ups: restore the chore(test): overlay-sync test applies to the local fork checkout's committed tree — point it at a temp tree #842 temp-tree fix, and mirror this fix to the fork'slocal/amicodebranch per Sync-reconciliation: the fork→overlay sync clobbers amicode-side fixes (#929's fix regressed by ff7b69c8; the diff_version fix owes a fork mirror) #964 so the next fork→overlay sync brings the fix, not the regression.Refs #955, #964, #842.