Skip to content

chore: add strictNullChecks allowlist tsconfig and CI gate#1009

Merged
igboyes merged 2 commits into
mainfrom
igboyes/vir-2398-set-up-dual-tsconfig-strictnullchecks-allowlist-and-ci-gate
Jun 2, 2026
Merged

chore: add strictNullChecks allowlist tsconfig and CI gate#1009
igboyes merged 2 commits into
mainfrom
igboyes/vir-2398-set-up-dual-tsconfig-strictnullchecks-allowlist-and-ci-gate

Conversation

@igboyes
Copy link
Copy Markdown
Member

@igboyes igboyes commented Jun 2, 2026

Summary

  • Adds apps/web/tsconfig.strictNullChecks.json, a secondary tsconfig that extends the base config and enables strictNullChecks, with an explicit include allowlist starting with src/app/types.ts
  • Adds a typecheck:strict script in apps/web/package.json for running the allowlist typecheck locally
  • Adds a tsc (strictNullChecks) step to the CI typecheck job so the allowlist is enforced in every PR

Test plan

  • CI passes the new tsc (strictNullChecks) step
  • Running pnpm --filter @virtool/web exec tsc -p tsconfig.strictNullChecks.json locally exits cleanly
  • Adding a file to include that has null-check violations causes the CI step to fail

Summary by Sourcery

Introduce a strict null-checking TypeScript configuration for the web app and enforce it via local scripts and CI.

Enhancements:

  • Add a strict null-checks tsconfig for the web app with an allowlist entry point.
  • Expose a typecheck:strict npm script for running the strict null-check TypeScript pass locally.

CI:

  • Add a strictNullChecks TypeScript typecheck step to the CI workflow to gate pull requests.

Add apps/web/tsconfig.strictNullChecks.json, an overlay extending the main
tsconfig that flips on only strictNullChecks over an explicit file allowlist,
seeded with src/app/types.ts. Add a typecheck:strict script and a required
strict-compile step to the check-typescript CI job so allowlisted files that
regress fail the PR. The loose main tsconfig.json is left unchanged.
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 2, 2026

VIR-2398

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jun 2, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Introduces a strict-null-checks-only TypeScript config for the web app, wires it into package scripts, and adds a CI gate so an allowlisted subset of files is compiled with strictNullChecks on every PR.

Flow diagram for new strictNullChecks CI typecheck gate

flowchart LR
    CI[GitHub_Actions_typecheck_job]
    TSC[Step tsc]
    STRICT[Step tsc_strictNullChecks]
    TSBASE[tsconfig_json]
    TSSTRICT[tsconfig_strictNullChecks_json]

    CI --> TSC
    CI --> STRICT

    TSC --> TSBASE
    STRICT --> TSSTRICT

    Dev[Developer]
    Dev --> PKG[apps_web_package_json_scripts]
    PKG --> LOCALSTRICT[typecheck_strict_script]
    LOCALSTRICT --> TSSTRICT
Loading

File-Level Changes

Change Details Files
Add a dedicated TypeScript config enabling strictNullChecks with an explicit allowlist to bootstrap migration.
  • Create a secondary tsconfig that extends the existing base config for the web app
  • Enable strictNullChecks in the secondary config while keeping the main config behavior unchanged
  • Configure the secondary config to compile only an explicit include list starting with src/app/types.ts so strict checking is opt-in and incremental
apps/web/tsconfig.strictNullChecks.json
Expose a local script to run the strict-null-check allowlist typecheck.
  • Add a typecheck:strict npm script that runs tsc against the new strictNullChecks tsconfig
  • Leave the existing typecheck script unchanged so current workflows are not disrupted
apps/web/package.json
Enforce strict-null-checks typechecking for the allowlist in CI.
  • Add a tsc (strictNullChecks) step to the CI typecheck job that runs the strict tsconfig via pnpm --filter @virtool/web exec
  • Ensure every PR runs both the existing non-strict typecheck and the new strict allowlist check
.github/workflows/ci.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8952b75b-33a4-432f-acbb-47685f9004a6

📥 Commits

Reviewing files that changed from the base of the PR and between eafad7d and 9c39bec.

📒 Files selected for processing (2)
  • .github/workflows/ci.yaml
  • apps/web/tsconfig.strictNullChecks.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/web/tsconfig.strictNullChecks.json
  • .github/workflows/ci.yaml

Summary by CodeRabbit

  • Chores
    • Enhanced TypeScript type checking in the continuous integration pipeline with stricter null safety validation to improve code reliability and catch potential type-related issues earlier in development.

Walkthrough

The PR introduces strict null checking for TypeScript in the web application. It adds a dedicated TypeScript configuration file that extends the base config and enables strict null checks scoped to src/app/types.ts, provides an npm script for local validation, and integrates the check into the CI workflow for automated enforcement.

Changes

Strict Null Checking

Layer / File(s) Summary
Strict null checks config and local npm script
apps/web/tsconfig.strictNullChecks.json, apps/web/package.json
New tsconfig.strictNullChecks.json config extends the base tsconfig and enables strictNullChecks for src/app/types.ts. Package.json adds a typecheck:strict script to run the checks locally.
CI workflow integration
.github/workflows/ci.yaml
CI workflow adds a new step to run the strict null checks via tsc with the new config file, enforcing the checks in the build pipeline.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes


A rabbit's delight in the TypeScript dawn,
With null checks now strict, loose bugs are gone,
Config in place, both script and CI flow,
Types are secured from null's shadow.
🐰✨

