Skip to content

Commit 6936973

Browse files
authored
fix(ui): re-list outcome must come from the same entry as the action (#265)
A sharing key has three reachable statuses (`on` / `paused` / `off`): PATCH /api/sharings/:id accepts all three, and GET /api/sharings applies no status filter, so a soft-deleted row stays in the list. The row button labels the transition from the CURRENT status (Pause / Resume / Re-list), while the outcome toast picked it from the NEXT status with a two-valued ternary (`s.status === "on" ? "paused" : "on"`) -- so `off -> on` (re-list) was reported as a resume: button "Re-list", toast "Resumed sharing of ...". The key naming that branch, `share.toggle.relisted`, is present in both language packs and unreachable -- an unreachable key is the fingerprint of a lost branch. Provenance is drift, not a trade-off: 68f9f70 (#86) introduced the three-way button, 89963f3 (#94) replaced the mock's three-branch toggle with the two-branch ternary. - add `SHARE_TOGGLE` (status -> { label, next, outcome }): the button's action, its next status and its outcome text now come from the SAME entry, read by both consumers through `shareToggle(s.status)`. - new static gate `state_gate::the_sharing_toggle_outcome_comes_from_the_same_entry_as_its_action`: share.toggle.* literals may only live inside the table; the table's key set must equal `SHARE_STATUS`'s (both derived from source); the label/outcome columns must be unique per entry; and the handler (derived as the endpoint that sends a NON-literal status to /api/sharings/) must not name a share.toggle.* key nor branch on a status literal, and must share exactly one accessor with the button markup. Extractor self-proofs use synthetic inputs. - i18n positive controls recalibrated from what the gate reported: T() literals 542 -> 537, distinct 433 -> 428 (five literal call sites became table entries). - ui/README.md: rule + measured scope; index.html cache-bust for app.js.
1 parent ba486b2 commit 6936973

5 files changed

Lines changed: 661 additions & 7 deletions

File tree

‎src/i18n_pack.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ const ZH_KEY_COUNT: usize = 811;
9898
const EN_KEY_COUNT: usize = 811;
9999
const STATIC_ATTR_COUNT: usize = 332;
100100
const STATIC_ATTR_DISTINCT: usize = 307;
101-
const T_LITERAL_COUNT: usize = 542;
102-
const T_LITERAL_DISTINCT: usize = 433;
101+
const T_LITERAL_COUNT: usize = 537;
102+
const T_LITERAL_DISTINCT: usize = 428;
103103

104104
/// 切出语言包区段(起点标记 → 终点标记,含起点)。
105105
fn pack_region<'a>(src: &'a str, start_mark: &str, end_mark: &str) -> &'a str {

0 commit comments

Comments
 (0)