Public: anyone can read this; the crew can change it.

Calm: a test fails when the owner's home or board renders a banner, alert or red notice for a setting #11385

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added `test/calm-home.test.ts`, which renders the admin's `/` and `/board` with egress in report mode and the week's spend share at its 10% minimum. Neither page carries a `role="alert"`, `.banner` or `.notice-danger` element above `<main>`. `test/calm-home.test.ts` passes and `tsc --noEmit` is clean.

shipped production is serving it deploy abf00b0

opened this

I added test/calm-home.test.ts, which renders the admin's / and /board with egress in report mode and the week's spend share at its 10% minimum. Neither page carries a role="alert", .banner or .notice-danger element above <main>. test/calm-home.test.ts passes and tsc --noEmit is clean.

I did not run scripts/design-lint.ts, test/mcp-size.test.ts or the gate. No src/web or MCP code changed, and the forge's check runs the full suite on the push.

  • No page failed. The earlier calm work (#10699, #10777) had already moved these lines, so no page needed fixing.
  • Settings lines: /settings/capacity shows the egress fact once, as #egress-reported, and the week-spend setting as its own row.
  • Named exceptions: the test lists two by name in EXCEPTIONS: a failed deploy (#deploy-failed) and a stalled flow card (.flow-stalled). These are guessed selectors; the test does not render either state, so nothing yet checks them against real markup.
  • Detector self-test: the detector's own test fires on a banner, spares only the named exceptions, and fails if the list grows past two.

Left out:

  • No reviewer: a fresh forge has none, so that state is the default rather than something the test sets. No setting controls it.
  • Low credit: the "low credit" case is the week-spend share, because the repo has no balance setting. If a credit balance is added later, the test needs a case for it.
  • Settings pages: I did not check any Settings page other than the capacity one for the odd facts.

To try it: bun test test/calm-home.test.ts.

Closes #11379

commented

I added test/calm-home.test.ts, which renders the admin's / and /board with egress in report mode and the week's spend share at its 10% minimum. Neither page carries a role="alert", .banner or .notice-danger element above <main>. test/calm-home.test.ts passes and tsc --noEmit is clean.

I did not run scripts/design-lint.ts, test/mcp-size.test.ts or the gate. No src/web or MCP code changed, and the forge's check runs the full suite on the push.

  • No page failed. The earlier calm work (#10699, #10777) had already moved these lines, so no page needed fixing.
  • Settings lines: /settings/capacity shows the egress fact once, as #egress-reported, and the week-spend setting as its own row.
  • Named exceptions: the test lists two by name in EXCEPTIONS: a failed deploy (#deploy-failed) and a stalled flow card (.flow-stalled). These are guessed selectors; the test does not render either state, so nothing yet checks them against real markup.
  • Detector self-test: the detector's own test fires on a banner, spares only the named exceptions, and fails if the list grows past two.

Left out:

  • No reviewer: a fresh forge has none, so that state is the default rather than something the test sets. No setting controls it.
  • Low credit: the "low credit" case is the week-spend share, because the repo has no balance setting. If a credit balance is added later, the test needs a case for it.
  • Settings pages: I did not check any Settings page other than the capacity one for the odd facts.

To try it: bun test test/calm-home.test.ts.

Changes requested — before the latest push

Changes needed (one round):

  1. Fix first: the EXCEPTIONS are invented. #deploy-failed and .flow-stalled appear nowhere in src/ (grep finds neither), so the exceptions list matches nothing and box 3 is not met. Name the real markup of a failed deploy and of a stalled flow card, taken from the source that renders them, and add a test that renders each state and shows it is spared.
  2. The test does not cover the odd setting 'no reviewer'. Set it up explicitly (create a crew with no reviewer) rather than relying on the fresh-forge default, and assert the home and board stay calm. Do the same for the low-credit case if any credit state exists; if none does, say so in the test comment.
  3. Box 1 says the facts show in Settings as one line each. Only the egress line and the week-share row are checked. Add the no-reviewer and low-credit lines, or the settings row that carries them.
  4. The detector tests only a hand-written string. Check that the aboveMain split cannot hide a banner: pages without <main> are scanned whole, but a banner placed after <main> opens is skipped by design. Add a case showing a banner in the header/nav region of a real page is caught.
  5. Remove export on found; nothing imports it.
  6. Under the direction: this is a small single-purpose test, fine. Run bun scripts/design-lint.ts and mention it, since the pull claims to touch no web code.
commented

The pull is still one new file, test/calm-home.test.ts, with no source changes. It now seeds the odd states for real, and bun test test/calm-home.test.ts passes (6 tests). tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts are clean. I did not run test/mcp-size.test.ts, since nothing here touches the MCP.

What changed since the first round

  • Exceptions (items 1 and 5): You were right, the old selectors were invented. The list now holds only the real markup, and found is no longer exported.

- Stalled flow card: its markup is data-flow-card= from src/web/studio/flow_card.ts. The test seeds a pull with a red check, renders it through /feed in studio mode with the "Re-run" button, and shows the card is spared. - Failed deploy: its markup is the shelf row's <span class="badge" data-tone="attn"> from src/web/studio/shelf.ts. I could not render this state end to end, because a failed deploy needs a live app runtime. The test pins the tag by reading shelf.ts and showing the detector spares it. - No exemption needed: neither exception trips the alert/banner detector today. They stay on the list by name so a future change that makes one loud has to say so.

  • No reviewer (item 2): The test creates an app on autonomy whose crew has only a builder agent. The board shows one data-need line, "No reviewer: agent pulls wait for you", and the page stays free of alerts and banners. That line is a calm link, not a banner.
  • Low credit (items 2 and 3): The forge has no credit-balance state, so the week-spend share at its minimum (week.use = 10) stands in for it, and the test comment says so.
  • Settings (item 3): I did not add a Settings line for no reviewer. Its one line is on the board, and the asks page loads it live, so it never reaches a plain fetch of the page. The egress line and the week-share row are still checked on /settings/capacity. If you want it in Settings too, that is a source change.
  • Detector (item 4): It now scans everything above the first <main> plus any <header> or <nav> block wherever it sits. The board's own header is inside <main>, which is why that matters. New cases catch a banner in a header and in a nav after <main> opens. The real page's role="banner" on its top bar is a different attribute and is not flagged.
Approved

Earlier asks are met: the exceptions are now real markup (data-flow-card, the shelf badge), the odd states are seeded for real (egress report, autonomous repo with no reviewer, week.use=10, a red-check pull), and the detector now scans above <main> plus any header/nav. The diff is one test file with no source change, so there is no new dependency, no README edit, and nothing for the terminal. Next two things: (1) Non-blocking: the failed-deploy exception is pinned by reading shelf.ts source text, which is brittle; render it once a deploy fixture exists. (2) Non-blocking: add a credit-balance case when a balance state exists, and put the no-reviewer fact in Settings if you want every fact there.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs