# Empirical Adversarial Challenge Report: UI Microcopy, Typography & Parenthetical Streamlining

## 1. Observation

### 1.1 Empirical Test Suite Execution Results
The standard regression suites and independent adversarial stress test harness were executed directly from PowerShell CLI:

1. **Standard Pytest E2E Suite**:
   ```bash
   pytest tests/e2e/test_ui_typography_i18n_wiki_streamlining_e2e.py -v
   ```
   **Output**:
   ```text
   ============================= 60 passed in 0.25s ==============================
   ```

2. **Standard Unittest Localization Engine Suite**:
   ```bash
   python -m unittest tests/unit/test_webapp_localization_engine.py -v
   ```
   **Output**:
   ```text
   Ran 16 tests in 0.140s
   OK
   ```

3. **Empirical Adversarial Stress Test Harness (`adversarial_ui_stress_test.py`)**:
   ```bash
   python .agents/teamwork/challenger_streamline_1/adversarial_ui_stress_test.py
   ```
   **Output**:
   ```text
   ======================================================================
   EMPIRICAL ADVERSARIAL STRESS TEST HARNESS — CHALLENGER STREAMLINE 1
   ======================================================================
   --- 1. Testing Interactive Controls Word Count (<= 2 Words) ---
   Total Interactive Word Count Violations: 0

   --- 2. Testing Parenthetical Substrings '(' or ')' in UI Labels ---
   Total Parenthetical Violations: 16

   --- 3. Testing Zero Serif Font References in CSS & JS Renderers ---
   Total Serif Font Violations: 0

   --- 4. Running Standard Test Suites ---
   pytest E2E: PASS (exit 0)
   unittest Localization: PASS (exit 0)

   ======================================================================
   FINAL ADVERSARIAL VERDICT: REQUEST_CHANGES
   ======================================================================
   ```

---

### 1.2 Observed Verified Successes
1. **Interactive Controls Word Count ($\le 2$ words)**:
   - Exhaustive parsing of all 198 interactive controls across `client/webapp/index.html` and 6 template catalogs (`template_catalog_activities.js`, `template_catalog_auth.js`, `template_catalog_endgame.js`, `template_catalog_inventory.js`, `template_catalog_system.js`, `template_catalog_world.js`).
   - Static DOM text and dynamic `data-i18n` runtime resolution checked across all 9 languages (`vi`, `en`, `zh`, `ja`, `ko`, `th`, `de`, `ru`, `es`).
   - **Result**: 0 violations. 100% of interactive controls satisfy the $\le 2$ words limit (and CJK $\le 4/6$ glyphs, Thai $\le 12$ chars).
2. **Typography Modernization (Zero Serif Fonts)**:
   - Scanned all active CSS files in `client/webapp/css/*.css` (`main.css`, `hud_skills.css`, `modals.css`, `trailer.css`).
   - Scanned all canvas/SVG JS renderers (`world_renderer.js`, `vfx_renderer.js`, `canvas_renderer.js`, `entity_renderer.js`, `telegraph_renderer.js`, `weapon_swing_renderer.js`, `endgame_atlas.js`, `war_fog_renderer.js`, `hud_orbs.js`, `chat_ui.js`).
   - Scanned `client/webapp/index.html` (Google Fonts CDN link, `tailwind.config`, inline styles).
   - **Result**: 0 violations. Zero occurrences of `Cinzel`, `Noto Serif`, `Georgia`, or generic `serif` (not preceded by `sans-`).
3. **Multilingual Master Lexicon (`i18n_catalog.js`)**:
   - Master catalog is completely clean of parenthetical substrings across all 143 keys in all 9 languages.

---

### 1.3 Verbatim Observed Failures: 16 Lingering Parenthetical Substrings in UI Labels & Headings
Empirical AST/DOM parsing revealed 16 instances where parenthetical substrings `(` or `)` remain in user-facing UI labels, headings, buttons, and attributes:

1. **`client/webapp/index.html` (Line 34)**:
   ```html
   <div id="hud-char-status-card" ... data-tooltip-title="Tân Thủ Lưu Đày (Lv.1)" ...>
   ```
   - **Violation**: Attribute `data-tooltip-title` contains `(Lv.1)`.

