Skip to content

Commit 7937843

Browse files
committed
Enable workspace typechecking through vp check
Use Vite+'s tsrs checker with explicit compiler settings and local project configs, including previously unchecked tests and the build agent. Fix type contracts, update mocks, await asynchronous test cleanup, and keep deliberate background work explicit. Update CI and contributor commands; retain compiler compatibility checks for ignored/generated files and TypeScript 6 consumers. Validation: 822 test files / 17,550 tests passed (35 skipped), 35 Node tooling tests passed, workspace and docs builds passed, compiler checks passed, and six deliberately injected type errors were detected by the final config. Apple M4 Pro, Node 24.22.1, shared installed dependencies and prepared build outputs, one warm-up and five alternating measured runs per command: - Original vpr check median: 5.204s - New vp check median: 3.455s - 33.6% less time (1.51x speedup), with formatting and lint included.
1 parent d6b8938 commit 7937843

115 files changed

Lines changed: 537 additions & 282 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/scripts/packed-consumer-scope.test.mjs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
22
import { test } from 'node:test';
33
import { resolvePackedSuite, selectPackedSuite } from './packed-consumer-scope.mjs';
44

5-
test('skips documentation-only changes and keeps ordinary runtime changes small', () => {
5+
void test('skips documentation-only changes and keeps ordinary runtime changes small', () => {
66
assert.equal(
77
selectPackedSuite([
88
'README.md',
@@ -19,7 +19,7 @@ test('skips documentation-only changes and keeps ordinary runtime changes small'
1919
assert.equal(selectPackedSuite(['platform/packages/api/src/routes/projects.ts']), 'smoke');
2020
});
2121

22-
test('runs the full matrix for dependencies, adapters, scaffolding, and packaging', () => {
22+
void test('runs the full matrix for dependencies, adapters, scaffolding, and packaging', () => {
2323
for (const path of [
2424
'pnpm-lock.yaml',
2525
'pnpm-workspace.yaml',
@@ -41,7 +41,7 @@ test('runs the full matrix for dependencies, adapters, scaffolding, and packagin
4141
});
4242

4343
const repository = { full_name: 'voidzero-dev/void' };
44-
test('reads every PR file page and considers the old path of renamed files', async () => {
44+
void test('reads every PR file page and considers the old path of renamed files', async () => {
4545
const calls = [];
4646
const result = await resolvePackedSuite({
4747
eventName: 'pull_request',
@@ -58,7 +58,7 @@ test('reads every PR file page and considers the old path of renamed files', asy
5858
assert(calls[1].endsWith('page=2'));
5959
});
6060

61-
test('compares the full pushed range rather than just the last commit', async () => {
61+
void test('compares the full pushed range rather than just the last commit', async () => {
6262
const before = '1'.repeat(40),
6363
after = '2'.repeat(40);
6464
const result = await resolvePackedSuite({
@@ -72,7 +72,7 @@ test('compares the full pushed range rather than just the last commit', async ()
7272
assert.equal(result, 'smoke');
7373
});
7474

75-
test('retains full coverage for unavailable or truncated changed-file lists', async () => {
75+
void test('retains full coverage for unavailable or truncated changed-file lists', async () => {
7676
const event = { repository, before: '1'.repeat(40), after: '2'.repeat(40) };
7777
for (const request of [
7878
async () => {
@@ -93,7 +93,7 @@ test('retains full coverage for unavailable or truncated changed-file lists', as
9393
);
9494
});
9595

96-
test('release and manual full runs do not depend on changed paths', async () => {
96+
void test('release and manual full runs do not depend on changed paths', async () => {
9797
const request = async () => {
9898
throw new Error('Should not inspect paths');
9999
};

‎.github/scripts/packed-init.test.mjs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { join } from 'node:path/posix';
55
import { test } from 'node:test';
66
import { runPty } from './packed-init.mjs';
77

8-
test('drives a real PTY and preserves quoted arguments', async () => {
8+
void test('drives a real PTY and preserves quoted arguments', async () => {
99
const cwd = mkdtempSync(join(tmpdir(), "void-pty-'quoted'-"));
1010
let output = '';
1111
const literal = "a 'quoted' $(printf should-not-run) value";
@@ -42,7 +42,7 @@ test('drives a real PTY and preserves quoted arguments', async () => {
4242
}
4343
});
4444

45-
test('propagates child failure and detects missing prompts', async () => {
45+
void test('propagates child failure and detects missing prompts', async () => {
4646
const options = { cwd: tmpdir(), env: process.env, prompts: [], onOutput() {} };
4747
await assert.rejects(
4848
runPty([process.execPath, '-e', 'process.exit(7)'], options),
@@ -57,7 +57,7 @@ test('propagates child failure and detects missing prompts', async () => {
5757
);
5858
});
5959

60-
test('terminates a stalled initializer', { timeout: 8000 }, async () => {
60+
void test('terminates a stalled initializer', { timeout: 8000 }, async () => {
6161
await assert.rejects(
6262
runPty([process.execPath, '-e', 'setInterval(() => {}, 1000)'], {
6363
cwd: tmpdir(),

‎.github/scripts/packed-registry.test.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function createPackage(t, overrides = {}, includeLicense = true) {
3131
return tarball;
3232
}
3333

34-
test('accepts complete metadata and license in a real package tarball', (t) => {
34+
void test('accepts complete metadata and license in a real package tarball', (t) => {
3535
const inspected = inspectPackage(createPackage(t));
3636
assert.equal(inspected.manifest.name, '@void/test');
3737
assert.match(inspected.integrity, /^sha512-/);
@@ -43,12 +43,12 @@ for (const [field, error] of [
4343
['homepage', /homepage must be an HTTPS URL/],
4444
['bugs', /bugs.url must be an HTTPS URL/],
4545
]) {
46-
test(`rejects a packed manifest missing ${field}`, (t) => {
46+
void test(`rejects a packed manifest missing ${field}`, (t) => {
4747
assert.throws(() => inspectPackage(createPackage(t, { [field]: undefined })), error);
4848
});
4949
}
5050

51-
test('rejects blank descriptions and invalid package links', (t) => {
51+
void test('rejects blank descriptions and invalid package links', (t) => {
5252
for (const overrides of [
5353
{ description: ' ' },
5454
{ homepage: 'void.cloud' },
@@ -59,6 +59,6 @@ test('rejects blank descriptions and invalid package links', (t) => {
5959
}
6060
});
6161

62-
test('requires the license file as well as its manifest field', (t) => {
62+
void test('requires the license file as well as its manifest field', (t) => {
6363
assert.throws(() => inspectPackage(createPackage(t, {}, false)), /missing packaged LICENSE/);
6464
});

‎.github/scripts/packed-server.test.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { join } from 'node:path/posix';
88
import { test } from 'node:test';
99
import { packedServerUrl } from './packed-server.mjs';
1010

11-
test('waits for the bound Local URL, including colored output', () => {
11+
void test('waits for the bound Local URL, including colored output', () => {
1212
assert.equal(packedServerUrl('RPC listening on http://127.0.0.1:36939/'), undefined);
1313
assert.equal(packedServerUrl('Local: http://127.0.0.1:0/'), undefined);
1414
assert.equal(
@@ -18,7 +18,7 @@ test('waits for the bound Local URL, including colored output', () => {
1818
});
1919

2020
for (const mode of ['dev', 'preview']) {
21-
test(`discovers Vite's actual ${mode} port without probing a competing listener`, async () => {
21+
void test(`discovers Vite's actual ${mode} port without probing a competing listener`, async () => {
2222
const directory = mkdtempSync(join(tmpdir(), 'void-packed-server-'));
2323
const competing = createServer();
2424
let probes = 0;

‎.github/scripts/tsconfig.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../packages/void/tsconfig.json",
3+
"include": ["*.ts"],
4+
"compilerOptions": {
5+
"lib": ["ES2022", "DOM"],
6+
"types": ["node"]
7+
}
8+
}

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ jobs:
4343
- run: vp run --cache build:all
4444
- run: vp run build:docs
4545
- run: node test/check-playground-build-artifacts.mjs
46-
- run: vp run check
46+
- run: vp check
47+
# Keep compiler coverage for generated/ignored files and the TS 6 framework fixtures.
48+
- run: vp run check:types
4749

4850
test:
4951
name: test (${{ matrix.os }}, ${{ matrix.shard }})
@@ -70,9 +72,6 @@ jobs:
7072
with:
7173
browser: ${{ matrix.shard != 'unit' }}
7274

73-
- run: vp check
74-
if: ${{ matrix.shard == 'unit' }}
75-
7675
# Unit suites import the core package and its workspace dependencies through public exports and
7776
# exercise generated CLI assets, so they need the transitive core stack even though they skip
7877
# playground builds.

‎.github/workflows/platform-ci.yml‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,10 @@ jobs:
5050
with:
5151
cache: true
5252
node-version-file: .node-version
53-
- run: vp fmt --check
54-
- run: vp lint
5553
- run: vp run build
5654
- run: vp run --filter './platform/packages/**' build
57-
# After the builds: the type-aware platform lint reads the dashboard's generated
58-
# `.void/tsconfig.json`, which only exists once the dashboard has been built.
59-
- run: vp run lint:platform
55+
# These projects need SDK declarations and the dashboard's generated tsconfig.
56+
- run: vp check packages platform
6057
# Platform packages only. The framework and the playgrounds are typechecked by ci.yml, and
6158
# the playground typechecks need the playground builds, which this job does not run.
6259
- run: vp run check:platform

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Deploy hosted production before publishing the npm packages: the CLI checks the
2424
- Every implementation plan should include the following:
2525
- During plan generation: ask clarifying questions when necessary, especially around developer-experience defining design decisions.
2626
- Verification:
27-
- Run `vp run check` for package typechecking after completing a batch of tasks.
27+
- Run `vp check` for formatting, linting, and workspace typechecking after completing a batch of tasks.
2828
- During development, run an exact test file (and `-t` for a focused case) first. Use `vp run test --list` to inspect affected coverage, then `vp run test` for changed-file validation. Use `--base <ref>` when changes are already committed; the default includes only staged, unstaged, and untracked files.
2929
- `vp run test --unit` is an iteration-only shortcut, not integration verification. Native `vp test related --run <source>` misses filesystem/subprocess inputs; prefer the smart runner's conservative fallbacks before handing off. See `TESTING.md` for builds, integration selection, and import profiling.
3030
- Run `vp test run` once when everything is done for final verification. CI and `vpr test:all` retain full-suite coverage. Do not repeatedly run the full suite during iteration, enable result caching for the smart selector, or disable module isolation to make tests faster.
@@ -54,7 +54,7 @@ vpr test:all # Format, lint, build, typecheck, and run al
5454
vp test run packages/void # Only test the core plugin
5555
vp lint # Oxlint through Vite+
5656
vp fmt # Oxfmt through Vite+
57-
vp run check # Typecheck all packages with TypeScript
57+
vp check # Format, lint, and typecheck the workspace
5858
vp run --filter ./packages/vue typecheck # Typecheck a specific package
5959
```
6060

‎TESTING.md‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,24 @@ Start with the smallest relevant test file or case while developing:
77
```sh
88
vp test run packages/void/test/unit/plugin-routing.test.ts
99
vp test run packages/void/test/unit/plugin-routing.test.ts -t 'routing'
10-
vp run check
10+
vp check
1111
```
1212

13+
`vp check` is the root static-check command: formatting, lint rules (including floating
14+
promises), and tsrs typechecking. Run `vp run build:all`
15+
once after installing dependencies or changing generated app types; framework projects
16+
need their generated configs and workspace package declarations. For types only, use
17+
`vp check --no-fmt --no-lint`.
18+
19+
CI also runs `vp run check:types`, the package TypeScript compiler checks. Keep this
20+
compatibility gate: native checks follow lint file selection, while the compiler checks
21+
whole projects and preserve SvelteKit's TypeScript 6 validation. Do not exclude authored
22+
source or type contracts from linting to silence a type error.
23+
24+
Shared helpers have local configs in `test/tsconfig.json` and `.github/scripts/tsconfig.json`.
25+
Avoid root project references to generated playground configs: Vite reads those references
26+
while building unrelated apps, including fixtures that have not generated their types yet.
27+
1328
Type-only contracts use `*.typecheck.ts`. Package typechecking verifies them; the Vitest runtime
1429
does not need to execute their `expectTypeOf` assertions.
1530

@@ -62,7 +77,7 @@ vp test related --run packages/void/src/runtime/sse/index.ts --project unit --pr
6277
vp test list packages/void/test/unit/plugin-routing.test.ts --filesOnly
6378
```
6479

65-
Agents should run a focused regression first, then affected verification and `vp run check` after a
80+
Agents should run a focused regression first, then affected verification and `vp check` after a
6681
batch. Use unit-only runs during iteration, but run the affected integration selection before
6782
handoff. Run the full suite once for final verification, not after every edit. For interactive
6883
development, `vp test watch <test-file>` keeps the transform graph in memory between edits.
@@ -102,8 +117,8 @@ This keeps database engines from competing with all framework compilers at start
102117
isolation enabled: these suites mock globals, keep database state, and exercise real process/lock boundaries.
103118
Cloudflare Vite build/dev suites belong in the integration pool: their native macOS file watchers
104119
can crash Node while a worker thread is being torn down. Keep these suites in separate processes.
105-
The full verification command builds before running the platform's type-aware lint, so it also
106-
works without a pre-existing dashboard `.void/tsconfig.json`.
120+
The full verification command builds before running static checks, so it also works without
121+
pre-existing generated playground or dashboard tsconfigs.
107122

108123
## Reusing transforms
109124

‎docs/.vitepress/config.ts‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import type { IconOption } from '@voidzero-dev/vitepress-theme';
2-
import { extendConfig } from '@voidzero-dev/vitepress-theme/config';
3-
import { defineConfig, type DefaultTheme } from 'vitepress';
1+
import type { IconOption, VoidZeroThemeConfig } from '@voidzero-dev/vitepress-theme';
2+
import { extendConfig } from '@voidzero-dev/vitepress-theme/config.js';
3+
import { defineConfigWithTheme, type DefaultTheme } from 'vitepress';
44
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons';
55
import llmstxt from 'vitepress-plugin-llms';
66
import { createCodeHighlighter } from './highlight.ts';
77

8-
type SidebarItem = DefaultTheme.SidebarItem;
8+
type SidebarItem = Omit<DefaultTheme.SidebarItem, 'items'> & {
9+
icon?: IconOption;
10+
items?: Array<SidebarItem>;
11+
};
912

1013
function hasDocumentLink(items: Array<SidebarItem>): boolean {
1114
return items.some((item) => {
@@ -62,7 +65,7 @@ function llmsSidebar(sidebar: DefaultTheme.Sidebar | undefined): DefaultTheme.Si
6265
return unique;
6366
}
6467

65-
const referenceItems = [
68+
const referenceItems: Array<SidebarItem> = [
6669
{
6770
text: 'General',
6871
collapsed: false,
@@ -225,7 +228,7 @@ const companyLinks = {
225228
};
226229

227230
export default extendConfig(
228-
defineConfig({
231+
defineConfigWithTheme<VoidZeroThemeConfig>({
229232
title: 'Void',
230233
description: 'Build with Vite. Deploy with Void.',
231234
cleanUrls: true,
@@ -303,7 +306,6 @@ export default extendConfig(
303306
},
304307
{
305308
text: 'Routing & Rendering',
306-
// @ts-expect-error
307309
icon: 'lucide:route',
308310
collapsed: false,
309311
items: [
@@ -441,10 +443,10 @@ export default extendConfig(
441443
};
442444
return referenceItems.map((item) => ({
443445
...item,
444-
icon: icons[item.text],
446+
icon: icons[item.text ?? ''],
445447
items: item.items?.map((child) => ({
446448
...child,
447-
icon: icons[child.text] ?? child.icon,
449+
icon: icons[child.text ?? ''] ?? child.icon,
448450
})),
449451
}));
450452
})(),

0 commit comments

Comments
 (0)