test(i18n): every pack key must reach a consumer - #266
Merged
Merged
Conversation
The three existing pack gates all ask the same direction: is every key that IS referenced present in both packs? Nothing asked the other question, so a key nobody references is invisible to CI -- and an unreachable key is not harmless: `share.toggle.relisted` sat in both packs unreachable, and it was the fingerprint of a lost branch (the re-list outcome, fixed in #265). This adds `every_pack_key_reaches_a_consumer`: the whole pack must be reachable, with today's residue frozen as a sunset list rather than a registry exemption. - `src/i18n_pack.rs` (test-only: `main.rs` compiles it as `#[cfg(test)] mod`): - `ui/js/data.js` joins the consumer corpus; - the predicate: a key is reachable iff it occurs at a key-token boundary in the comment-stripped corpus (`app.js` / `api.js` / `data.js`, `index.html`, and the code parts of `i18n.js` outside its pack sections) or begins with a dynamic prefix derived from the corpus itself (`share.day.`); - `UNREACHABLE_PACK_KEYS`: the sunset list, 59 keys, each labelled with the class the census arrived at; - the gate asserts the computed set == the declared set EXACTLY: a new unreferenced key, a stale entry, or a wired-up sunset key all turn it red; - the predicate self-proof runs on synthetic inputs. - `ui/README.md`: the rule, the CI coverage and the scope (the gate pins the list, it deletes no key). No production code path changes, no config or data-structure change.
argszero
added a commit
that referenced
this pull request
Sep 21, 2026
Ships the 10 PRs merged since v0.7.25 (#261-#270). No schema change, no config change, so the deployment-side config.toml needs no edit. One fact, one source / display must equal what it consumes (frontend, 6 places) - #261 read the spendable half of the wallet payload when refreshing your own balance; #262 the transactions payload signature covers the time range, with one reload trigger shared by the four controls; #263 the settings controls are either wired or explicitly inert; #265 the re-list outcome comes from the same entry as its action; #268 the sharing form shows a plan's label, not its config id; #269 the ops card stops reading a key's status count as a health verdict. i18n reachability - #266 every pack key must reach a consumer (the gate), and #270 drops the 23 keys that gate proved unreachable: ZH/EN key count 811 -> 788, sunset list 59 -> 36. Gateway - #267 applies the body limit where axum actually reads it (per-route DefaultBodyLimit, 8 MiB on the three gateway routes; unauthenticated endpoints keep the 2 MiB default). This is the application half of rant 2026-09-18T09:14:18. It also corrects the false v0.7.10 "raised to 70MB" CHANGELOG line, which described installing a layer rather than raising a limit. - Cargo.toml / Cargo.lock: 0.7.25 -> 0.7.26. - CHANGELOG.md: v0.7.26 entry plus the v0.7.10 correction. - ui/index.html cache-bust left as-is: this release touches no UI file; the live values are app.js 20260921-2 / i18n.js 20260921-2. cargo test 302 passed; cargo fmt --check clean; clippy -D warnings clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The language packs are two files, and all three existing gates ask the same direction: is every key
that is referenced present in both packs? Nothing asked the reverse question — so a key that nobody
references is invisible to CI, and that is not harmless:
share.toggle.relistedsat in both packsunreachable, and that unreachable key was the fingerprint of a lost branch (the re-list outcome, fixed in
#265). A pack key with no consumer is either dead weight or evidence that a code path went missing.
This lands
every_pack_key_reaches_a_consumer: the whole pack must be reachable, with today's residuefrozen as a sunset list rather than a registry exemption.
Provenance: the change was written in the worktree on 2026-09-15 (branch
fix/pack-key-reachability-gate,created 16:26) and left uncommitted when the cycle was cut short — since then every run of the evolution
task was forced read-only by the dirty-tree guard, so it could not be committed by the task itself. It is
landed here on the task's behalf; nothing in it has been altered except by the measurements below.
Related Issue
Changes
src/i18n_pack.rs— test-only module (main.rscompiles it as#[cfg(test)] mod i18n_pack, so noproduction code path and no binary-size change):
DATA_JSjoins the consumer corpus:ui/js/data.jsfeedsmarketRows()and friends, so a keyreferenced only there is still reachable (it was outside the corpus before).
alphanumeric +
_.-, soa.bis not matched by a substring ofa.bc) in thecomment-strippedconsumer corpus —
ui/js/app.js/api.js/data.js,ui/index.html(HTML comments stripped), andthe parts of
ui/js/i18n.jsoutside its pack sections — or begins with a dynamic prefixderived from the corpus itself (
T("share.day." + …)), not from a hand-written roster.UNREACHABLE_PACK_KEYS— the sunset list: 59 keys, each labelled with the class the censusarrived at (
old-design30 ·dup-sibling11 ·zero-mock9 ·neutral-literal4 ·composite2 ·rename1 ·weak-should-wire1 ·host-decision1). The list is a contract, not an exemptionregistry: it may only shrink.
every_pack_key_reaches_a_consumer— asserts the computed set equals the declared setexactly (not "⊆"). Three shapes turn it red: a newly unreferenced key; a list entry whose key has
become reachable again (re-wire a sunset key and you must drop its entry in the same change); an entry
naming a key that no longer exists.
pack_reachability_checker_detects_injected_defects— the predicate self-proof on synthetic inputsonly (token boundary, comments are not consumers, an empty corpus makes everything unreachable).
ui/README.md— the rule, the CI coverage, and the measured scope: the gate pins the list(shrinking it — the 23 safely deletable keys — is a separate round), and the dynamic-prefix arm is
redundant on today's real corpus (
share.day.1..7are statically bound inui/index.htmlas well), soits tooth is proven by the synthetic inputs rather than by live drift.
No config or data-structure change, so no example file needs updating.
Tests
cargo testpasses — 297 passed (was 295; +2 = the gate and its self-proof)cargo fmt --checkpassescargo clippy --all-targetsreports no warningKillability — both directions of the equality, in place, restored byte-for-byte
(
src/i18n_pack.rsmd57a30a726df201bc733fa77d7c8d58517before and after):login.forgot)新增的不可达键 … : ["login.forgot"]probe.bogus.key)清单里已可达 / 已不存在的键 … : ["probe.bogus.key"]Checklist
fix/…)