Skip to content

fix(artifacts): memoize the artifacts fallback to satisfy the eslint ratchet - #7722

Merged
bolichen97 merged 1 commit into
mainfrom
fix/artifacts-memo-eslint-ratchet
Sep 1, 2026
Merged

fix(artifacts): memoize the artifacts fallback to satisfy the eslint ratchet#7722
bolichen97 merged 1 commit into
mainfrom
fix/artifacts-memo-eslint-ratchet

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Problem / Motivation

Frontend Lint & Type Check is red on main itself, so every open
PR's lint check fails: #7558 ratcheted --max-warnings to 603, but the
tree currently emits 604 (verified on a clean origin/main
worktree: npx eslint src/ -> 604 problems).

The over-cap warning is ArtifactsPage.tsx's bare
const artifacts = data?.artifacts || []: the fallback mints a fresh
array every render, and react-hooks/exhaustive-deps flags it once per
consuming 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 rule
names. 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

  • Clean-main probe: eslint src/ 604 (cap 603, exit 1); this branch:
    601, exit 0.
  • tsc -b clean; 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.

…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.
@CrysisDeu
CrysisDeu requested a review from a team September 1, 2026 20:36
@CrysisDeu
CrysisDeu requested a review from a team as a code owner September 1, 2026 20:36
@CrysisDeu
CrysisDeu requested a review from Zedmor September 1, 2026 20:36
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

UX-level review of b59a4ab1db81c689591a94c2b5a5db0df196c84d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Internal memoization only — no user-facing string, state, layout, or behavior change; nothing a user could perceive differently.

[UX-REVIEWED] b59a4ab

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of b59a4ab1db81c689591a94c2b5a5db0df196c84d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed b59a4ab1db81c689591a94c2b5a5db0df196c84d — this comment is updated in place on each push.

Review details

useMemo is imported and the change is a correct, standard memoization with the right dependency. No behavioral change, no boundary crossed. Nothing survives.

No findings.

[OPUS-REVIEWED] b59a4ab

Verdict parsed from the review's SHA-scoped output markers for commit b59a4ab1db81c689591a94c2b5a5db0df196c84d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable b59a4ab1db81c689591a94c2b5a5db0df196c84d: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of b59a4ab1db81c689591a94c2b5a5db0df196c84d — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

All claims verify: the ratchet cap 603 lives at .github/workflows/ci.yml:1329, the file has exactly three hooks consuming artifacts in their deps (lines 1188, 1331, 1373 — matching the claimed three warnings), useMemo was already imported, and no new surface is added. Sibling bare fallbacks exist (7 hits for = data?.X || [] elsewhere in website/src), but those sit inside the ratcheted budget, which is this repo's own deferral mechanism.

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 ships

Intent: 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.

  1. The artifacts list keeps a stable identity between fetches, silencing three exhaustive-deps warnings (604 → 601) — justified; verified: three hooks consume artifacts in deps (ArtifactsPage.tsx:1188,1331,1373), cap is 603 (ci.yml:1329).
  2. Downstream filter/preview memos stop recomputing on unrelated re-renders — declared side effect of item 1, not a separate capability.
  3. A four-line why-comment above the memo — rides along, but states the constraint per code-style rules; harmless.

Watch

  • The same bare || [] fallback pattern has 7 siblings (grepped = data\?\.\w+ \|\| \[\] in website/src: CrewWebhookSection, RegistryManager ×2, ProjectsPage, ArtifactDeployPage, WhatsAppPanel, SearchPanel). Leaving them is correct here — they sit inside the ratchet budget, and the ratchet is the repo's accepted general fix — so this is noted, not demanded.
  • The true cause (a ratchet lowered without verifying main's live count survives concurrent merges) is process-level and out of this diff's scope; the description names it, so the fix honestly sits at mechanism level.

[FIRST-PRINCIPLES-REVIEWED] b59a4ab

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of b59a4ab1db81c689591a94c2b5a5db0df196c84d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] b59a4ab

False positive or not applicable? A repository writer can comment:
/ai-review override gpt b59a4ab1db81c689591a94c2b5a5db0df196c84d: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 1, 2026
@bolichen97
bolichen97 merged commit a492b65 into main Sep 1, 2026
107 of 116 checks passed
@bolichen97
bolichen97 deleted the fix/artifacts-memo-eslint-ratchet branch September 1, 2026 23:13
bolichen97 added a commit that referenced this pull request Sep 1, 2026
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.
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants