Skip to content

ci: gate every PR on tsc-cli regardless of touched paths - #2460

Closed
cjagwani wants to merge 1 commit into
mainfrom
ci/explicit-typecheck-gate
Closed

ci: gate every PR on tsc-cli regardless of touched paths#2460
cjagwani wants to merge 1 commit into
mainfrom
ci/explicit-typecheck-gate

Conversation

@cjagwani

@cjagwani cjagwani commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Prevents the class of regression that required #2458. Adds an unconditional typecheck:cli step to the shared CI action, and broadens the prek hook filter to match what tsconfig.cli.json actually typechecks.

Related

Follow-up to #2458 (which fixed the symptom — this addresses the root cause).

Root cause recap

Changes

  • .github/actions/basic-checks/action.yaml — new Typecheck CLI + tests (strict) step running npm run typecheck:cli unconditionally. Independent of prek hook configuration, so future filter drift can't hide a tsc error from CI.
  • .pre-commit-config.yaml — widen tsc-cli hook's files: from ^(bin|scripts)/ to ^(bin/|scripts/|src/|test/|tsconfig.*\.json$). Local pre-push now gates the same surface CI does.

Belt-and-suspenders. Either one would have caught #2130's regression on its own; running both means local hook and CI are always in sync on this class of check.

Type of Change

  • Code change (feature, bug fix, or refactor)

Verification

AI Disclosure

  • AI-assisted — tool: Claude Code

Signed-off-by: Charan Jagwani cjagwani@nvidia.com

Summary by CodeRabbit

  • Chores
    • Enhanced continuous integration with stricter type-checking validation to prevent regressions and improve code quality.

Prevents the class of regression that required #2458. The prek tsc-cli
hook had files: ^(bin|scripts)/, so a PR touching only test/ or src/
skipped the check entirely. That let #2130 (test-only) land without
typecheck, then #2422 tightened strict: true and the latent errors
surfaced for every downstream PR — six open PRs were stuck on the same
cluster by the time it was noticed.

Two changes, belt-and-suspenders:
- New explicit Typecheck CLI + tests (strict) step in basic-checks
  action. Runs npm run typecheck:cli unconditionally. Independent of
  how anyone configures prek, so future hook-filter drift can't hide a
  tsc error from CI.
- Widen the prek tsc-cli hook's files: to match what tsconfig.cli.json
  actually covers (bin/, scripts/, src/, test/, tsconfig.*.json). Local
  pre-push now gates the same class of change that CI does.

Zero runtime impact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The changes expand TypeScript strict-mode type checking coverage by introducing a dedicated CI step for CLI typechecking and broadening the pre-commit hook's file-pattern matcher to include src/, test/, and tsconfig.*.json files.

Changes

Cohort / File(s) Summary
CI Type Checking Gate
.github/actions/basic-checks/action.yaml
Added a new workflow step to explicitly run CLI typecheck in strict mode (npm run typecheck:cli), ensuring strict-mode regressions are caught regardless of pre-commit hook coverage.
Pre-commit Hook File Filter
.pre-commit-config.yaml
Updated the tsc-cli pre-push hook's file-matching filter to include src/, test/, and tsconfig.*.json files, broadening when strict-mode TypeScript checking is triggered.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Hop hop, the types now align,
With stricter checks, this diff is fine,
CI gates and configs combine,
No regressions shall escape our line!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: gate every PR on tsc-cli regardless of touched paths' directly and clearly summarizes the main change: ensuring TypeScript CLI typecheck runs on every PR independent of which files are modified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/explicit-typecheck-gate

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.pre-commit-config.yaml:
- Around line 245-246: The pre-commit hook currently uses both the files pattern
and the types_or filter so tsconfig.*\.json (matched by the files regex) never
triggers because types_or: [ts, tsx] restricts to TypeScript file types; update
the .pre-commit-config.yaml by either removing the types_or key entirely from
this hook or expanding/restructuring it so JSON config files are included (for
example add "json" to types_or or separate the tsconfig.*\.json pattern into its
own hook entry), ensuring the "files" regex for tsconfig.*\.json and the
types_or setting no longer block each other.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ad954283-8ff1-423c-b837-c3630e1396b8

📥 Commits

Reviewing files that changed from the base of the PR and between 260b237 and 9c0ad9c.

📒 Files selected for processing (2)
  • .github/actions/basic-checks/action.yaml
  • .pre-commit-config.yaml

Comment thread .pre-commit-config.yaml
Comment on lines +245 to 246
files: ^(bin/|scripts/|src/|test/|tsconfig.*\.json$)
types_or: [ts, tsx]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

In pre-commit/prek hook matching, when both filesandtypes_or are set, must a changed file satisfy both filters to trigger the hook?

💡 Result:

Yes, a changed file must satisfy both the files filter (if specified) and the types_or filter to trigger the hook. All top-level filters (files, types, types_or, exclude_types) are combined with AND logic after the initial files/exclude regex filtering.

Citations:


Remove types_or filter or restructure to include tsconfig.*.json files.

The files pattern includes tsconfig.*\.json on Line 245, but types_or: [ts, tsx] on Line 246 prevents JSON files from triggering the hook. Pre-commit applies both filters with AND logic, so a file must match both patterns; since tsconfig.*.json has type json, not ts/tsx, changes to config files skip this hook.

Suggested fix
-        files: ^(bin/|scripts/|src/|test/|tsconfig.*\.json$)
-        types_or: [ts, tsx]
+        files: ^((bin|scripts|src|test)/.*\.(ts|tsx)$|tsconfig.*\.json$)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
files: ^(bin/|scripts/|src/|test/|tsconfig.*\.json$)
types_or: [ts, tsx]
files: ^((bin|scripts|src|test)/.*\.(ts|tsx)$|tsconfig.*\.json$)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.pre-commit-config.yaml around lines 245 - 246, The pre-commit hook
currently uses both the files pattern and the types_or filter so
tsconfig.*\.json (matched by the files regex) never triggers because types_or:
[ts, tsx] restricts to TypeScript file types; update the .pre-commit-config.yaml
by either removing the types_or key entirely from this hook or
expanding/restructuring it so JSON config files are included (for example add
"json" to types_or or separate the tsconfig.*\.json pattern into its own hook
entry), ensuring the "files" regex for tsconfig.*\.json and the types_or setting
no longer block each other.

@cjagwani

Copy link
Copy Markdown
Collaborator Author

Superseded by #2461 — trimmed to just the CI step per review (the prek hook-filter widening was nice-to-have but not load-bearing since --no-verify can bypass it).

@cjagwani cjagwani closed this Apr 24, 2026
@wscurran wscurran added the chore Build, CI, dependency, or tooling maintenance label Jun 8, 2026
@cv
cv deleted the ci/explicit-typecheck-gate branch June 28, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Build, CI, dependency, or tooling maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants