refactor(ui): zero mock data in logged-in views (v1.22) - #94
Merged
Merged
Conversation
…/api/models (v1.22)
6 tasks
argszero
added a commit
that referenced
this pull request
Sep 15, 2026
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.
argszero
added a commit
that referenced
this pull request
Sep 15, 2026
…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.
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
Systematic cleanup per host rant
2026-08-19T15:54:06(登录态零 mock — any view in logged-in state must not renderdata.jsmock data; mock only for guest mode, and guest should be as real as possible).Frontend (
ui/js/app.js,ui/js/data.js,ui/js/i18n.js):TRANSACTIONS,SHARINGS,API_KEYS,EMPLOYEES,DEPARTMENTS,USAGE_MODEL,USAGE_EMP,OPERATOR_USERS,RAISE_REQUESTS; removed fictionalmulti/successfromMARKET.Live.x ? view(Live.x) : loadErrorHtml/loadErrorRow(empty state + retry)— never falls back toD.*.loadErrorRow(tbody-safe) added; retry buttons wired for all views (dash/sharings/market/tx/api-keys/admin-emp/usage/org/raise/ops)./api/wallet+/api/dashboard(+ real/api/transactionstotal); sparkline/aggregation mock only in guest mode./api/modelsexclusively (failure → retry); provider filter rebuilt from live providers;multi = available_keys >= 2; success rate not shown (backend has no such field); guest mock rows no longer show fake success.sendChat) no longer writesD.TRANSACTIONS(P2-D candidate pending); wallet mock topup keeps session balance only.Backend (
src/dao.rs,src/gateway.rs):GET /api/modelsnow returnscontext_window(frommodels.context_window) so logged-in market ctx is real data; test updated.Docs:
ui/README.mdv1.22 section登录态零 mock 约定(kept objects / deleted objects / degradation pattern / acceptance).Related
Host rant
2026-08-19T15:54:06.168447+08:00— 系统性清理 · 登录态零 mock(any page must not show data.js fake data in logged-in state).Tests
cargo test: 111/111 passedcargo fmt --check: cleancargo clippy --all-targets -- -D warnings: cleannode --checkon all ui/js files: clean