Skip to content

ci: gate packages/types on tsc - #828

Closed
lilyshen0722 wants to merge 1 commit into
fix/frontend-typecheck-gatefrom
ci/typecheck-packages-types
Closed

ci: gate packages/types on tsc#828
lilyshen0722 wants to merge 1 commit into
fix/frontend-typecheck-gatefrom
ci/typecheck-packages-types

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Stacked on #826 — base is that branch, not main, because #826 is the only other open PR touching tests.yml and this lands in the adjacent hunk. Merge #826 first and this rebases to nothing.

packages/types defines typecheck: tsc --noEmit and nothing has ever invoked it — the same defined-but-uninvoked shape #826 fixes for the frontend. @ux-lead found it; this gates it.

It costs no install

The package has zero dependencies and zero external imports, so it typechecks with the compiler the backend step already installed:

- name: Shared types TypeScript check
  run: |
    cd packages/types
    ../../backend/node_modules/.bin/tsc --noEmit -p tsconfig.json

That's a correction to the framing it was handed to me with ("a two-line add whose only cost is an install step") — there is no install step. Verified: deps: {}, devDeps: {}, and no non-relative import anywhere in src/.

It is green today, which is the only moment a gate is free.

Mutation-checked

A gate that cannot go red is decoration, so:

state result
clean exit 0
export const __mutationProbe: number = "not a number" in src/user.ts TS2322, exit 2
probe reverted exit 0, git status clean

Workflow YAML re-parsed after the edit; step lands after both existing typechecks and before the test steps.

packages/commonly-apps is deliberately NOT here

It has the identical uninvoked tsc:check, but it needs @types/node and this job never npm cis it, so gating it means adding an install step — a different change with a different cost. Running it as-is yields TS2688 cannot find type definition file for 'node', which is an environment gap, not a finding. Its real state is unknown, not assumed green. Flagging rather than silently scoping it out.

Not verified

Any follow-up that adds the packages/* install + commonly-apps step touches .github/workflows/ again and needs the workflow-scoped token — same constraint this push had.

🤖 Generated with Claude Code

packages/types defines `typecheck: tsc --noEmit` and nothing has ever
invoked it — the same defined-but-uninvoked shape #826 fixes for the
frontend. It is green today, which is the only moment a gate is free.

Costs no install: the package has zero dependencies and zero external
imports, so it typechecks with the compiler the backend step already
installed. Two lines and a comment.

packages/commonly-apps is deliberately left out. It has the identical
uninvoked `tsc:check` script, but it needs @types/node and this job never
npm ci's it, so gating it means adding an install step. Its real state is
unknown rather than assumed green — reporting it as green off a TS2688
"cannot find type definition file for 'node'" would be reporting an
environment gap as a result.

Mutation-checked: a deliberate `const x: number = "str"` in src/user.ts
fails the step with TS2322 (exit 2), and the step returns to exit 0 once
reverted, so the gate can actually go red.

Stacked on #826 (25e6de7) because it is the only other open PR touching
tests.yml; merging it first avoids a conflict in the same hunk.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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