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 -3
View File
@@ -28,9 +28,11 @@ BE_COMPLEXITY = 10 # ruff's C901 default
FE_COMPLEXITY = 20 # the frontend's line
# what planCodes.contract.test.ts holds the code to: an epic (`E28`, `E9.5`) or a roadmap item (`R14`),
# not `E2E`, not a ruff rule family (`E4/E7/E9`), not a TV episode (`S2 · E5`, an episode titled "E1")
EPIC_CODE = re.compile(r'(?<![/"])\b(E\d{1,2}(\.\d+)?|R\d{1,2})\b(?![/"E])')
# not `E2E`, not a TV episode (`S2 · E5`); NOT_CODES are its named exceptions, cut first (an episode
# titled "E1", ruff's default `E4/E7/E9`)
EPIC_CODE = re.compile(r"\b(E\d{1,2}(\.\d+)?|R\d{1,2})\b(?!E)")
EPISODE = re.compile(r"S\d{1,2}\s?·?\s?E\d+")
NOT_CODES = re.compile(r'"E\d{1,2}"|\bE4/E7/E9\b')
NARRATION = re.compile(r"\b(used to|no longer)\b", re.IGNORECASE)
@@ -114,7 +116,12 @@ def _complexity() -> dict[str, object]:
def _noise(be: list[tuple[Path, list[str]]], fe: list[tuple[Path, list[str]]]) -> dict[str, object]:
every = be + fe
epic = [(p, ln) for p, ls in every for ln in ls if EPIC_CODE.search(EPISODE.sub("", ln))]
epic = [
(p, ln)
for p, ls in every
for ln in ls
if EPIC_CODE.search(NOT_CODES.sub("", EPISODE.sub("", ln)))
]
be_c = sum(_comment_lines(ls, True) for _, ls in be)
fe_c = sum(_comment_lines(ls, False) for _, ls in fe)
return {