## 2026-10-02T02:21:22Z
You are worker_m2_1.
Working directory: c:\Projects\FreeExile\.agents\teamwork\worker_m2_1
Authoritative request: c:\Projects\FreeExile\.agents\teamwork\ORIGINAL_REQUEST.md (specifically section ## 2026-10-02T01:42:06Z). You MUST read this file first.
Project scope: c:\Projects\FreeExile\.agents\teamwork\orchestrator_13\PROJECT.md
Survey report to study:
- c:\Projects\FreeExile\.agents\teamwork\explorer_survey_tests_1\survey_report.md

MANDATORY INTEGRITY WARNING:
DO NOT CHEAT. All implementations must be genuine. DO NOT hardcode test results, create dummy/facade implementations, or circumvent the intended task. An auditor will independently verify your work. Integrity violations WILL be detected and your work WILL be rejected.

Your exclusive write ownership files:
- tools/lint/check_i18n_hygiene.py
- tests/unit/test_i18n_event_bus.py
- tests/e2e/test_i18n_reactive_switching_e2e.py

Mission: Implement Milestone 2 — Automated Anti-Regression & Linter Suite (R3).

Tasks:
1. Static Linter (tools/lint/check_i18n_hygiene.py):
   - Implement Python 3.11 static analyzer following the pattern of existing linters in tools/lint/.
   - Rule 1: Scan UI JavaScript files (client/webapp/js/ui/chat_ui.js and target UI modules) for hardcoded Vietnamese strings / diacritics ([\u00C0-\u1EF9]). Allow comments and allowlist default fallback parameters if appropriately structured.
   - Rule 2: 9-language dictionary parity verification for client/webapp/js/data/i18n_catalog.js and client/webapp/js/data/chat_i18n_catalog.js across all 9 languages (vi, en, zh, ja, ko, th, de, ru, es).
   - Rule 3: Missing key resolution (detect dangling data-i18n or data-chat-i18n keys referenced in HTML/templates that do not exist in catalogs).
   - CLI flags: --strict (exit code 1 on errors), --json-out <path>.
   - Soft cap: <= 350 lines (GEMINI.md).

2. Unit Test Suite (tests/unit/test_i18n_event_bus.py):
   - Implement pytest / unittest suite with 23 comprehensive test cases across the 5 groups designed in explorer_survey_tests_1/survey_report.md:
     - Group 1: Observer / Event Bus mechanics (subscribe, onLocaleChanged, CustomEvent, multiple subscribers, exception isolation, unsubscription).
     - Group 2: Fallback chaining and parameter interpolation ({channel}, {sec}, {level}).
     - Group 3: 9-language dictionary parity & key presence for channels, permissions, microcopy, rarities, elements, tooltips.
     - Group 4: Chat UI reactive DOM integration without page reload.
     - Group 5: Edge cases, null/empty keys, invalid locales, localStorage persistence.
   - Soft cap: <= 350 lines.

3. E2E Test Suite (tests/e2e/test_i18n_reactive_switching_e2e.py):
   - Implement automated E2E test verifying live reactive language switching without page reload.
   - Supports headless execution (via Playwright msedge or Node.js/DOM simulation).
   - Asserts zero reload, dynamic DOM updates of tabs, placeholders, buttons, cooldown badges, and 0 console errors.
   - Soft cap: <= 350 lines.

4. Run and verify all suites:
   - python tools/lint/check_i18n_hygiene.py --strict (MUST pass with code 0).
   - pytest tests/unit/test_i18n_event_bus.py (all 23 tests MUST pass).
   - pytest tests/e2e/test_i18n_reactive_switching_e2e.py (MUST pass).
   - python tools/lint/check_code_and_doc_hygiene.py --strict (MUST pass with code 0).

5. Reporting:
   - Write implementation report to c:\Projects\FreeExile\.agents\teamwork\worker_m2_1\implementation_report.md.
   - Write standard 5-component handoff.md in your working directory.
   - Send completion message back to orchestrator_13.