2. **`client/webapp/js/ui/templates/template_catalog_activities.js` (Line 148)**:
   ```html
   <h3 class="text-sm font-bold text-cyan-300">Thanh Toán Web3 Crypto (Non-Custodial)</h3>
   ```
   - **Violation**: `<h3>` heading contains `(Non-Custodial)`.

3. **`client/webapp/js/ui/templates/template_catalog_auth.js` (Line 97)**:
   ```html
   <label class="block text-stone-300 font-semibold mb-1">Mật Khẩu <span class="text-rose-400">* (Tối thiểu 8 ký tự)</span></label>
   ```
   - **Violation**: `<label>` text contains `(Tối thiểu 8 ký tự)`.

4. **`client/webapp/js/ui/templates/template_catalog_auth.js` (Line 102)**:
   ```html
   <label class="block text-stone-300 font-semibold mb-1">Tên Nhân Vật / Hiệu Tự (Tùy chọn)</label>
   ```
   - **Violation**: `<label>` text contains `(Tùy chọn)`.

5. **`client/webapp/js/ui/templates/template_catalog_auth.js` (Line 161)**:
   ```html
   <label class="block text-stone-300 text-xs font-semibold">Mã OTP Kích Hoạt (6 chữ số)</label>
   ```
   - **Violation**: `<label>` text contains `(6 chữ số)`.

6. **`client/webapp/js/ui/templates/template_catalog_auth.js` (Line 206)**:
   ```html
   <span class="text-xs">Ghi nhớ đăng nhập trên thiết bị (Lưu token an toàn)</span>
   ```
   - **Violation**: Checkbox `<label>` text contains `(Lưu token an toàn)`.

7. **`client/webapp/js/ui/templates/template_catalog_auth.js` (Line 224)**:
   ```html
   <span>🌐</span> Đăng Nhập Bằng Tài Khoản Liên Kết (OAuth 2.0 / OIDC)
   ```
   - **Violation**: `<h3>` heading text contains `(OAuth 2.0 / OIDC)`.

8. **`client/webapp/js/ui/templates/template_catalog_auth.js` (Line 317)**:
   ```html
   <span>⚔️</span> Danh Sách Nhân Vật (Cấp 1 & Mùa Giải)
   ```
   - **Violation**: `<h4>` heading text contains `(Cấp 1 & Mùa Giải)`.

9. **`client/webapp/js/ui/templates/template_catalog_auth.js` (Line 422)**:
   ```html
   <label class="block text-stone-300 font-semibold">Tên Nhân Vật (Hiệu Tự)</label>
   ```
   - **Violation**: `<label>` text contains `(Hiệu Tự)`.

10. **`client/webapp/js/ui/templates/template_catalog_auth.js` (Line 423)**:
    ```html
    <input id="input-char-name" type="text" placeholder="Nhập tên nhân vật (3 - 24 ký tự)" ...>
    ```
    - **Violation**: `placeholder` attribute contains `(3 - 24 ký tự)`.

11. **`client/webapp/js/ui/templates/template_catalog_inventory.js` (Line 139)**:
    ```html
    <button onclick="window.toggleBagModal()" ... title="Mở Túi Đồ Sinh Tồn (I / B)">
    ```
    - **Violation**: Interactive `<button>` title attribute contains `(I / B)`.

12. **`client/webapp/js/ui/templates/template_catalog_inventory.js` (Line 202)**:
    ```html
    <button onclick="window.toggleCharacterModal()" ... title="Mở Đồ Đang Mặc (C)">
    ```
    - **Violation**: Interactive `<button>` title attribute contains `(C)`.

13. **`client/webapp/js/ui/templates/template_catalog_inventory.js` (Line 328)**:
    ```html
    <span class="text-stone-300">Tự động nhặt Trang Bị Cực Phẩm (Hoàng Kim):</span>
    ```
    - **Violation**: Filter `<label>` text contains `(Hoàng Kim)`.

14. **`client/webapp/js/ui/templates/template_catalog_inventory.js` (Line 474)**:
    ```html
    <span>💎</span> Ma Trận 15 Tiers Dòng Thuộc Tính (T1 - T15)
    ```
    - **Violation**: `<h3>` heading text contains `(T1 - T15)`.

15. **`client/webapp/js/ui/templates/template_catalog_system.js` (Line 324)**:
    ```html
    <button id="tab-btn-feedback-history" ...>
      <span>📜</span> Lịch Sử (<span id="txt-feedback-badge-count" class="text-amber-400/90 font-mono font-bold">0</span>)
    </button>
    ```
    - **Violation**: Interactive Tab `<button>` text contains `(` and `)`.

16. **`client/webapp/js/ui/templates/template_catalog_system.js` (Line 356)**:
    ```html
    <span class="text-[10px] text-stone-500 font-normal">(Tối thiểu 10 ký tự)</span>
    ```
    - **Violation**: Form `<label>` text contains `(Tối thiểu 10 ký tự)`.

---

## 2. Logic Chain

1. **Analysis of Task Directives & Acceptance Criteria**:
   - The user dispatch explicitly commanded:
     > "Task: Write and execute an adversarial test harness in your working directory to empirically verify: ... 2. Zero parenthetical substrings `(` or `)` in user-facing UI labels and headings."
   - The original request requirement §R1 and Acceptance Criteria states:
     > "Loại bỏ hoàn toàn định dạng nhãn song ngữ kép cồng kềnh `Tiếng Việt (English)` trên các nút bấm... Không còn bất kỳ nhãn UI nào chứa định dạng song ngữ kép dạng `A (B)`."
2. **Analysis of Blindspots in Existing Standard Test Suites**:
   - In `tests/e2e/test_ui_typography_i18n_wiki_streamlining_e2e.py`:
     ```python
     def has_bilingual_parens(text: str) -> bool:
         return bool(re.search(r"\([A-Za-z0-9\s\-\+]+\)", text))
     ```
     - **Blindspot 1**: The regex only checks ASCII alphanumerics. Any Vietnamese accented phrase inside parentheses like `(Tối thiểu 8 ký tự)`, `(Hoàng Kim)`, `(Cấp 1 & Mùa Giải)` was ignored by the regex.
     - **Blindspot 2**: It only checked `clean_words(b)[0]` in `index.html` buttons. It never checked `<h1>`-`<h6>` headings or `<label>` tags.
     - **Blindspot 3**: `(Lv.1)` contained a period `.`, which failed the character class `[A-Za-z0-9\s\-\+]` and slipped past `test_f02_tooltip_titles_no_bilingual`.
   - In `tests/unit/test_webapp_localization_engine.py`:
     - `test_zero_bilingual_or_parenthetical_formats_in_button_labels` only checked the dictionary strings in `I18N_CATALOG_JS`, which was clean, but did not validate the template catalog DOM strings.
3. **Impact Assessment**:
   - In `template_catalog_system.js:324`, `<button id="tab-btn-feedback-history">` literally contains `Lịch Sử (0)`. An interactive button directly displaying parentheses violates both Requirement 1 and Requirement 2.
   - In `template_catalog_inventory.js:139,202`, buttons have `title="Mở Túi Đồ Sinh Tồn (I / B)"` and `title="Mở Đồ Đang Mặc (C)"`.
   - In `index.html:34`, `#hud-char-status-card` has `data-tooltip-title="Tân Thủ Lưu Đày (Lv.1)"`.
   - In multiple modal templates, headings and labels include parenthetical clarifications `(Non-Custodial)`, `(OAuth 2.0 / OIDC)`, `(T1 - T15)`, `(Hiệu Tự)`.
4. **Remediation Feasibility**:
   - All 16 instances have direct drop-in replacements that eliminate parentheses while preserving ergonomic clarity and technical specifications.

---

## 3. Caveats
- No code in `client/` or `server/` was altered during this review, strictly honoring the Review-Only constraint.
- The standard test suites (`pytest` and `python -m unittest`) continue to pass 100% on the current codebase because the tests themselves had narrow assertions that permitted these 16 parenthetical patterns to slip through.

---

## 4. Conclusion
Explicit Verdict: **REQUEST_CHANGES**.

While Requirements 1 (interactive word count $\le 2$ words) and 3 (zero serif fonts across all CSS and JS renderers) are 100% satisfied, Requirement 2 (**Zero parenthetical substrings `(` or `)` in user-facing UI labels and headings**) fails empirically with 16 identified violations.

### Recommended Remediation Actions:
1. **`client/webapp/index.html`**:
   - Line 34: Change `data-tooltip-title="Tân Thủ Lưu Đày (Lv.1)"` $\to$ `data-tooltip-title="Tân Thủ Lưu Đày"` or `data-tooltip-title="Tân Thủ"`.
2. **`client/webapp/js/ui/templates/template_catalog_activities.js`**:
   - Line 148: Change `Thanh Toán Web3 Crypto (Non-Custodial)` $\to$ `Thanh Toán Web3`.
3. **`client/webapp/js/ui/templates/template_catalog_auth.js`**:
   - Line 97: Change `Mật Khẩu * (Tối thiểu 8 ký tự)` $\to$ `Mật Khẩu *`.
   - Line 102: Change `Tên Nhân Vật / Hiệu Tự (Tùy chọn)` $\to$ `Tên Nhân Vật`.
   - Line 161: Change `Mã OTP Kích Hoạt (6 chữ số)` $\to$ `Mã OTP Kích Hoạt`.
   - Line 206: Change `Ghi nhớ đăng nhập trên thiết bị (Lưu token an toàn)` $\to$ `Ghi nhớ đăng nhập`.
   - Line 224: Change `Đăng Nhập Bằng Tài Khoản Liên Kết (OAuth 2.0 / OIDC)` $\to$ `Đăng Nhập Liên Kết`.
   - Line 317: Change `Danh Sách Nhân Vật (Cấp 1 & Mùa Giải)` $\to$ `Danh Sách Nhân Vật`.
   - Line 422: Change `Tên Nhân Vật (Hiệu Tự)` $\to$ `Tên Nhân Vật`.
   - Line 423: Change `placeholder="Nhập tên nhân vật (3 - 24 ký tự)"` $\to$ `placeholder="Nhập tên nhân vật"`.
4. **`client/webapp/js/ui/templates/template_catalog_inventory.js`**:
   - Line 139: Change `title="Mở Túi Đồ Sinh Tồn (I / B)"` $\to$ `title="Túi Đồ"`.
   - Line 202: Change `title="Mở Đồ Đang Mặc (C)"` $\to$ `title="Nhân Vật"`.
   - Line 328: Change `Tự động nhặt Trang Bị Cực Phẩm (Hoàng Kim):` $\to$ `Tự động nhặt Trang Bị Hoàng Kim:`.
   - Line 474: Change `Ma Trận 15 Tiers Dòng Thuộc Tính (T1 - T15)` $\to$ `Ma Trận 15 Tiers Dòng Thuộc Tính`.
5. **`client/webapp/js/ui/templates/template_catalog_system.js`**:
   - Line 324: Change `Lịch Sử (<span id="txt-feedback-badge-count" class="...">0</span>)` $\to$ `Lịch Sử <span id="txt-feedback-badge-count" class="...">0</span>` (remove enclosing parentheses around the span).
   - Line 356: Change `(Tối thiểu 10 ký tự)` $\to$ `Tối thiểu 10 ký tự` (remove parentheses).
6. **`tests/e2e/test_ui_typography_i18n_wiki_streamlining_e2e.py`**:
   - Update `has_bilingual_parens` or add an adversarial test method asserting `"(" not in text and ")" not in text` across all template buttons, labels, and headings to prevent regressions.

---

## 5. Verification Method

To reproduce and verify the findings:

1. **Execute the Empirical Adversarial Harness**:
   ```bash
   python .agents/teamwork/challenger_streamline_1/adversarial_ui_stress_test.py
   ```
   - **Expected Result**: Exits with code 1; reports exactly 16 parenthetical violations and saves structured JSON to `.agents/teamwork/challenger_streamline_1/adversarial_results.json`.

2. **Execute Pytest E2E Suite**:
   ```bash
   pytest tests/e2e/test_ui_typography_i18n_wiki_streamlining_e2e.py -v
   ```
   - **Expected Result**: 60 passed.

3. **Execute Unittest Localization Suite**:
   ```bash
   python -m unittest tests/unit/test_webapp_localization_engine.py -v
   ```
   - **Expected Result**: 16 passed.

4. **Invalidation Conditions (When to re-test and APPROVE)**:
   - When all 16 quoted lines above have their `(` and `)` removed.
   - Re-running `python .agents/teamwork/challenger_streamline_1/adversarial_ui_stress_test.py` produces `Total Parenthetical Violations: 0` and logs `FINAL ADVERSARIAL VERDICT: APPROVE`.
