fix(artifacts): memoize the artifacts fallback to satisfy the eslint ratchet - #7722
Conversation
…ratchet main is red on Frontend Lint: the eslint warning cap was ratcheted to 603 while the tree sits at 604, so every open PR's lint check fails. The over-cap warning is ArtifactsPage's bare `data?.artifacts || []` — the fallback mints a fresh array every render and exhaustive-deps flags it once per consuming hook, so the undo-bar useCallback added a third instance of a warning that existed twice before the ratchet landed. Wrapping the initialization in useMemo (the fix the rule itself names) removes all three instances: 604 -> 601, back under the cap with slack for the next in-flight PR.
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Internal memoization only — no user-facing string, state, layout, or behavior change; nothing a user could perceive differently. [UX-REVIEWED] b59a4ab |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Minimal one-line root-cause fix that unbreaks main's lint gate for every open PR; description matches the diff exactly. [DESIGN-REVIEWED] b59a4ab |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review details
No findings. [OPUS-REVIEWED] b59a4ab Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All claims verify: the ratchet cap 603 lives at First-Principles-Verdict: PASS One line unwedges a red main — the exact fix the lint rule names, no rider, no new surface. What this change shipsIntent: get every open PR's lint check green again by removing the three warnings that pushed main over the 603-warning ratchet. This is a FIX.
Watch
[FIRST-PRINCIPLES-REVIEWED] b59a4ab |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Two separate pieces of lint debt on `main`, both invisible to the gate:
1. `website/src/apps/issue-radar/components/crew-ghost-sprite.gen.mjs:173` carries
an `eslint-disable-next-line no-eval` that ESLint reports as unused. It always
was: every rule block in `website/eslint.config.js` is scoped to
`src/**/*.{ts,tsx}`, so no rule is enabled for a `.mjs` file and the directive
could never suppress anything.
2. `--max-warnings 603` now sits 2 above the measured count. #7722 burned three
warnings down without lowering it, which is precisely the state the gate's own
comment forbids: "The ceiling must EQUAL the measured count, not sit above it:
slack is silent admission, and a warning that lands inside it never surfaces
again."
Replaced the dead directive with a plain comment that keeps the intent -- why
`eval` is safe in that hand-run generator -- and records when the directive
should come back. Then re-measured and set the ceiling to the count.
Measured with `cd website && npx eslint src/`: 601 on `a492b653c`, 600 here.
Rejected alternative, with numbers: adding a `src/**/*.mjs` rule block would make
the directive used and also drop the warning, and would extend lint coverage to a
file currently linted by nothing -- but it measures 607, because the generator's
four `console.log` calls then land as `no-console`. That needs the ceiling raised.
Problem / Motivation
Frontend Lint & Type Checkis red onmainitself, so every openPR's lint check fails: #7558 ratcheted
--max-warningsto 603, but thetree currently emits 604 (verified on a clean
origin/mainworktree:
npx eslint src/-> 604 problems).The over-cap warning is
ArtifactsPage.tsx's bareconst artifacts = data?.artifacts || []: the fallback mints a fresharray every render, and
react-hooks/exhaustive-depsflags it once perconsuming hook. It was flagged twice when the ratchet was set; the
move-undo bar (#7259) then added a third consuming hook (
useCallback),landing main at 604.
Change
One line: wrap the initialization in
useMemo— the exact fix the rulenames. This removes all three instances (the two pre-ratchet ones and
the new one): 604 -> 601, back under the cap with slack.
Behavior is unchanged; consumers additionally gain a stable reference
between fetches instead of a fresh
[]per render.Testing
eslint src/604 (cap 603, exit 1); this branch:601, exit 0.
tsc -bclean; Artifact page suites 160/160.Why no screenshot: reference-identity-only change, no rendered
surface differs.
no linked issue: broken-main lint hotfix found while babysitting PR #7700.
Pattern harvest
Rule candidate: when a warning-count ratchet (eslint --max-warnings N) is
lowered, CI should verify main's actual count <= N in the same PR — a
concurrently-merging PR that adds one instance of an already-present warning
lands main over the cap and reds every open PR's lint check.