🚥 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 accurately summarizes the main changes: adding a strictNullChecks allowlist tsconfig configuration and a CI gate to enforce it.
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.


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

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In the CI workflow, consider invoking the new typecheck:strict script (e.g. pnpm --filter @virtool/web typecheck:strict) instead of directly calling tsc -p tsconfig.strictNullChecks.json so the command definition lives in one place and stays in sync.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the CI workflow, consider invoking the new `typecheck:strict` script (e.g. `pnpm --filter @virtool/web typecheck:strict`) instead of directly calling `tsc -p tsconfig.strictNullChecks.json` so the command definition lives in one place and stays in sync.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a strict null-checking script (typecheck:strict) to package.json and introduces a new tsconfig.strictNullChecks.json configuration file targeting src/app/types.ts. Feedback on the configuration points out that overriding the include property completely replaces the base configuration's include paths, which will prevent ambient type definitions (such as .d.ts files) from being loaded. It is recommended to update the include array to also include "src/**/*.d.ts" to ensure these global declarations remain available.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread apps/web/tsconfig.strictNullChecks.json Outdated
"compilerOptions": {
"strictNullChecks": true
},
"include": ["src/app/types.ts"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

When overriding the include property in an extending tsconfig, the base include (which is ["src/**/*"] in tsconfig.json) is completely replaced. This means any ambient type definitions (such as vite-env.d.ts or other .d.ts files in src/) will not be loaded.

As more files are added to this allowlist, any reference to global variables, Vite environment variables (import.meta.env), or other ambient types will fail to compile. Including "src/**/*.d.ts" ensures these ambient declarations are always available.

    "include": [
        "src/**/*.d.ts",
        "src/app/types.ts"
    ]

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
apps/web/tsconfig.strictNullChecks.json (1)

3-6: ⚡ Quick win

Don’t assume the strict gate can emit—inheritance already disables it

apps/web/tsconfig.strictNullChecks.json extends apps/web/tsconfig.json, which already sets compilerOptions.noEmit: true, so the strict-null gate is currently non-emitting. Adding noEmit: true to the strict config is only a defensive, self-contained improvement if you want to guard against future base-config changes.

Suggested change
 {
     "extends": "./tsconfig.json",
     "compilerOptions": {
-        "strictNullChecks": true
+        "strictNullChecks": true,
+        "noEmit": true
     },
     "include": ["src/app/types.ts"]
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/tsconfig.strictNullChecks.json` around lines 3 - 6, The strict-null
gate file tsconfig.strictNullChecks.json currently enables "strictNullChecks"
but inherits a noEmit setting from the base tsconfig.json, which can change; add
"noEmit": true to the "compilerOptions" object in tsconfig.strictNullChecks.json
(alongside "strictNullChecks") so this strict config remains non-emitting even
if the base tsconfig.json is modified, keeping the "include":
["src/app/types.ts"] unchanged.
.github/workflows/ci.yaml (1)

81-82: ⚡ Quick win

Reuse @virtool/web’s typecheck:strict script in CI

ci.yaml hardcodes tsc -p tsconfig.strictNullChecks.json, but apps/web/package.json already defines the same command as typecheck:strict (and the apps/web/tsconfig.strictNullChecks.json file exists there). Reuse the script to avoid drift.

Suggested change
             - name: tsc (strictNullChecks)
-              run: pnpm --filter `@virtool/web` exec tsc -p tsconfig.strictNullChecks.json
+              run: pnpm --filter `@virtool/web` run typecheck:strict
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yaml around lines 81 - 82, Replace the hardcoded tsc
invocation in the CI step named "tsc (strictNullChecks)" with the package script
`typecheck:strict` from the `@virtool/web` package to avoid drift; specifically,
change the step's run command to use `pnpm --filter `@virtool/web` run
typecheck:strict` so it executes the existing script (which already points to
`tsconfig.strictNullChecks.json`) instead of calling `tsc -p
tsconfig.strictNullChecks.json` directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/ci.yaml:
- Around line 81-82: Replace the hardcoded tsc invocation in the CI step named
"tsc (strictNullChecks)" with the package script `typecheck:strict` from the
`@virtool/web` package to avoid drift; specifically, change the step's run
command to use `pnpm --filter `@virtool/web` run typecheck:strict` so it executes
the existing script (which already points to `tsconfig.strictNullChecks.json`)
instead of calling `tsc -p tsconfig.strictNullChecks.json` directly.

In `@apps/web/tsconfig.strictNullChecks.json`:
- Around line 3-6: The strict-null gate file tsconfig.strictNullChecks.json
currently enables "strictNullChecks" but inherits a noEmit setting from the base
tsconfig.json, which can change; add "noEmit": true to the "compilerOptions"
object in tsconfig.strictNullChecks.json (alongside "strictNullChecks") so this
strict config remains non-emitting even if the base tsconfig.json is modified,
keeping the "include": ["src/app/types.ts"] unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 542fcb8e-86b6-48d9-9949-4bcc80431fe6

📥 Commits

Reviewing files that changed from the base of the PR and between b8814fe and eafad7d.

📒 Files selected for processing (3)
  • .github/workflows/ci.yaml
  • apps/web/package.json
  • apps/web/tsconfig.strictNullChecks.json

- Include src/**/*.d.ts so ambient declarations are not dropped by the
  include override as the allowlist grows
- Set noEmit explicitly on the strict overlay
- Run the typecheck:strict script in CI instead of duplicating the tsc call
@igboyes igboyes merged commit 5140f53 into main Jun 2, 2026
10 checks passed
@igboyes igboyes deleted the igboyes/vir-2398-set-up-dual-tsconfig-strictnullchecks-allowlist-and-ci-gate branch June 2, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant