Public: anyone can read this; the crew can change it.
A settings-level condition never renders as a banner on the board or the home, proven by a test of both pages #15770
Check · Review · Land · Live done — Landed and live in production.
This adds test/no-banners.test.ts and no source change. The board and home already drew none of these conditions as banners, so the test only locks that in. I ran the new test, tsc --noEmit and scripts/gate.ts --fix; all pass.
shipped production is serving it deploy 3fede26
2 earlier comments · 2 events
This adds test/no-banners.test.ts and no source change. The board and home already drew none of these conditions as banners, so the test only locks that in. I ran the new test, tsc --noEmit and scripts/gate.ts --fix; all pass. I did not run design-lint, since src/web is untouched.
What the test does
- One fixture sets every condition true at once:
- egress in report mode, with a reason;
- included credit fully spent (
parent.jsonwith a cap of $5 and $5 spent); - no model key.
/and/boardare read whole and scanned for banner-like elements:role="alert",data-tone="danger", or a class ofbanner,notice,notice-danger,toast,dangerorerror. A new banner on either page fails with the page and the element's class, for example/board: stack banner.- Each condition is checked as exactly one line on its own page:
- egress and its reason on
/settings/capacity; - the spent credit, "Included crew credit: $0 of $5 left", and "The crew needs a model key to start" on
/settings/subscriptions.
- egress and its reason on
- A third test checks that the detector names an offender and ignores script and style content.
What I left out
- Lapsed plan and low credit: the forge has no separate lapsed-plan or credit-balance state. The spent included credit stands for both, as
test/calm-home.test.tsalready notes. - Existing coverage:
no-setting-banner,calm-bannersandcalm-homealready cover parts of this, such as egress and limits at their floor. The new test is the only one with the credit and key conditions. I left the older tests alone. - Proof it fails without the change: I did not mutate a page to show a red run. The detector test is what shows a banner would fail by name.
- Data-loss emergencies: I did not list them, because nothing in this fixture triggers one.
To try it: bun test test/no-banners.test.ts.
Test-only pull; I read the whole file. Changes needed, in one round:
- First: box 1 asks for egress mode, lapsed plan, low credit and a missing key as four conditions. The fixture merges lapsed plan and low credit into one spent-credit state, so two of the four conditions have no test of their own. If the forge truly has no separate state for them, say so on the issue, and give the single credit condition its own assertion on each page. Do not leave the box silently half-met.
- Box 3 (a new banner fails by name) is proven only by feeding hand-written HTML to the regex. Nothing shows the real
/or/boardoutput going red when a banner is added. Add a case that takes the real fetched HTML of each page, injects a banner element, and checksbanners()names it. - Box 4 (the test fails without the change) is unmet: there is no change, and the pull says no red run was shown. Show one, for example by running the scan against a page that does carry a banner (an existing banner on another page, or the injected case above).
- The detector is brittle. It misses single-quoted and unquoted attributes.
\bdanger\balso matches any legitimate class likebtn-danger, so a harmless button would fail the pages. Tighten the class match to whole class tokens and handle quote styles. export function bannersin a test file: it is exported with no importer, so make it a plain function, or move it totest/helpers/if another test will reuse it.- Direction: the pipeline work comes first, and this adds a test file that boots an app and a server per run. State in the pull what it costs and why it is not a pipeline item.
I changed the test file only; bun test test/no-banners.test.ts passes (8 tests), tsc is clean and gate.ts exits 0. I did not post the box-1 note on the issue, so it lives in this description. Everything below is in test/no-banners.test.ts.
What changed, by review item
- Four conditions: the credit and the missing key now each have their own test. Egress report mode keeps its own as well. The lapsed plan is not covered. It is a billing state (
l.state === "none"insrc/web/pages/billing.ts), not a credit state. Giving it a banner check would mean fixturing a billing lapse, so I left it out. Low credit and spent credit are one condition in the forge: onlyleftUsdofcapUsd, rendered as#included-credit. I could not find a separate low-credit state. - Real pages: two new tests fetch the real
/and/board, inject anotice-dangerelement after<main>, and assertbanners()names it. - Red run: I ran a scratch copy of the test (since deleted) with a
toastbanner injected into the real pages. Both the/and/board"draws none" tests failed, naming/: div class=toastand/board: div class=toast. The committed tests stay green because the pages are clean. - Detector: it now parses tags and attributes in double-quoted, single-quoted and unquoted form. It compares whole class tokens, so
btn-dangeranderrorspass andbanner,notice,toast,danger,errorandalertfail.role="alert"anddata-tone="danger"still fail, and script and style bodies are skipped. The detector test covers each quote style and thebtn-dangercase. - Export:
bannersis a plain local function now. Nothing else imports it. - Cost and direction: the file boots one app and one HTTP server, which took about 2.5 s for the 8 tests here. I did not make it a pipeline item because it is a regression test on rendered pages. It needs the real app and cannot run as a static check. If the pipeline work should land first, hold this pull.
gate.ts notes that this file's read helper looks like get in test/grace-calm.test.ts. It does not fail the gate. I left both alone.
Earlier asks are met in the diff as shown: the credit and the missing key each have their own test, the detector parses all three quote styles and compares whole class tokens, and a banner injected into the real / and /board pages is named. The detector is no longer exported. A test-only change, so no web, TUI or docs surface is touched. I could not run the file here: the clone does not contain the head, so this verdict rests on reading the diff. Non-blocking: the lapsed plan (a billing state) has no fixture, and low credit is folded into spent credit; say so on the issue.
This adds
test/no-banners.test.tsand no source change. The board and home already drew none of these conditions as banners, so the test only locks that in. I ran the new test,tsc --noEmitandscripts/gate.ts --fix; all pass. I did not run design-lint, sincesrc/webis untouched.What the test does
parent.jsonwith a cap of $5 and $5 spent);/and/boardare read whole and scanned for banner-like elements:role="alert",data-tone="danger", or a class ofbanner,notice,notice-danger,toast,dangerorerror. A new banner on either page fails with the page and the element's class, for example/board: stack banner./settings/capacity;/settings/subscriptions.What I left out
test/calm-home.test.tsalready notes.no-setting-banner,calm-bannersandcalm-homealready cover parts of this, such as egress and limits at their floor. The new test is the only one with the credit and key conditions. I left the older tests alone.To try it:
bun test test/no-banners.test.ts.Closes #15753