fix(gate): close the gaps in the plan-code guard, the button lists and the tooling

- planCodes: the quote and slash lookarounds let the commonest form through (a docstring or test
  title opening with a code, a slash pair); the two real exceptions (an episode titled "E1", ruff's
  E4/E7/E9) are now named and cut first, with cases that fail on the old pattern. audit_metrics
  counts by the same definition.
- button-primitive: both file lists live in the rule body, out of sight of the snapshot and the
  register; each is now pinned to its exact set of ui/ files (red when either is widened).
- check.sh --brief shows a short log whole and keeps the line before each hit, so ruff's rule and
  eslint's file path survive the excerpt.
- lint-changed runs prettier over every changed frontend file, as the gate does, not only code.
- CLAUDE.md and gates.md no longer claim the basedpyright baseline was found harmless: it was never
  triaged, and the reportOptional* entries are the likeliest real bugs.
This commit is contained in:
2026-10-05 00:19:50 +02:00
parent eecc195b7e
commit d1bbe4524c
10 changed files with 137 additions and 33 deletions
+10 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { eslint } from "./lintProbe.testkit";
import { eslint, uiFiles } from "./lintProbe.testkit";
// `local/button-primitive`'s disabled check (eslint.config.js): a raw `<button disabled>` throws a
// focused keyboard user to <body> the moment it turns disabled. ~60 were swept onto ui/FocusSafeButton;
@@ -34,4 +34,13 @@ describe("a raw button that can be disabled", () => {
expect(await hits(DISABLED, "src/components/ui/FocusSafeButton.tsx")).toBe(0);
expect(await hits(DISABLED, "src/components/ui/AnchoredPopover.tsx")).toBe(0);
});
// The exemption lives in the rule body, where neither the gate snapshot nor docs/gates.md sees it,
// so this holds it to exactly those two: every other file in ui/ is refused.
it("is exempt in exactly those two of the ui/ files", { timeout: 60_000 }, async () => {
const exempt: string[] = [];
for (const file of uiFiles())
if ((await hits(DISABLED, `src/components/ui/${file}`)) === 0) exempt.push(file);
expect(exempt).toEqual(["AnchoredPopover.tsx", "FocusSafeButton.tsx"]);
});
});