fix(ci): make the typecheck pass and run it on pull requests - #545
Draft
claude[bot] wants to merge 4 commits into
Draft
fix(ci): make the typecheck pass and run it on pull requests#545claude[bot] wants to merge 4 commits into
claude[bot] wants to merge 4 commits into
Conversation
Under the CLI package's stricter noUncheckedIndexedAccess setting, indexing into a blockquote's children yields MdastNode | undefined, which produced three type errors in github-alert.ts. Narrow with optional chaining and an explicit guard at the call site instead of asserting. Both indexes are already proven non-empty by their callers, so runtime behaviour is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ENoNC4NzabSZT7yBWy6fn
The CLI typechecks its test files but had no types for Bun's built-in test module, so tsc could not resolve the bun:test import in src/lib/docs-config.test.ts. Follow the convention already used in packages/mdx-bundler: an @types/bun devDependency plus types: [bun] in compilerOptions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ENoNC4NzabSZT7yBWy6fn
bun run typecheck was only invoked by the CLI publish workflow, so type errors on main were invisible on pull requests. Add a typecheck job to the pull request workflow alongside the existing biome and test jobs, using the same checkout/setup-bun/install steps and the per-package working-directory style from publish-cli.yml. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ENoNC4NzabSZT7yBWy6fn
|
🚅 Deployed to the docs.page-pr-545 environment in docs.page
|
railway-app
Bot
temporarily deployed
to
docs.page / docs.page-pr-545
September 2, 2026 08:11
Destroyed
Resolves the conflict with the cli-v2.1.0 release commit (8218580), which fixed the same typecheck breakage a different way. - packages/mdx-bundler/src/docs-ir/github-alert.ts: took main's version. It already carries both narrowing fixes (`first?.type` and an early `if (!first) return []`), so this branch's equivalent guard is dropped rather than duplicated. - packages/cli/tsconfig.json: kept main's `include`/`exclude` as-is and layered this branch's `types: ["bun"]` on top, matching the existing packages/mdx-bundler/tsconfig.json convention. - packages/cli/package.json: main's 2.1.0 version bump plus the `@types/bun` devDependency. - bun.lock: regenerated with `bun install`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ENoNC4NzabSZT7yBWy6fn
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Elliot Hesp, Mike Hardy · Slack thread
Summary
Spin-off from #544 at the request of Mike Hardy: if there is a typecheck, and it is failing on main, then there is A) a CI problem and B) a types problem. Address both.
What was broken.
bun run typecheckinpackages/clifails onmaintoday with four errors. Nobody saw it, because that script is only ever invoked by the CLI publish workflow (on acli-v*tag) and never by the pull-request workflow. Type breakage could land onmainand only surface at release time.Errors on
main:What changed — three commits:
packages/mdx-bundler/src/docs-ir/github-alert.ts— the three real type errors. The CLI package setsnoUncheckedIndexedAccess, and it typechecks the bundler through the workspace import, so indexing into the children of a blockquote isMdastNode | undefinedthere even though the tsconfig of the bundler itself does not flag it. Fixed by narrowing:first?.type !== ...(matching the optional-chaining style already used elsewhere in the same file) plus an explicit guard at thestripAlertMarkerFromParagraphcall site. Both indexes are already proven non-empty by their callers, so runtime behaviour is unchanged. Noany, no ts-ignore, no excluded files.packages/cli— types for the built-in Bun test module. The CLI typechecks its test files but had nothing declaringbun:test, so tsc skipped it as a URI-like specifier and errored. Fixed the way the repo already does it inpackages/mdx-bundler: an@types/bundevDependency plus atypes: [bun]entry incompilerOptions. Scoped to the one package that needed it..github/workflows/pull_request.yaml— a newtypecheckjob next to the existingquality(biome) andtestjobs, using the same checkout / setup-bun /bun installsteps and the per-packageworking-directorystyle already used inpublish-cli.yml. It runsbun run typecheckforpackages/mdx-bundlerandpackages/cli.Scope
app/(hosted site, MCP, Ask AI)packages/cli/packages/mdx-bundler/docs/(product documentation)Type of change
Test plan
Commands run locally, with exact results:
bun run typecheckinpackages/clibun run typecheckinpackages/mdx-bundlerbunx @biomejs/biome ci .at rootbun testat rootThe new CI job was verified to actually fail, not merely to run: a deliberate type error was appended to
packages/cli/src/index.tsand then topackages/mdx-bundler/src/index.ts,bun run typecheckreported the error and exited 2 in each package, and both probes were removed (working tree confirmed clean before committing).bun run checkpasses locallybun dev, CLI command, or other relevant command)docs/(if user-facing)Notes for reviewers
bun.lockpicks up@types/bun@1.3.14forpackages/cli, pinned to the same versionapp/already uses, so the diff is purely additive with no unrelated resolution churn.app/has notypecheckscript and its tsconfig excludes test files. Adding a Next.js typecheck to CI would need a new script plus, most likely, a round of real fixes across the app, which is a bigger job than this spin-off. Happy to open a follow-up if you want it covered.packages/mdx-bundlernorapp/typechecks its own test files, since both tsconfigs exclude them, so test-only type errors there stay invisible. Tightening that is a separate change.typecheckscript was added. The workflow calls each package directly, matching whatpublish-cli.ymlalready does. Say the word if you would rather have a root aggregate script.🤖 Generated with Claude Code
https://claude.ai/code/session_015ENoNC4NzabSZT7yBWy6fn