Repository navigation
test(lab): MobileTokenizer's create harness types its spy as a callable - #8313
Merged
Merged
Conversation
`pnpm -F @astryxdesign/lab typecheck` failed on main: the create harness typed its spy as `ReturnType<typeof vi.fn>`, which vitest 4.1 types as `Mock<Procedure | Constructable>`, a mock TypeScript won't call (`spy(items, change)`: TS2348). The harness now takes the same callable type as the file's other harness; `vi.fn()` still fits it.
vjeux
requested review from
cixzhang,
imdreamrunner and
josephfarina
as code owners
October 24, 2026 22:18
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
3 tasks done
Contributor
There was a problem hiding this comment.
No changes requested: typing CreateHarness's spy with the same callable signature as Harness clears the TS2348 error, so pnpm -F @astryxdesign/lab typecheck passes and the MobileTokenizer tests still pass. Nothing further is needed from you.
[Automated review]
4 tasks done
Contributor
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsMobileTokenizer (@astryxdesign/lab) · View in Storybook
Bundle Size SummaryGzip figures measure each package's entry file, not the code an import pulls in.
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
pushed a commit
that referenced
this pull request
Oct 25, 2026
…core (#8318) Depends on #8313: until it merges, this branch carries its commit, and lab's typecheck needs it. Review the last commit. ## Maintainer impact A type error in the sources or tests of `@astryxdesign/lab`, `charts`, `richtext` or `vega` merges without a red check. CI's `typecheck` job and the push gate's `typecheck` lane run only these packages' `typecheck:docs`, which covers their `.doc.mjs` files; core alone also runs its full `typecheck`. Lab's `MobileTokenizer.test.tsx` merged with an error this way (TS2348, fixed in #8313), and anyone running `pnpm -F @astryxdesign/lab typecheck` hit it on main. ## Intended invariant Every component package's own sources and tests typecheck in both typecheck lanes, as core's do since #3197: a type error fails the required `build` join (and the release check) instead of landing on main. ## Change - `ci.yml` `typecheck` job: `Typecheck lab / charts / rich text / Vega (including tests)` after `Typecheck core (including tests)`, with the same specialized-lane guard. No new job, scope or join: `typecheck` already runs for every non-specialized change and feeds `build`. - `deploy.yml` `typecheck` lane: the same four gates after core's. - `ci-test-routing.test.mjs`: both workflows must run `pnpm -F @astryxdesign/<package> typecheck` (the exact command, so `typecheck:docs` does not count) for core, lab, charts, richtext and vega, guarded like core's. Cost: 1–8 s per package on a large machine. The `typecheck` job (about 4.5 min, mostly the build) runs beside `build-storybook` and stays off the critical path. ## Evidence - Failure before the change: the new routing cases fail on main's workflows ("ci.yml does not typecheck lab", and the same for deploy.yml). On main, `pnpm -F @astryxdesign/lab typecheck` exits 2. - Success after the change: with #8313, all four typechecks pass after `pnpm build` (lab 8 s, charts 2 s, rich text 5 s, Vega 1 s); the routing cases pass. - Product/runtime behavior verified unchanged: workflow and test files only. ## Scope - [x] No intended public API, product behavior, visual direction, or policy change. - [x] Product changes discovered during the work were removed or split. - [x] Public text and artifacts contain no internal Meta context. ## Testing - `pnpm exec vitest run .github/scripts`: 1,229 passed; with the workflow edits reverted, the two new cases fail. - `pnpm build`, then `pnpm -F @astryxdesign/{lab,charts,richtext,vega} typecheck`: all exit 0. - Prettier on the touched files and the pre-commit repo checks: clean.
This was referenced Oct 25, 2026
This branch was successfully deployed
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.
User impact
Contributors running
pnpm -F @astryxdesign/lab typecheckon main get one error, so the package's typecheck can't be used as a clean gate:Problem and solution fit
ReturnType<typeof vi.fn>, which vitest 4.1 types asMock<Procedure | Constructable>, a union TypeScript won't call, and the harness callsspy(items, change).typecheck:docsbut not itstypecheck, so the error went unnoticed; any branch that runs the full typecheck inherits it.The harness now types its spy with the same callable signature as the file's other harness;
vi.fn()still fits it.Expected behavior and authority
pnpm -F @astryxdesign/lab typecheckpasses on a clean checkout, like the other packages' typechecks.Smallest restoration
One type annotation in one test file. No runtime, API or test behavior change.
Evidence
pnpm -F @astryxdesign/lab typecheckexits 2 with the TS2348 error above, its only error.Scope
Testing
pnpm -F @astryxdesign/core build, thenpnpm -F @astryxdesign/lab typecheck: 0 errors (main: 1, TS2348).pnpm exec vitest run packages/lab/src/MobileTokenizer: 1 file, 10 tests passed.node scripts/release/changeset-coverage.mjs pr: nothing here ships to consumers, so no Changeset.