fix(i18n): drop the retired "shown once" claim from the generate-key toast - #320
Conversation
…toast `settings.ak.gen.ok` (both packs) told the user the full API key is shown "仅此一次" / "once". That sentence was true when it was written (#86, v1.21) and stopped being true in v1.22.1 (#95): `GET /api/api-keys` now returns the owner-visible `full_key` next to the masked `key` (`src/dao.rs`, pinned by `routes::tests`), `copyKey()` copies it straight from the list data, and the `Live.fullKeys` session cache is gone -- which is why #95's own message records "removed ... the 'shown once' logic" and deletes the sibling string `settings.ak.copy.once`. #95 removed the logic and one carrier and left this one restating the retired fact. The comment three lines below `copyKey()` still states the policy the string violates: 「绝不提示「仅生成时展示一次」」. Value-only fix; no key added or removed: - zh: 已生成新 API Key「{name}」(完整 key 可在列表中随时复制) - en: New API Key “{name}” generated (full key can be copied from the list anytime) The sibling comment that repeated the same retired fact ("完整 key 仅生成时可得") now names the mechanism, and `ui/index.html` bumps the two changed cache-bust tokens. No behaviour change: the list keeps showing the backend-masked value, the copy button keeps handing out `full_key`, and the `{name}` slot is kept in both packs. Key counts are untouched (688 keys before and after), so the i18n gates still pass unchanged.
|
Self-review (committer; Scope — 3 files, +7/−5, no production logic touched: two i18n string values (zh + en), one comment in What the change is — Verification
Blast radius — No outstanding review feedback; merging. |
Summary
Generating an API key in Settings toasts a claim the product retired in v1.22.1:
Both sentences were true when they were written (
68f9f70, #86, v1.21): the list endpoint returnedonly a masked key, the full value came back from
POST /api/api-keysand was kept in a session-onlyLive.fullKeyscache that a refresh dropped. #95 (799c18d, v1.22.1) closed that state — its ownmessage records "removed the Live.fullKeys session cache and the 'shown once' logic":
GET /api/api-keysnow returns the owner-visiblefull_keynext to the maskedkey(
src/dao.rs; pinned byroutes::tests→ "撤销前列表返回属主完整 key")copyKey()copiesk.full_keystraight from the list data, with the masked key only as afallback — so the full key is retrievable at any time, including after a reload
ui/README.mddocuments it as designed behaviour: 「一键复制完整 key……列表脱敏展示atk_live_****xxxx,复制为完整值」#95 removed that logic and one of its carriers (
settings.ak.copy.once, zh/en). This one stayedbehind, and so did a comment in the same function — while the code three lines below
copyKey()still states the policy the string violates:
// 防御性兜底:full_key 缺失时退化为复制脱敏 key,绝不提示「仅生成时展示一次」So the settings page tells the user to treat the key as unrecoverable while the list keeps a button
that recovers it. The wording is the only thing wrong: the mask-and-copy behaviour is fine and is left
alone.
Changes
ui/js/i18n.js—settings.ak.gen.okin both packs, value only:已生成新 API Key「{name}」(完整 key 可在列表中随时复制)New API Key “{name}” generated (full key can be copied from the list anytime)ui/js/app.js— the sibling comment that repeated the same retired fact(「完整 key 仅生成时可得」) now names the mechanism instead (
full_keyships with the row).ui/index.html— cache-bust tokens for the two changed assets (i18n.js,app.js→20260928-1).No key is added or removed (688 keys before and after; the
{name}slot is kept in both packs), nobackend change, no behaviour change. The declared-unreachable
settings.ak.gen.ok.mockis left exactlyas it is — it is registered in
UNREACHABLE_PACK_KEYSasold-design, and that axis is closed.No gate. The value restates a retired fact rather than encoding an invariant, and the repository's
standing decision on that axis is to fix the data and not to guard the prose (precedents: #309, #310,
#312–#315).
Related Issue
Tests
cargo test— 417 passed / 0 failed (the run at the parent commit is the same 417; thechange touches no tested byte but
ui/js/i18n.jsis read by the i18n gates, so the countmatters)
cargo fmt --check— cleancargo clippy --all-targets -- -D warnings— cleantmp/r110/verify.py, run against the tree under test viagit -C):on the pre-fix tree 8 legs are red — both pack values, "no shipped string value carries the
fact" (2 of 1701), "every surviving site is a comment line", and the three cache-bust legs —
on this branch all legs are green. The four legs that assert the behaviour the new sentence
describes (list returns
full_key,copyKeyconsumes it, the list is reloaded after generating,the Rust test pinning it) pass on both trees, which is the point: only the wording moved.
Checklist
fix/)