chore(ci): add typecheck scripts for local TypeScript verification#1438
chore(ci): add typecheck scripts for local TypeScript verification#1438Harsh23Kashyap wants to merge 1 commit into
Conversation
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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughAdds ChangesWorkspace typecheck automation
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Can someone take a look when you have a chance? |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ 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.
| "private": true, | ||
| "scripts": { | ||
| "build": "yarn prisma:generate && tsc", | ||
| "typecheck": "tsc --noEmit", |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit 3fcb450. Configure here.
| "private": true, | ||
| "scripts": { | ||
| "build": "yarn generate && tsc", | ||
| "typecheck": "tsc --noEmit", |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 3fcb450. Configure here.
| "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", |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 3fcb450. Configure here.


Summary
Adds the local tooling half of issue #1437:
typecheckscript inpackage.jsonthat runstsc --noEmitin every TypeScript workspace viayarn workspaces foreach --all --topological run typecheck, mirroring the existingtest/lintconventions.typecheckscripts inweb,backend,db,schemas, andshared, each invokingtsc --noEmiton 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 typechecketc.).Why not also add the CI workflow in this PR
Running
yarn typecheckagainst the currentmainsurfaces ~175 latent type errors in the web package, almost all of them in test fixtures. The root cause is that two migrations added columns toUserToOrg(20260702000000 and 20260702000001) and the AgentSkill feature was merged (migration 20260706000100), but the corresponding fields were not declared inpackages/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:
yarn typecheckand per-package scripts (additive). PR is mergeable as-is.schema.prisma, regenerate the client, fix the test fixtures, then add.github/workflows/typecheck.ymlthat 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 0yarn workspace @sourcebot/db typecheck— passes 0 (after runningyarn prisma:generate)yarn workspace @sourcebot/schemas typecheck— passes 0yarn workspace @sourcebot/shared typecheck— passes 0ReadLintsnot applicable (package.json JSON files are not linted)Backward compatibility
None. Pure additive tooling. Existing
build/test/lint/devscripts untouched. No new dependencies. No source code changes. No new CI workflow.Risk
yarn typecheckscript exposes thatmainhas 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 runsyarn typecheckwill see the same errors a future CI workflow would surface.webworkspace'stsc --noEmitreports failures because.next/types/**/*.tsis included intsconfig.jsonincludebut only generated bynext 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)
packages/webtest fixtures (tracked separately)..github/workflows/typecheck.ymlCI workflow (will follow the schema-drift fix).tsconfig.jsonto split build-time types from source types.tsc --watchfor dev mode.Refs #1437
Summary by CodeRabbit