Skip to content

feat(gates): fail the gate on Fallow, Playwright worker and runner warnings - #346

Merged
BenSheridanEdwards merged 9 commits into
mainfrom
feat/warnings-fail-the-gate
Nov 10, 2026
Merged

BenSheridanEdwards merged 9 commits into
mainfrom
feat/warnings-fail-the-gate

Conversation

@BenSheridanEdwards

@BenSheridanEdwards BenSheridanEdwards commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Why does this feature exist?

What changed?

One idea above 400 lines: make every warn-severity gate finding fatal. About 130 of the 460 added lines are the seeded Fallow tests and about 150 are the browser guard cases and their proof.

  • Fallow warn-severity findings fail the gate.
    • pnpm arch:gate now runs scripts/check-fallow-severity.mjs first. It reads the resolved config (fallow config) and fails, naming each cause, when a rule, an override or a rule-pack file sets warn, or when duplication is on with a threshold of 0 or above 0.001. arch:gate runs at pre-commit and in the CI Fallow job.
    • Duplication has no rule in Fallow: fallow audit reports a clone group as a warning, returns the warn verdict and exits 0 unless duplicates.threshold is set. The first full run of this branch caught exactly that: a copied block in the new guard cases passed. .fallowrc.jsonc now sets duplicates.threshold: 0.001 percent of the lines Fallow analyses, so any clone group fails the audit while the analysed code stays under about a million lines (main is about 18,600). Main has no clone group.
    • Amends ADR 0059. showcase/** leaves code-duplication analysis, in place of 0059's named per-result entries, because every trial result copies the reference's template files by design (ADR 0034) and would otherwise fail its own audit on code it must copy. Duplication inside a showcase result, or against apps/, is no longer reported. 0059's health.ignore rule is unchanged, and dead-code and architecture analysis still read every result. ADR 0059's status, Decision and Consequences and .agents/project/ARCHITECTURE.md record it; approving this PR approves the amendment. The benchmark generator still extends that list.
  • Playwright: worker and popup pages. apps/web/e2e/fixtures.ts listens on the browser context's console and weberror events instead of the page's, so a console warning or error, or an uncaught error, in any page, popup or dedicated worker the test opens fails the test. I checked first that context events carry worker and popup messages.
  • Playwright: the test process. The same fixture records console.warn, console.error (formatted with util.format) and Node warning events in the test's own process, drains one event-loop turn, restores the originals and fails on any unexpected one (runner … messages). Node prints its own warnings through console.error, so the patch skips text starting (node:<pid>) and the listener records each warning once. expectedConsole declares runner messages like any other.
  • Proof. A failing fixture attaches console-guard.json with its exact unexpected and missing lists. pnpm e2e:console-guard compares those for eleven failing cases (page, worker, popup and runner) and runs five fixture mutants, each with one recording path removed (console errors, worker messages, popup pages, console.warn, process warnings), whose case must then pass. All mutants share one child run, so the proof still starts its servers twice. Its children run without NO_COLOR, as CI does.
  • Docs. [ADR 0128] (numbered 0128 because draft refactor(todos): share the title rules between the api and the web (ADR 0127) #344 holds 0127)(https://github.com/BenSheridanEdwards/SoftwareFactoryTemplate/blob/feat/warnings-fail-the-gate/.agents/decisions/0128-warning-findings-and-test-console-warnings-fail.md) records the decision and what stays outside it. ADRs 0034, 0059, 0079 and 0086 name the amendment, and .agents/project/QUALITY_GATES.md, AGENTS.md, the run-e2e-tests skill and docs/NORTH_STAR.md state the scoped guarantee: the North Star names Biome, Oxlint, React Doctor and Fallow rather than every tool, because commitlint keeps two warn rules from @commitlint/config-conventional (ADR 0128 lists them as outside the guarantee).
  • Kept non-fatal on purpose, as the maintainer decided for this PR and ADR 0128 records: Fallow's log lines such as boundary zone 'web-routes' matched 0 files, which are tool diagnostics rather than findings (main prints two on every run, so failing on them would fail a clean main); the browser's own service-worker lifecycle logs (a service worker's own console.warn/console.error does reach the context and fails the test); and Playwright runner output outside a test.
  • Guarded file: docs/NORTH_STAR.md changes, so enforcement-approval waits for the maintainer's tick.
  • Seeded gate test runs the gate's Fallow steps one by one without a shell, so a checkout path with a space cannot break it.

Behavioural Proof (with video and screenshots)

  • Video: Not applicable: gate behaviour and test fixtures; nothing in the app renders differently.
  • Screenshots: Not applicable: no user-visible state changed, so there is no screen to capture.
  • Behaviour tests:
    • tooling/architecture/boundaries.test.ts, "A Fallow warning fails the gate", runs real Fallow on a seeded repository:
      • With boundary-violation at warn, fallow architecture alone reports the route-to-route import and exits 0, and the gate's Fallow steps exit 1 naming rule boundary-violation.
      • A rule-pack rule at warn and a duplication threshold of 0 or 5 fail the same steps.
      • A committed clone gives fallow audit the verdict warn, exit 0, with threshold 0, and fail, exit 1, with the real config; neither run has a dead-code finding.
      • The clean layout passes under the real config.
    • pnpm e2e:console-guard passes locally with NO_COLOR unset, both plain and with CI=1 (production build, retries): eleven cases fail with exactly their attached result (for example { unexpected: ["runner warning: x"], missing: [] }), the declared expected error passes, and each of the five mutants lets its case pass.
    • Red first: the first CI run at c86bfa7 failed the End-to-end job because one Node warning was recorded twice. With the (node:<pid>) skip removed again locally, the proof fails with five entries in unexpected; with it, it passes.
  • E2E mapping: unchanged. Every spec still imports test from ./fixtures, and all 15 behaviour tests pass under the stricter fixture.

Verification Summary

  • Head commit: d6007a0
  • PRDs checked: docs/prd/greeting.md, docs/prd/recent-greetings.md
  • PRD impact: No behaviour change: only the E2E guard fixture that every spec runs under changed, and every linked spec still passes.
  • North Star commit: 5c9f6da6cf540ae1dadd05aafab65bb6f25cc0f2
  • Commands run (e.g. pnpm verify, pnpm e2e): pnpm lint:anti-slop, pnpm e2e:console-guard, then pnpm verify and pnpm e2e in the real pre-push hook, on the final head.
  • Results: d6007a0 is the branch rebased onto main at 5cd630f (after feat(lint): add six policy rules mined from nine agent rebuilds #345 merged); its tree is byte-identical to merging that main into cacc556 (git merge-tree --write-tree cacc556 5cd630f gives d6007a0's tree), and only one commit's patch context changed. Local runs were at cacc556: pnpm verify passed in the real pre-push hook (84 suites, 2,986 Jest tests; contract, integration, changed-file coverage, build and size), pnpm e2e passed all 15 behaviour tests, and pnpm lint:anti-slop, pnpm check:docs, pnpm check:context and node scripts/check-fallow-severity.mjs passed. No local run was made at d6007a0; its CI runs every gate again, including the console-guard proof in the End-to-end job. At cacc556 the first pre-push attempt failed only on scripts/bench/run.test.ts (a pnpm install from its local fixture server was killed mid-retry) at load average 210; the retry passed unchanged.
  • Definition of Done (.agents/project/PR_QUALITY.md) satisfied, or each gap named: satisfied locally; enforcement-approval waits for the maintainer's tick on docs/NORTH_STAR.md.
  • pnpm verify
  • pnpm e2e
  • Behaviour is covered by the E2E map when user-visible behaviour changed.
  • Logic is unit-tested where logic changed.
  • Accessibility considered and verified for interactive/UI changes.
  • The diff follows .agents/project/ARCHITECTURE.md and CONVENTIONS.md; new decisions recorded as ADRs.
  • No gates were bypassed or weakened.
  • Known risks or skipped checks (with reason, risk, and rollback):
    • Any new clone group of 5 lines and 50 tokens or more, outside showcase/ and the files Fallow's duplicate defaults skip, now fails the audit. That is the point, but it is stricter than before; extract shared code or change the duplicated block.
    • A spec that writes console.warn or console.error from Node, or triggers a Node deprecation, now fails. Declare an intended one with expectedConsole.
    • Two load-sensitive tests (tooling/trial/review.test.ts) timed out once at 5 seconds during a full local run on a busy machine and passed when rerun alone; this PR does not touch them.
    • Locally, every checkout shares the Pact file at $TMPDIR/art-pact, so local runs here set PACT_DIR to a private folder; CI is unaffected.
    • Follow-ups the final review accepted for later:
      • The proof's NO_COLOR comment is imprecise. On Node 26, NO_COLOR beside Playwright's FORCE_COLOR=1 warns on the first console call that formats a non-string argument, not at worker start. On a machine with NO_COLOR set, a spec that logs an object could fail locally while passing in CI. No current spec does. The fix is to reword the note, or to unset NO_COLOR in the Playwright config.
      • The seeded git test in boundaries.test.ts should isolate git config (GIT_CONFIG_GLOBAL, GIT_CONFIG_NOSYSTEM, commit.gpgsign=false) as other repo tests do.
      • ADR 0034's status should say "the one exception every result gets", since ADR 0059 still allows a named health.ignore exception.
      • The severity check treats duplicates.enabled: false, large minLines or minTokens, or a broad duplicates.ignore as the rule being off. That is allowed, but it is a way around the gate a later check could close.
    • Rollback: revert the merge commit.

PRD Behaviours to Review

  • docs/prd/greeting.md: Greets the visitor by name. Evidence: greeting.spec.ts tests "greets a name through the api" and "collapses runs of inner whitespace in the name" pass in pnpm e2e under the stricter fixture.
  • docs/prd/greeting.md: Asks for a name before it calls the api. Evidence: greeting.spec.ts test "asks for a name and sends no request when the name is blank" passes in pnpm e2e.
  • docs/prd/greeting.md: The api rejects a blank name. Evidence: greeting.spec.ts test "the api rejects a blank name as a bad request" passes in pnpm e2e.
  • docs/prd/greeting.md: Says so when the api fails. Evidence: greeting.spec.ts test "says so when the api fails" passes in pnpm e2e; its declared resource error still matches.
  • docs/prd/greeting.md: Works for every visitor. Evidence: the three accessibility.spec.ts greeting tests pass in pnpm e2e.
  • docs/prd/recent-greetings.md: Shows the names greeted on the page, newest first. Evidence: recent-greetings.spec.ts test "shows the names greeted on the page, newest first" passes in pnpm e2e.
  • docs/prd/recent-greetings.md: Stays closed until asked. Evidence: recent-greetings.spec.ts test "stays closed until asked" passes in pnpm e2e.
  • docs/prd/recent-greetings.md: Records each greeted name. Evidence: recent-greetings.spec.ts test "records each greeted name with surrounding whitespace trimmed" passes in pnpm e2e.
  • docs/prd/recent-greetings.md: Lists the newest name first, at most ten. Evidence: recent-greetings.spec.ts test "lists the newest name first and keeps at most ten names" passes in pnpm e2e.
  • docs/prd/recent-greetings.md: The api rejects a blank name. Evidence: recent-greetings.spec.ts test "rejects a blank recent greeting name as a bad request" passes in pnpm e2e.

PR Proof Law

  • I followed .agents/project/PR_QUALITY.md and .agents/skills/pr-quality-contract/SKILL.md; the PR quality check verifies the proof format.

🤖 Generated with Claude Code

@github-actions github-actions Bot added confidence: red A required gate is failing or pending, or evidence is unavailable. confidence: green Required gates, slice E2E/PRDs, unit line coverage and import blast radius passed. and removed confidence: red A required gate is failing or pending, or evidence is unavailable. confidence: green Required gates, slice E2E/PRDs, unit line coverage and import blast radius passed. labels Nov 9, 2026
@BenSheridanEdwards
BenSheridanEdwards force-pushed the feat/warnings-fail-the-gate branch from 77d9f2b to 1bce1d8 Compare November 10, 2026 10:58
@github-actions github-actions Bot added confidence: red A required gate is failing or pending, or evidence is unavailable. and removed confidence: green Required gates, slice E2E/PRDs, unit line coverage and import blast radius passed. labels Nov 10, 2026
@github-actions github-actions Bot added confidence: green Required gates, slice E2E/PRDs, unit line coverage and import blast radius passed. and removed confidence: red A required gate is failing or pending, or evidence is unavailable. labels Nov 10, 2026
BenSheridanEdwards and others added 9 commits November 10, 2026 12:31
…rnings

- pnpm arch:gate runs scripts/check-fallow-severity.mjs first, which
  fails when a Fallow rule, override or rule-pack rule is set to warn.
  Fallow reports a warn finding and exits 0, so the gate refuses the
  setting. boundaries.test.ts proves it on a seeded repository.
- The Playwright fixture listens on the browser context, so a popup,
  another page or a dedicated worker that warns or throws fails the
  test, and records console.warn, console.error and Node warnings in
  the test's own process.
- pnpm e2e:console-guard proves seven new failing cases and runs three
  fixture mutants in one child run, so its servers still start twice.
- ADR 0127 records the decision and what stays outside it; the North
  Star states warnings-as-failures as a guarantee.

Closes #231

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fallow audit reports a clone group as a warning, returns the warn
verdict and exits 0 unless duplicates.threshold is set. The first
gate run of this branch showed it: a duplicated block in the guard
cases passed.

- .fallowrc.jsonc sets duplicates.threshold to 0.001, so any clone
  group fails the audit; showcase results stay out because they copy
  the reference's template files by design. Main has no clone group.
- check-fallow-severity.mjs also fails a config with duplication on
  and no threshold, and is split into small functions.
- boundaries.test.ts proves both: a committed clone gives warn and
  exit 0 without the threshold, fail and exit 1 with it.
- The popup guard cases share one helper instead of a copied block.
- ADR 0127 records that Fallow's zone log lines are diagnostics, not
  findings, and stay non-fatal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the benchmark

scripts/bench/generate.mjs appends its clones to duplicates.ignore and
needs that list first in the block; a comment inside the list keeps
Biome from folding it onto one line. The boundaries tests set the
threshold to 0 rather than strip the block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Node prints its own process warnings through console.error, so the
  fixture recorded one warning twice and the runner-warning mutant
  failed in CI. The console patch now skips text that starts with
  "(node:<pid>) "; the warning listener records each one once.
- The proof's children run without NO_COLOR, as CI does: beside
  FORCE_COLOR it makes Node warn at worker start, which hid the bug.
- A failing fixture attaches console-guard.json with its exact
  unexpected and missing lists, and the proof compares those instead
  of scraping single-line strings from the assertion diff.
- Two more mutants: popup pages and the console.warn patch.
- The console patch formats arguments with util.format, so a
  prototype-less object is recorded instead of throwing.
- check-fallow-severity.mjs requires a duplication threshold above 0
  and at most 0.001; a threshold of 5 now fails the gate too.
- The North Star names the four tools whose warn-severity findings
  fail, and ADR 0127 is retitled to match and lists commitlint's warn
  rules as outside the guarantee.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ADR 0128 (renumbered from 0127, which draft #344 holds) amends ADR
  0059: duplicates.ignore keeps one showcase/** entry in place of
  named per-result entries, because every trial result copies the
  reference's template files and would fail its own audit on them.
  0059's status and ARCHITECTURE.md say so; health.ignore is unchanged.
- The docs state the duplication check as the script enforces it:
  a threshold of 0 or above 0.001 fails the gate.
- boundaries.test.ts runs the gate's Fallow steps one by one without
  a shell, so a checkout path with a space cannot break them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ADR 0059's Decision and Consequences still described per-result
duplicates.ignore entries; they now point to ADR 0128 for code
duplication and keep the per-result rule for health.ignore only.
check-fallow-severity.mjs treats a config with no rule pack as having
none, so it names each warn rule instead of throwing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ADR 0086's Consequences say what it covered as first merged and
  point to ADR 0128 for pages, workers, the test process and Fallow.
- ADR 0079's status names its amendment by ADR 0128.
- QUALITY_GATES states the Playwright and Fallow warning guards.
- ADR 0128 and check-fallow-severity.mjs say the threshold is a share
  of every line Fallow analyses, and when one clone group stays above it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- AGENTS.md says Fallow fails on a warn-severity finding and that its
  log lines stay output, matching the North Star and ADR 0128.
- ADR 0034 said no showcase result gets an exception; its status now
  names ADR 0128's code-duplication exemption, and 0128 lists 0034
  among the records it amends.
- ADR 0128 describes the seeded thresholds as the test sets them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A service worker's console.warn or console.error reaches the browser
context, so the fixture records it; only the browser's own lifecycle
logs stay outside. ADR 0128's Amends list is one item per record,
ADR 0079 names the full threshold bound, and ADR 0059's status says
its title now holds for styling, complexity and health only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BenSheridanEdwards
BenSheridanEdwards force-pushed the feat/warnings-fail-the-gate branch from cacc556 to d6007a0 Compare November 10, 2026 12:31
@github-actions github-actions Bot added confidence: red A required gate is failing or pending, or evidence is unavailable. and removed confidence: green Required gates, slice E2E/PRDs, unit line coverage and import blast radius passed. labels Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Enforcement sign-off

Ran at Tuesday, the 10th of November, at 4:47 pm on commit d6007a0.

This PR changes gated enforcement or product intent, so it needs sign-off.

File What changed How it affects
docs/NORTH_STAR.md Rewrites the section 1. Lint beats instructions; Adds product requirements Biome, Oxlint, React Doctor and Fallow fail on a warn-severity finding: the first three fail on a warning, and, 'pnpm arch:gate' refuses a Fallow rule set to 'warn' or a duplication threshold of 0 or above 0.001, so each of their rules is an, error or removed ([ADR 0079](../.agents/decisions/0079-no-advisory-lint.md)). A console warning or error fails a Jest test, and a, Playwright test when its pages, popups, workers or test process emit one and 3 more; Removes product requirements Warnings fail Biome, Oxlint and React Doctor. [ADR 0079](../.agents/decisions/0079-no-advisory-lint.md) records, the maintainer's lint decision: every rule becomes an error or is removed, including Fallow's warning tier. That rollout is, not finished yet. A console warning or error fails a Jest test or a Playwright page, ([ADR 0086](../.agents/decisions/0086-console-warnings-fail-tests.md)); warnings-as-failures across every and 1 more Product intent now includes Biome, Oxlint, React Doctor and Fallow fail on a warn-severity finding: the first three fail on a warning, and, 'pnpm arch:gate' refuses a Fallow rule set to 'warn' or a duplication threshold of 0 or above 0.001, so each of their rules is an, error or removed ([ADR 0079](../.agents/decisions/0079-no-advisory-lint.md)). A console warning or error fails a Jest test, and a, Playwright test when its pages, popups, workers or test process emit one and 3 more instead of Warnings fail Biome, Oxlint and React Doctor. [ADR 0079](../.agents/decisions/0079-no-advisory-lint.md) records, the maintainer's lint decision: every rule becomes an error or is removed, including Fallow's warning tier. That rollout is, not finished yet. A console warning or error fails a Jest test or a Playwright page, ([ADR 0086](../.agents/decisions/0086-console-warnings-fail-tests.md)); warnings-as-failures across every and 1 more; implementation and behaviour tests must follow the revised intent

@BenSheridanEdwards: tick to approve.

  • Approve these enforcement changes at d6007a0 ticked by Ben Sheridan Edwards at Tuesday, the 10th of November, at 4:47 pm (@BenSheridanEdwards)

@github-actions github-actions Bot added confidence: amber Required gates passed, with an E2E, PRD, unit coverage or import blast-radius gap. and removed confidence: red A required gate is failing or pending, or evidence is unavailable. labels Nov 10, 2026
@BenSheridanEdwards
BenSheridanEdwards merged commit e3e180b into main Nov 10, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

confidence: amber Required gates passed, with an E2E, PRD, unit coverage or import blast-radius gap.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail the gate on warnings from Fallow, Jest and Playwright

2 participants