Repository navigation
fix(ui): state the per-repository quota rule in the page banner - #1109
Conversation
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: CHANGES at 0a1cd56
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
- The behaviour is right:
src/views/pages.ts:956-970builds one banner for both pages,:1377-1385gates the dashboard onsetup.modelConfiguredand:3472-3478the console on the factsrc/app.ts:193-201computes, the same rulenextActionFor(:986) uses;npx tsx --test test/pages.test.ts test/notificationStack.test.ts→ 76/76 pass at this tip. - But this changes a user-visible sentence and adds a link on
/dashboardand/console, and the body carries no before/after screenshot at all (no image, no evidence ref): the owner rule of 2026-11-18 gives a UI PR without screenshots no PASS. - Add frames for the banner on both pages, zh and en, 1280 and 390 (before =
066a9cc8, after = the tip) to the body. - The tip also conflicts with current main in
test/pages.test.ts(both append at EOF;mergeable: false), so it needs a merge anyway — do both in one round and I re-judge the new sha. - The named residual (a mixed account now sees no banner) is a deliberate consequence of the account-wide fact and the card's own next action, not a defect; I will not hold the PR for it.
The exhausted-quota message fired on `quota.exhausted` alone while the page's own next action and job dispatch both read a per-repository rule, so an account whose repositories run on its own model was told on every load that its jobs cannot continue. One builder now makes the sentence for the dashboard and the console, it prints only for an account with a platform-funded repository, it states the split instead of the false claim, and it links /settings#model-providers. The console route reads the same `modelConfigured` fact the dashboard checklist already computed.
# Conflicts: # test/pages.test.ts
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: CHANGES at bd93c8f
Written-by: HugoXK-bot
src/app.ts:195-200: ownModelConfigured is true when any repository has a selection (repos.some(...)), so the condition at src/views/pages.ts:1384 and :3475 suppresses the banner for a mixed account — one own-model repository plus one platform-funded repository — although that platform repository's jobs are still paused by platformFundedFor (src/db.ts:5388-5395).
That contradicts the body ("prints only for an account with a platform-funded repository") and docs/architecture.md ("only for an account with a repository the platform pays for"), and it removes the only notice where the old banner at least said something; setup.modelConfigured is the checklist's "a model is configured" fact (src/views/checklist.ts:133), so do not repurpose it — pass a separate fact such as repos.some((repo) => store.platformFundedFor(viewer.user, repo.id)) and suppress only when it is false.
test/pages.test.ts covers all-own and all-platform but not mixed; add one (one own-model repository + one platform-funded repository, quota 0) asserting the banner is present, names the pause, links /settings#model-providers, and is absent only when no repository is platform-funded.
Verified and fine: evidence/1104 at d35ab30c carries the 20 frames, job 135654608031 prints the two quoted visual lines at this head, and the merge into main 95016f39 is clean with mock:check ok, 77/77 pages+notification tests and typecheck clean.
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS at 313260f
Written-by: HugoXK-bot
Replaces: bd93c8f
src/app.ts:209-211asks per repository (repos.some(platformFundedFor));/dashboardpassesallRepos(:1656) and/consoleits fulllistRepos(:1745), so the two surfaces cannot disagree.src/views/pages.ts:1393and:3485gate onquota.exhausted && platformFunded !== false, both throughquotaExhaustedNotice(:961) with the/settings#model-providerslink;setup.modelConfiguredis untouched.test/pages.test.ts:2827drives the mixed account at route level: the banner is present for one own-model plus one platform-funded repository, and drops only after the last platform-funded repository selects its own model; 78/78 at the tip and 78/78 after merging95016f39into it.- The 20 frames at
d35ab30cshow the same card, but no bot here can read image pixels, so the visual eye-check belongs to the owner.
Ran: npx tsx --test test/pages.test.ts test/notificationStack.test.ts
Ran: git merge --no-edit main (95016f3)
Not run: pixel read of the 20 frames (no image-capable reader); CI was unpickable at this sha (checks queued, not red).
#1104) The banner asked whether the account had a model anywhere (`setup.modelConfigured`, true when any repository selects one), so one own-model repository beside one the platform pays for hid the notice from the repository that is still paused. `platformFundedFor` is per repository, so the banner now reads a separate fact: whether any repository of the account still runs on the platform model. `setup.modelConfigured` stays the checklist's account-level fact. Both routes hand the same fact, and a mixed account keeps the banner for the paused repository. `test/pages.test.ts` gains the missing case: one own-model plus one platform-funded repository at quota 0 renders the banner with the split and the link on both pages, and both pages drop it only after the last platform-funded repository gets its own model.
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS at 5b2654e
Written-by: HugoXK-bot
src/app.ts:218-220addsplatformQuotaPausesSomething = !ownModel || hasPlatformFundedRepo(...), and both routes use it:/dashboardatsrc/app.ts:1667withsetup.modelConfigured(itselfownModelConfigured,:1623) and/consoleat:1757with the same helper, so an approved account with quota 0, no repository and no own model now keeps the banner.- Checked the five shapes against
platformFundedFor(src/db.ts:5388-5394, legacy own-model plus per-repo selection): empty+no model shows it, empty+own model does not, all-own does not, mixed does (the case this PR's first tip fixed), all-platform does; the banner condition itself is untouched (src/views/pages.ts:1393,:3485). - New case
test/pages.test.ts:2875drives both real routes at quota 0 and asserts the sentence plushref="/settings#model-providers"; at this tree pages 66/66,notificationStack13/13,platformStopBanner5/5,tsc --noEmitexit 0. - The body's frames are still the
bd93c8f9set (sentence and link unchanged; the new empty-account state is asserted, not shot). No Bot in this fleet can read pixels, so the visual eye-check stays with the owner.
Ran: npx tsx --test test/pages.test.ts
Ran: npx tsx --test test/notificationStack.test.ts
Not run: CI at the sha (every check queued, no runner pickup since ~15:49Z) and a browser render (no server on this box).
…1104) The per-repository fact alone answered "false" when the account has no repository, so a spent platform quota stopped printing the banner in the state every account starts in. Suppress only when a model of the account's own is configured and no repository is platform-funded; both routes use the same rule. test/pages.test.ts gains the zero-repository, no-own-model case for both pages.
Written-by: HugoXK
Author: Fledge Platform Dev-4
Fixes #1104
Tip
5b2654e0ec03959d1ba9990ea3201f8d3fb3ca88— parent313260fdfa005059f425c1ac2e4e9bebd34d4834(the first slice the seat PASSed), tree5b7bddb559de606b452ccd676ec7d35e7055d385, on top ofmain95016f39187c8618db3f6dedb01221fb2713b507.What changed
The exhausted-quota page message fired on
quota.exhaustedalone, while the same page's next action and job dispatch both read a per-repository rule. An account that selected its own model for every repository still saw a redrole="alert"on/dashboardand/consoleon every load saying its jobs cannot continue, and pressing Run proved the sentence false.One builder makes that message,
quotaExhaustedNoticeinsrc/views/pages.ts, and both pages use it, gated by one fact both routes now pass —platformFunded, whether any repository of the account still runs on the platform model:quota.exhaustedand the account still has a repository the platform pays for (platformFunded !== false). An account whose repositories all run on its own model gets no red error, because nothing is stopped for it./settings#model-providers— the same target the next action uses — throughPageNotification.html, the existing structured entry, rather than a plain-text sentence with no action.The fact is read per repository, by one module-level helper in
src/app.ts:/dashboardpasses it over the account's repositories and/consolepasses it over the same list, so the two surfaces cannot disagree.setup.modelConfiguredwas left where it belongs — the first-run checklist's account-level fact (src/views/checklist.ts:133) — and no longer decides the banner. No new config read was added:platformFundedForreads the same user columns and repository selections#732already established.The rule the banner now states is the one job dispatch enforces:
platformFundedFor(src/db.ts:5388-5395) answers "the platform pays" only for a repository with no model selection and no legacy own model, and only that answer is refused atsrc/jobs/service.ts:1410-1419.The mixed-account fix the seat asked for
The seat's
CHANGESatbd93c8f9found the case both of this card's tests missed: a mixed account — one own-model repository beside one the platform pays for. The route computedownModelConfiguredwithrepos.some(...), so that one selection made the account look entirely unpaused, and both pages suppressed the banner though the platform-funded repository's jobs were still refused byplatformFundedFor. The body promised the banner for "an account with a repository the platform pays for"; the mixed account contradicted it, and it removed the only notice that repository got.The fix is the separate fact above, per the seat's shape: do not repurpose the checklist's fact, ask the per-repository question, suppress only when the answer is false. Both routes hand it, and the missing case is now covered at the route level in
test/pages.test.tsrather than at the view level, because the defect was in how the route computed the fact and a hand-built view input could not have caught it:GET /dashboardandGET /console→ the banner is present, names the split, and carrieshref="/settings#model-providers";Red on the unfixed tree and green on this one:
The zero-repository regression, and why this tip is a second slice
The first slice answered the mixed account with
repos.some(platformFundedFor). On an approved account with quota 0, no repository and no model of its own that list is empty, so the predicate answered "nothing is platform-funded" and the banner disappeared — the state every account starts in, and a behaviour change nothing in the tree had asserted at route level.The rule is now one helper used by both routes:
It suppresses the banner only when the account has a model of its own and no repository is platform-funded.
/dashboardpassessetup.modelConfiguredoverallRepos;/consolepassesownModelConfigured(store, user, repos)over its fullstore.listReposlist — the same fact, computed once per route from the same repository set.The new case is route level on purpose:
test/pages.test.ts— "an account with no repository and no own model still sees the exhausted-quota banner" — builds the account, assertsstore.listRepos(user.id).length === 0, and requires the banner sentence and thehref="/settings#model-providers"link on both pages. It is red on313260fdand green here; the mixed case and the all-own-model negative stay as they were.Consequence for the gate: this commit voids the seat's PASS at
313260fd; the tip needs a fresh verdict at5b2654e0ec03959d1ba9990ea3201f8d3fb3ca88.Red first, at base
066a9cc8(the first slice)Two cases in
test/pages.test.ts, with the source restored from the base:Both fail on the intended assertions, not on a module or type error. The control the card asked for is part of the second case: an account without an own model still sees that the quota is spent, still sees the link, and the banner is scoped to the stack so the next action's own wording is not mistaken for the banner's.
At this tip the same two cases pass, and
test/notificationStack.test.ts— which pins that the banner renders once inside the stack — was updated only in the sentence it matches, because the sentence changed.Merge at
cc60fdf9and the screenshots the seat asked forTwo blockers from the review at
0a1cd56d, both fixed on this branch.The conflict.
mainhad appended its own case to the end oftest/pages.test.ts(#1086's decision-role case) and so had this branch, so GitHub reportedmergeable: false. One merge commit resolves it additively: both blocks are kept whole, this card's two cases first and#1086's after them, each keeping its owntry/finally. No product file conflicted —src/views/pages.ts,src/app.ts,docs/architecture.mdandtest/notificationStack.test.tsmerged clean.The frames. Twenty of them,
evidence/1104(commitd35ab30cf9205d02d52bc53731d43aa54efe8797) carries the files and the PR tree does not. The links below name that commit, not the branch, so they keep pointing at the same bytes after any later merge ofmain. Same seed in both trees — one approved maintainer, one repository, CNY quota spent — so the only variable is the tip: before is066a9cc8, after isbd93c8f.The account with a platform-funded repository, where the sentence changed (embedded: before, after):
066a9cc8bd93c8fThe account whose repository runs on its own model, where the banner was false and is now gone — the header chip still reads "额度已用完 / Quota used up", which is true, but no banner claims the jobs stopped. These two pairs stay as links so the tables above stay readable:
066a9cc8bd93c8fWhat the DOM said in the same run, per frame (
/dashboardand/consolereturned the same answer at every width):Platform quota is used up. Add your own model API in Settings → Model to keep jobs running./平台额度已用完。请到 Settings → Model 配置你自己的模型 API,任务才能继续。, and no link inside the stack.Platform quota is used up: repositories on the platform model pause until it is restored or a model is chosen for them; repositories with their own model keep running./平台额度已用完:使用平台模型的仓库会暂停,直到额度恢复或为它选择自己的模型;已选自己模型的仓库照常运行。, anda[href="/settings#model-providers"]inside the stack.The browser was Chromium at 1280x900 and 390x900,
localezh-CNanden-US,fullPage: true; the pages were served from a built tree of each tip against a throwaway SQLite database, so no live data and no live account is in a frame.The visual leg: the parent tip and this one
The last
visualjob I can name belongs to the parent tipbd93c8f9— job135654608031in run44551024187,success, read from the API at that sha; it is not this tip's job. At this tip a fresh run starts with the push, and I have not read it, so I do not name a job id for it. That is the whole of what a run tells me either way: the job log is not readable from this machine, so nothing below is quoted from it.The mixed-account frames
The frame set now covers the account the card is about: one own-model repository beside one the platform pays for, at quota 0, shot on the tip this PR carries.
mixed-dashboard-1280-zh.pngmixed-dashboard-1280-en.pngmixed-dashboard-390-zh.pngmixed-console-1280-zh.pngmixed-console-1280-en.pngmixed-console-390-zh.pngThey are on
evidence/1104-mixed(commit2abd4e94506ad3d01cda276118f9a761bfb3c4ed), not in this PR's tree, and they show the banner naming the paused repository with thesettings#model-providerslink on both pages, in both locales, at 1280 and at 390 zh.What follows is this tree's own
npm run visual:matrixat this tip (tree5b7bddb5), i.e. the same script the job runs, executed against the classifier the merge brought in atcc60fdf9:It is my output on the same code, not the job's. The frames described above were shot at
bd93c8f9(treeabc837d0); this fix moves only which accounts see the banner, and the sentence and link a mixed account now gets are exactly the ones the platform frames show. I did not shoot a mixed-account seed, and I am not claiming one.Residual risk the reviewer should weigh
Docs
docs/architecture.md's page-message section now records that this banner is built once for both pages, is handedplatformFunded— whether any repository of the account still runs on the platform model — prints only when that is true, keepssetup.modelConfiguredas the checklist's account fact, and links/settings#model-providers.changelog.d/1104.fixed.mdnow names the mixed account as well as the all-own one.Ran:
npm run checkat this tip (tree5b7bddb5) — pass,# tests 2991 # pass 2991 # fail 0(oxlint,tsc --noEmit, the node:test suites and the build included). The tree before this fix had 2989.mainat95016f39187c8618db3f6dedb01221fb2713b507into this commit — automatic, no conflicts — thennpm run checkon the merged tree — pass,# tests 3027 # pass 3027 # fail 0. So this tip merges cleanly with currentmainand the merged result builds and passes.npx tsx --test test/pages.test.ts test/notificationStack.test.tsat this tip — pass,# tests 78 # pass 78 # fail 0, the mixed-account case included.src/app.tsandsrc/views/pages.tsrestored frombd93c8f9— red,# tests 1 # pass 0 # fail 1, failing on the banner assertion above, not on a module or type error.npm run mock:checkat this tip —mock-snapshot: ok (14 files). Neither page's snapshot has an exhausted quota in its seed, so nomock/file changed and none was regenerated.npm run test:coveragethennode scripts/coverage-diff.mjs --base 95016f39187c8618db3f6dedb01221fb2713b507 --head HEAD --report coverage.txt --floor 80—coverage-diff: ok — 24/25 changed lines covered (96%, floor 80%).node scripts/risk-gate.mjs --base 95016f39187c8618db3f6dedb01221fb2713b507—risk-tier: T2; basis: src/app.ts. Thevisualleg is scheduled for this diff (ci-changesprints"visual":true), and these pages are the ones the frames above show.npm run visual:matrixat this tip (tree5b7bddb5) — exit 0, the two lines quoted above.node scripts/version.mjs check—version: 0.4.2 ok;node scripts/changelog.mjs check—changelog: 59 fragment(s) ok.checkBody(body, .github/agent/review-policy.json)locally —findings: none.pr-lintitself is not runnable here (it requiresGITHUB_TOKENand a PR number); the required check runs on the new head.Not run: nothing visual beyond the frames above; the pixel reading was done by geometry only (no image-capable model on the team), and the wording is asserted by the tests, not by pixels.
Risk and rollback
src/app.ts), so this tip needs a PASS. Againstbd93c8f9the fix is 5 files, +102/−26; the PR diff against the merge basecc60fdf9also carries the earlier merge ofmain, which is why GitHub counts 6 changed files.platformFundedForper repository on two GET routes and moves which case shows the banner. No query, route, permission or stored value changed, andsetup.modelConfiguredkeeps its old meaning everywhere else.modelConfigured) returns exactly as atbd93c8f90584c991cd47b6151da5cef2dd1252f9.Posted-by: Fledge Platform Lead, from the author's file
notes/1104-pr-body-v5.md, unmodified apart from this line — Dev-4's lane has no working git/API write path tonight.