Skip to content

chore(ci): add typecheck scripts for local TypeScript verification#1438

Open
Harsh23Kashyap wants to merge 1 commit into
sourcebot-dev:mainfrom
Harsh23Kashyap:typecheck-workflow
Open

chore(ci): add typecheck scripts for local TypeScript verification#1438
Harsh23Kashyap wants to merge 1 commit into
sourcebot-dev:mainfrom
Harsh23Kashyap:typecheck-workflow

Conversation

@Harsh23Kashyap

@Harsh23Kashyap Harsh23Kashyap commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Adds the local tooling half of issue #1437:

  • Root typecheck script in package.json that runs tsc --noEmit in every TypeScript workspace via yarn workspaces foreach --all --topological run typecheck, mirroring the existing test / lint conventions.
  • Per-package typecheck scripts in web, backend, db, schemas, and shared, each invoking tsc --noEmit on that workspace's tsconfig.

This gives contributors a one-command way to type-check the whole monorepo locally (yarn typecheck) or per-workspace (yarn workspace @sourcebot/backend typecheck etc.).

Why not also add the CI workflow in this PR

Running yarn typecheck against the current main surfaces ~175 latent type errors in the web package, almost all of them in test fixtures. The root cause is that two migrations added columns to UserToOrg (20260702000000 and 20260702000001) and the AgentSkill feature was merged (migration 20260706000100), but the corresponding fields were not declared in packages/db/prisma/schema.prisma. Once the schema drifts, downstream Prisma types and downstream test fixtures drift too.

That schema-drift is a real bug. It is also a separate concern from "add the typecheck CI workflow", and fixing it (updating schema.prisma, regenerating the client, and updating test fixtures across the web package) would significantly expand the diff of this PR. Per senior OSS discipline, scope-cut rather than ship a 200-file PR masquerading as "tooling".

Tracking the full plan:

  • This PR: yarn typecheck and per-package scripts (additive). PR is mergeable as-is.
  • Follow-up PR(s): declare the missing columns in schema.prisma, regenerate the client, fix the test fixtures, then add .github/workflows/typecheck.yml that wires the new tool into CI.

Issue #1437 remains open as the umbrella for the full plan.

Test plan

  • yarn workspace @sourcebot/web typecheck — note: web fails; see "Why not also add the CI workflow" (expected; pre-existing)
  • yarn workspace @sourcebot/backend typecheck — passes 0
  • yarn workspace @sourcebot/db typecheck — passes 0 (after running yarn prisma:generate)
  • yarn workspace @sourcebot/schemas typecheck — passes 0
  • yarn workspace @sourcebot/shared typecheck — passes 0
  • ReadLints not applicable (package.json JSON files are not linted)

Backward compatibility

None. Pure additive tooling. Existing build / test / lint / dev scripts untouched. No new dependencies. No source code changes. No new CI workflow.

Risk

  • The new yarn typecheck script exposes that main has latent type errors. This is information, not regression: it didn't run before because the script didn't exist, so the errors were not surfaced. Locally a contributor who runs yarn typecheck will see the same errors a future CI workflow would surface.
  • The web workspace's tsc --noEmit reports failures because .next/types/**/*.ts is included in tsconfig.json include but only generated by next build. So the workflow depends on a prior build for accurate results. This is an existing characteristic of the web tsconfig and is not introduced by this PR.

Out of scope (separate work)

  • Fixing the latent type errors in packages/web test fixtures (tracked separately).
  • Adding a new .github/workflows/typecheck.yml CI workflow (will follow the schema-drift fix).
  • Re-architecting the web tsconfig.json to split build-time types from source types.
  • Adding tsc --watch for dev mode.

Refs #1437

Summary by CodeRabbit

  • Chores
    • Added a project-wide type-checking command that runs across all workspaces in dependency order.
    • Added package-level type-checking commands for backend, database, schemas, shared, and web components.
    • Type checking validates TypeScript without generating build output.

Adds a yarn typecheck script in the repository root and per-package typecheck
scripts that run tsc --noEmit in each TypeScript workspace (web, backend,
db, schemas, shared). Mirrors the existing test/lint conventions: root uses
yarn workspaces foreach --all --topological, per-package scripts execute
the same TypeScript compiler invocation in isolation.

A new .github/workflows/typecheck.yml CI workflow is intentionally NOT added
in this commit because running tsc --noEmit on the current main surfaces
~175 latent type errors in the web package (test fixtures referencing
schema-drift columns added to migrations 20260702000000 and 20260702000001
but not yet declared in schema.prisma). A follow-up PR will fix the
schema-drift, update test fixtures, then add the CI workflow.

Mirrors CONTRIBUTING.md 'Developer tooling' / 'Bug fixes' guidance: pure
additive tooling, no source code changes, no new dependencies.

Refs sourcebot-dev#1437
@Harsh23Kashyap Harsh23Kashyap changed the title chore(ci): add typecheck scripts chore(ci): add typecheck scripts for local TypeScript verification Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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

Run ID: d84dc6ef-848a-4c1f-9004-94f463dd5d62

📥 Commits

Reviewing files that changed from the base of the PR and between 53360a8 and 3fcb450.

📒 Files selected for processing (6)
  • package.json
  • packages/backend/package.json
  • packages/db/package.json
  • packages/schemas/package.json
  • packages/shared/package.json
  • packages/web/package.json

Walkthrough

Adds typecheck scripts to all workspaces and a root command that runs them across the dependency graph in topological order.

Changes

Workspace typecheck automation

Layer / File(s) Summary
Workspace scripts and root orchestration
package.json, packages/{backend,db,schemas,shared,web}/package.json
Each workspace adds tsc --noEmit, while the root package runs all workspace typechecks in topological order.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related issues

  • Issue 1437 — Covers the same root and workspace TypeScript typecheck script additions.
🚥 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 clearly summarizes the main change: adding typecheck scripts for TypeScript verification across the repo.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Harsh23Kashyap

Copy link
Copy Markdown
Author

Can someone take a look when you have a chance?

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3fcb450. Configure here.

Comment thread packages/db/package.json
"private": true,
"scripts": {
"build": "yarn prisma:generate && tsc",
"typecheck": "tsc --noEmit",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Db typecheck skips Prisma generate

Medium Severity

The new typecheck scripts in packages/db and packages/schemas skip their respective code generation steps (Prisma client, JSON schema to TS) that build includes. This can lead to typecheck passing against stale generated types, missing actual type errors or schema drift.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3fcb450. Configure here.

"private": true,
"scripts": {
"build": "yarn generate && tsc",
"typecheck": "tsc --noEmit",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Schemas typecheck skips generate

Medium Severity

The new typecheck script runs only tsc --noEmit, while build runs yarn generate first. Edits to JSON schemas under schemas/ without re-running generate can leave committed src types stale, so yarn typecheck may pass while build would compile updated generated files and fail.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3fcb450. Configure here.

Comment thread package.json
"build": "cross-env SKIP_ENV_VALIDATION=1 yarn workspaces foreach --all --topological run build",
"test": "yarn workspaces foreach --all --topological run test",
"lint": "yarn workspaces foreach --all --topological run lint",
"typecheck": "yarn workspaces foreach --all --topological run typecheck",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Query language omitted from typecheck

Medium Severity

Root typecheck uses workspaces foreach --all, but @sourcebot/query-language has no typecheck script (unlike five other packages). yarn typecheck can succeed without running tsc on that workspace, even though @sourcebot/web imports it for search parsing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3fcb450. Configure here.

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.

1 participant