fix(mascot): complete Yue locale coverage and konami sliding window #156
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
javascript
question
severity: high
severity: low
severity: medium
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
isyuricunha/website!156
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/yue-mascot-audit-fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Mascot audit fixes: Yue's AI chat was missing response-language instructions for three of the seven supported locales, and the Konami easter egg used a broken key buffer that could never trigger the code in realistic use.
Evidence / Reproduction
build_yue_system_messagelooked up the response-language instruction in a table keyed byen, pt, fr, de, zh:esandjawere absent entirely: users of/es/and/ja/got an empty instruction and the mascot answered in English.zhdid not match any website locale: the canonical locale iszh-CN, so the Chinese instruction was also unreachable.The Konami handler pushed every key into a buffer that only reset once it exceeded the code length. After a single wrong key, the buffer held a poisoned window (e.g.
[x, ArrowUp, ArrowUp, ArrowDown, ...]) andevery()compared it against the code from index 0, so the code could only ever be detected if typed as the very first 10 keys of a session.Root cause
packages/i18n/src/config.ts(missinges,ja; stalezhkey instead ofzh-CN).Fix
localeInstructionsnow covers all seven locales with the canonicalzh-CNkey, typedRecord<string, string>.localStorageside effect moved out of the state updater (updaters must stay pure).Tests
yue-locale-coverage.test.ts: asserts every locale from the i18n registry produces a respond-in-language instruction, with explicit cases forzh-CN,ja, andes. Failed before the fix (3/3 red), passes now.use-mascot-state.test.tsx: new case activating the Konami code when preceded by a wrong key. Failed on the old buffer (red), passes with the sliding window.Validation
Live verification on production before the fix: mascot widget renders, opens, and the AI chat answers (PT);
/api/mascot/latest-postand/api/ai/chat/statusreturn 200.Residual risks
konamiSequenceRefis module-instance state: it intentionally survives re-renders but resets on full page reload (pre-existing behavior).The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment