|
| 1 | +# design — align-events-vocabulary |
| 2 | + |
| 3 | +## Why bundle the two findings |
| 4 | + |
| 5 | +Both findings are A1-era cleanup: the seen-side EN wording and |
| 6 | +the filter-keys hint both got written when the cycle had five |
| 7 | +buckets, before the three new transition event types were added. |
| 8 | +They touch the same `i18n.py` / `tui.py` files and the same |
| 9 | +spec section. Shipping them in one PR avoids a second |
| 10 | +re-translation cycle for a one-string change. |
| 11 | + |
| 12 | +## i18n key rename, not value-only edit |
| 13 | + |
| 14 | +The catalog entries are `"device joined: "` → `"设备出现:"`. The |
| 15 | +ZH value is already correct. So the change is on the EN side — |
| 16 | +the catalog key (which is also the EN-rendered string in |
| 17 | +diting's i18n model). |
| 18 | + |
| 19 | +The clean way to do this: |
| 20 | + |
| 21 | +```python |
| 22 | +# i18n.py — was |
| 23 | +"device joined: ": "设备出现:", |
| 24 | +"service joined: ": "服务出现:", |
| 25 | +"host joined: ": "主机出现:", |
| 26 | + |
| 27 | +# becomes |
| 28 | +"device seen: ": "设备出现:", |
| 29 | +"service seen: ": "服务出现:", |
| 30 | +"host seen: ": "主机出现:", |
| 31 | +``` |
| 32 | + |
| 33 | +Call sites at `tui.py:1947, 1970, 1993` flip from |
| 34 | +`t("device joined: ")` → `t("device seen: ")` etc. |
| 35 | + |
| 36 | +If any old build reads a JSONL log produced by a new build, |
| 37 | +the analyzer is locale-stable English keys (`ble_device_seen`) |
| 38 | +— the renamed UI string never enters the log. No back-compat |
| 39 | +concern there. |
| 40 | + |
| 41 | +## Filter-keys hint wording |
| 42 | + |
| 43 | +Current: `Press 1/2/3/4/0 to filter; m or Esc to close`. |
| 44 | + |
| 45 | +Three options for the extended form: |
| 46 | + |
| 47 | +1. **Explicit:** `Press 1/2/3/4/5/6/7/0 to filter; m or Esc to close` |
| 48 | +2. **Range:** `Press 1–7 to filter, 0 to clear; m or Esc to close` |
| 49 | +3. **Implicit:** `Press 1–7/0 to filter; m or Esc to close` |
| 50 | + |
| 51 | +(1) is the obvious extension and what the audit recommended. |
| 52 | +(2) and (3) are more compact, but `1–7` is less mechanically |
| 53 | +discoverable than the keys-as-digits list — a user scanning the |
| 54 | +footer for which key sets `lan` does not learn that 7 is the |
| 55 | +answer without trying. (1) wins on user discoverability. |
| 56 | + |
| 57 | +Same expansion applies to the help-modal prose at |
| 58 | +`tui.py:612` / `i18n.py:880, 886`. ZH counterpart at |
| 59 | +`i18n.py:1249` likewise. |
| 60 | + |
| 61 | +## What the spec MUST change |
| 62 | + |
| 63 | +`openspec/specs/tui-shell/spec.md:135-147` lists the seven A1 |
| 64 | +types' rendered formats with `device joined` / `service joined` |
| 65 | +/ `host joined`. Three bullets and one scenario example flip |
| 66 | +to `seen`. Everything else in the requirement stays. |
| 67 | + |
| 68 | +The filter-cycle requirement at `spec.md:96-117` is already |
| 69 | +correct (it lists the eight buckets and the scenarios). The |
| 70 | +audit-finding is about the prose hint, not the spec — no spec |
| 71 | +change needed for finding #2. |
| 72 | + |
| 73 | +## Test changes |
| 74 | + |
| 75 | +Three string-only flips in `test_tui_helpers.py`: |
| 76 | + |
| 77 | +- `:2659` `assert "device joined" in text` → `assert "device seen" in text` |
| 78 | +- `:2692` `assert "service joined" in text` → `assert "service seen" in text` |
| 79 | +- `:2725` `assert "host joined" in text` → `assert "host seen" in text` |
| 80 | + |
| 81 | +No new tests needed for the i18n side — the existing tests |
| 82 | +exercise the formatter end-to-end. |
| 83 | + |
| 84 | +For finding #2, the audit recommends no new test — the prose |
| 85 | +itself is review-enforced (per TESTING.md row 362 for EN, 353 |
| 86 | +for ZH: "HelpScreen content review-enforced"). Adding a |
| 87 | +string-pinning test would couple the test to specific phrasing |
| 88 | +that may drift later; not worth the maintenance cost. |
| 89 | + |
| 90 | +## What this change does NOT touch |
| 91 | + |
| 92 | +- The JSONL `type` field. Already locale-stable English. |
| 93 | +- The `tui-shell` filter-cycle requirement (unchanged — only |
| 94 | + the prose-hint is stale, not the spec). |
| 95 | +- The `events` capability spec. Untouched. |
| 96 | +- The analyzer or any cross-session aggregation. Unaffected. |
| 97 | +- ZH catalog values. Already correct. |
0 commit comments