Repository navigation
fix(ui): remove the dead plan-note hint from the listing form - #177
Merged
Merged
Conversation
`showPlanHint()` appended ` · {note}` from the selected plan, but the only
reachable plan source (`Live.plans`, i.e. `GET /api/plans`) never returns a
`note` field: `src/config.rs`'s `Plan` struct has none and `[[plans]]` in
`config.example.toml` declares none (verified across all history). So for a
logged-in user the expression `pl.note` is always undefined, the ternary never
fires, and the suffix never renders — the hint keeps only the paygo/subscription
text.
The read became dead in `a2e40f2` ("fix(integration): 3 browser-found bugs"),
which switched the plan source from the `data.js` fallback to `GET /api/plans`
without carrying `note` across. `44a3040` cleaned up the sibling UI-only field
`keyPrefix` (read + i18n key + fallback field) but left `note` behind, because
at that point `note` had never had a config counterpart.
This removes the dead read and the now-unused `share.plan.note` key from both
language packs (its only call site was here), and corrects the `ui/README.md`
line that promised an endpoint hint the form can no longer show. The `note`
values in `ui/js/data.js`'s fallback `PLANS` are left in place: they are inert
(no longer referenced) and describe each plan's real endpoint conventions, so
surfacing them properly would mean promoting them to config `[[plans]]` — a
separate, product-level change.
No production Rust behaviour changes; the i18n gate control values follow the
extraction (786→785 keys, 538→537 call sites, 431→430 distinct).
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
showPlanHint()on the listing (上架) form appended a· {note}suffix describing the selected plan's endpoint conventions. That suffix can never render: the plan source it reads —Live.plans, i.e.GET /api/plans— has nonotefield.src/config.rs'sPlanstruct does not declare one, and[[plans]]inconfig.example.tomlhas never declared one (git log -S note -- config/config.example.tomlis empty across all history).So in the only reachable state,
pl.noteis alwaysundefined,(pl.note ? … : "")always takes the empty branch, and the hint silently shows only the paygo/subscription text. This removes the dead read and the now-unusedshare.plan.notekey, so the code, the language packs andui/README.mdstop promising a hint that cannot appear.The read became dead in
a2e40f2("fix(integration): 3 browser-found bugs — plans data source …"), which switched the plan source from thedata.jsfallback toGET /api/plans(Live.plans || D.PLANS) without carryingnoteacross.44a3040later removed the sibling UI-only fieldkeyPrefix— read site, fallback field and i18n key together — but deliberately keptnote, sincenotehad never had a config counterpart to drop. This is the same cleanup fornote, now that/api/plansis the single source of truth.Related Issue
None — no issue exists for this; the change is small and self-contained, so it goes straight to a PR per CONTRIBUTING ("请先开 Issue 讨论" applies to large changes such as new modules or architectural shifts).
Changes
ui/js/app.js—showPlanHint()no longer readspl.note; the hint keeps only the paygo/subscription label. A comment records why the suffix is gone, so it is not "restored" later.ui/js/i18n.js— removedshare.plan.notefrom both packs (zh and en), keeping the two key sets identical so thei18n_packparity gate stays green.ui/README.md— the sharing bullet claimed "选 Plan 后显示专属端点提示"; corrected to "显示 Plan 类型(按量 / 订阅)", which is what the form actually shows.ui/index.html— cache-bust?v=20260912-2→?v=20260912-3(5 refs).src/i18n_pack.rs— the maintained control values follow the extraction: 786→785 keys, 538→537 call sites, 431→430 distinct. Each value was read from the gate's own failure output, not computed by hand.notevalues inui/js/data.js's fallbackPLANSare left in place: they are now inert (no reader) and document each plan's real endpoint conventions, so surfacing them properly would mean promoting them into config[[plans]]— a separate, product-level change rather than a cleanup.Tests
cargo test— 165 passed / 0 failedcargo fmt --check— cleancargo clippy --all-targets -- -D warnings— cleani18n_packgates already cover this change and fired three times in sequence (key parity, then call sites, then distinct literals), which is the intended maintained-contract behaviour; every value was taken from the failure output.Verification of the fix (A/B, same generator, real pre-change source as baseline)
A runtime harness evaluates the real
showPlanHint— extracted fromgit show HEAD:ui/js/app.js(BEFORE) and from the working tree (AFTER) — against the real language packs loaded fromui/js/i18n.js, in both languages, with two plan sources: theGET /api/plansshape (nonote; the reachable path) and thedata.jsPLANSfallback (which still carriesnote).pl.notepresent in the function source· <note>按量计价的 key/Pay-as-you-go key· <note>The reachable-path text is byte-identical before and after — the suffix never rendered, so no user-visible change occurs; the change removes a dead read and a dead key. A positive control proves the harness is able to detect a suffix when one genuinely renders (with the old source and the old pack, the fallback path produces
按量计价的 key · 无订阅 plan,仅按量;OpenAI/Anthropic/Responses 端点), so the negative assertion is not vacuous. 12/12 assertions pass.Checklist
fix/)fix(ui): …)