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

No page's first paint carries a red setting notice: a test fails one that does #10786

Merged opened this

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

Merged

This adds `test/calm-no-banner.test.ts` and changes no page code. The "egress is reported, not enforced" banner was already gone from home and the board: #10699 moved it to one line on Capacity and System. I didn't find any other banner to move.

shipped production is serving it deploy a985b29

opened this

This adds test/calm-no-banner.test.ts and changes no page code. The "egress is reported, not enforced" banner was already gone from home and the board: #10699 moved it to one line on Capacity and System. I didn't find any other banner to move.

The new tests render /, /board and /flow for an admin and an everyday account, with egress set to report. They fail if the page holds a role="alert" element or a banner, notice or alert class that isn't an allowed kind. They also fail if it carries the egress line.

  • Allowed kinds: the test names them in ALLOWED_KINDS: a transient flash (data-flash) and a real service failure (service-down). So down services stay visible. A self-test checks the detector flags a banner and lets the allowed kinds through.
  • /flow for the everyday account: it answers 404, as the admin-only page does, and the test asserts that 404 instead of a 200. The body is still checked for banners.
  • Left out: the test covers the egress setting only. It doesn't toggle other configuration states, so a banner for some other setting would only be caught if it showed up in that state.

I ran the new test and test/calm-banners.test.ts (11 pass), tsc --noEmit and design-lint (both clean), and scripts/gate.ts. The gate printed nothing, so I'm treating that as clean. The branch is pushed.

Closes #10777

commented

This adds test/calm-no-banner.test.ts and changes no page code. The "egress is reported, not enforced" banner was already gone from home and the board: #10699 moved it to one line on Capacity and System. I didn't find any other banner to move.

The new tests render /, /board and /flow for an admin and an everyday account, with egress set to report. They fail if the page holds a role="alert" element or a banner, notice or alert class that isn't an allowed kind. They also fail if it carries the egress line.

  • Allowed kinds: the test names them in ALLOWED_KINDS: a transient flash (data-flash) and a real service failure (service-down). So down services stay visible. A self-test checks the detector flags a banner and lets the allowed kinds through.
  • /flow for the everyday account: it answers 404, as the admin-only page does, and the test asserts that 404 instead of a 200. The body is still checked for banners.
  • Left out: the test covers the egress setting only. It doesn't toggle other configuration states, so a banner for some other setting would only be caught if it showed up in that state.

I ran the new test and test/calm-banners.test.ts (11 pass), tsc --noEmit and design-lint (both clean), and scripts/gate.ts. The gate printed nothing, so I'm treating that as clean. The branch is pushed.

Changes requested — before the latest push

The test runs and the egress banner is indeed gone, but the test does not yet deliver boxes 1 and 3. Fix in one round:

  1. ALLOWED_KINDS names kinds the app never emits. data-flash and service-down appear nowhere in src/. The real transient flash is .toast (src/web/layout.ts:624, data-tone, role=status), and a real failure renders as a plain role="alert" or a .toast data-tone="danger" (account.ts:155, repo.ts:861). Name the allowed kinds by the markup the app really produces, and make the self-test render those (a real flash toast, a real service-failure element) rather than invented attributes. Otherwise a genuine down-service alert on a first paint fails this test while a fake attribute passes it.
  2. The test only exercises one configuration state (egress=report). Box 1 asks about notices for a configuration state generally. Drive at least the other standing settings the pages read (e.g. every cells.* / capacity setting in a non-default state) in the same loop, or derive the list from the settings registry, so a new setting banner is caught.
  3. The negative assertions on egress-reported and the first 30 chars of EGRESS_REPORTED are brittle; assert the structural detector result and keep the string check only as a secondary guard.
  4. export const ALLOWED_KINDS from a test file is unused elsewhere; drop export.

Boxes 1 and 3 are left; box 2 is vacuously met (nothing found to move), which is fine.

commented

I've addressed all four points in test/calm-no-banner.test.ts and pushed to the same branch. The file's 14 tests pass, tsc --noEmit is clean, and scripts/gate.ts printed nothing. I didn't re-run design-lint this round.

  1. Allowed kinds: the test now allows only the markup the app really produces. One is the flash, .toast with role="status" (layout.ts flashToast). The other is a real failure, .toast with data-tone="danger" and role="alert" (as in account.ts and repo.ts). Any other role="alert" fails, as does a banner, notice or alert class. A .toast with data-tone="attn" and role="alert" also fails. data-flash and service-down are gone. The self-test renders the real toasts and checks they pass, and checks that a banner, a bare alert and an attention toast fail.
  2. Configuration states: the loop now covers every key in the CAPACITY registry, so a new setting is covered without editing the test. Each key is set to every non-default value (each choice, or a count's minimum and maximum). For each value it fetches /, /board and /flow as admin and everyday, then restores the default.
  3. Assertions: the structural detector result is the main assertion. The check for the first 30 characters of the egress sentence stays as a secondary guard. I dropped the egress-reported id check.
  4. export: removed from the allowed-kinds constant, which is now a function.

An allowed failure toast on a first paint would pass this test even if it were really a setting notice in disguise. I accepted that so a down service stays visible.

Approved

Test-only change, no page code touched, no new dependency, no README edit. The detector is structural, allowed kinds are the markup the app really emits (toast status / danger toast), the loop derives from the CAPACITY registry so new settings are covered, and the self-test proves it fires on banners and passes real toasts. Box 2 is met vacuously: no banner remains to move (#10699 did it).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs