Skip to content

ci: wire codemod --check suite + bundle gate into GitHub Actions#40

Closed
adm01-debug wants to merge 1 commit into
mainfrom
claude/ci-codemod-checks
Closed

ci: wire codemod --check suite + bundle gate into GitHub Actions#40
adm01-debug wants to merge 1 commit into
mainfrom
claude/ci-codemod-checks

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

Summary

Adds a regression gate that runs every codemod's --check mode on each PR, preventing reintroduction of categories already cleaned up (no-duplicate-imports, eqeqeq non-null, no-unused-vars, no-explicit-any safe patterns, lucide barrel imports) and the bundle-size budget (per-chunk gzip ≤ 500 kB).

Why

PRs #34 (bundle gate), #36 (eqeqeq cleanup), #37 (unused-vars cleanup), #38 (any→unknown cleanup), and the earlier #29 (eslint config + auto-fix) collectively cleared ~700 ESLint problems from the codebase. Without an enforcement gate, those gains regress on the next push that introduces a new == or unused import.

This PR is the gate. It's deliberately tolerant of in-flight codemod PRs so it can merge in any order with #34/#36/#37/#38 and progressively activate.

What's added

scripts/run-codemod-checks.mjs

Aggregating runner that invokes each codemod's --check mode in sequence and prints a unified pass/fail/skipped table:

▶ no-duplicate-imports                 OK
▶ eqeqeq (strict-equality)             OK
▶ no-unused-vars                       FAIL
   ✖ 3 file(s) have unused identifiers
   ...
▶ no-explicit-any (safe patterns)      OK
▶ lucide-react per-icon imports        skipped (script not present in this branch)

Summary: 3 pass, 1 fail, 1 skipped (of 5).

Two modes:

Mode Missing script Exit
default skipped 0 if no fail
--strict fail (script missing) 1

CI uses default mode for tolerance to merge order.

.github/workflows/lint-codemods.yml

Triggered on PRs touching src/, codemod scripts, eslint config, or package files. Two steps:

  1. Codemod regression gates (npm run check:codemods)
  2. Bundle size budget (scripts/bundle-analysis.mjs --check) — defensive: skipped if the script is absent, runs once it lands

package.json — npm script aliases

"check:codemods":          "node scripts/run-codemod-checks.mjs",
"check:duplicate-imports": "node scripts/codemod-merge-duplicate-imports.mjs --check",
"check:strict-equality":   "node scripts/codemod-strict-equality.mjs --check",
"check:unused-vars":       "node scripts/codemod-unused-vars.mjs --check",
"check:any-to-unknown":    "node scripts/codemod-any-to-unknown.mjs --check",
"check:lucide-imports":    "node scripts/codemod-lucide-imports.mjs --check",

Validation

Test Result
YAML loads
Default mode on this branch exit 0 (5 skipped — codemods not landed yet)
--strict mode exit 1 (5 fail (script missing) as expected)

When #34/#36/#37/#38 merge, the corresponding entries flip from skipped to OK on the next CI run, and any future regression flips them to FAIL, blocking the offending PR.

https://claude.ai/code/session_01KWeDG


Generated by Claude Code

Adds a regression gate that runs every codemod's --check mode on
each PR, preventing reintroduction of categories already cleaned up
(no-duplicate-imports, eqeqeq non-null, no-unused-vars, no-explicit-
any safe patterns, lucide barrel imports) and the bundle-size budget
(per-chunk gzip ≤ 500 kB).

## scripts/run-codemod-checks.mjs (new)

Aggregating runner that invokes each codemod's --check mode in
sequence and prints a unified pass/fail/skipped table. Designed to
be tolerant of in-flight branches: codemod scripts that haven't
landed on main yet (PRs #34, #36, #37, #38) are reported as
'skipped', not failures, so this PR can merge in any order with
the codemod PRs and the gate progressively activates as each
one lands.

  Default mode:  missing scripts → skipped (exit 0)
  --strict mode: missing scripts → fail    (exit 1)

The CI workflow uses default mode.

## .github/workflows/lint-codemods.yml (new)

Triggered on PRs that touch src/, the codemod scripts, eslint
config, or package files. Two steps:

  1. npm run check:codemods           — codemod --check suite
  2. Bundle size budget               — defensive: skipped if
                                        scripts/bundle-analysis.mjs
                                        is absent, runs the
                                        --check mode otherwise

## package.json — npm script aliases

  check:codemods            — orchestrator (used by CI)
  check:duplicate-imports   — codemod-merge-duplicate-imports.mjs --check
  check:strict-equality     — codemod-strict-equality.mjs --check
  check:unused-vars         — codemod-unused-vars.mjs --check
  check:any-to-unknown      — codemod-any-to-unknown.mjs --check
  check:lucide-imports      — codemod-lucide-imports.mjs --check

## Validation

  YAML            python yaml.safe_load → OK
  Default mode    exit 0 (5 skipped on this branch — codemods not landed yet)
  --strict mode   exit 1 (5 'fail (script missing)' as expected)

When PRs #34/#36/#37/#38 merge, the corresponding entries flip from
'skipped' to 'OK' on the next CI run, and any future regression
flips them to 'FAIL', blocking the offending PR.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a71120a8-28dc-4e55-96cb-8ff2d0c305b2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/ci-codemod-checks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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