Repository navigation
Build each TypeScript template's client in the template smoketest - #6711
Open
krisajenkins wants to merge 3 commits into
Open
krisajenkins wants to merge 3 commits into
krisajenkins wants to merge 3 commits into
Conversation
krisajenkins
requested review from
bfops,
cloutiertyler and
jdetter
as code owners
November 25, 2026 16:01
clockwork-tien
approved these changes
Nov 26, 2026
Suppose someone changes the TypeScript SDK in a way that breaks a client
template: a hook's return type changes, say, so the Vue template's App.vue
no longer type-checks. CI runs a smoketest for every template, so surely
that template's test fails? It doesn't. For TypeScript templates the test
publishes the server module, runs 'pnpm install' for the client, and
stops:
// TODO: some templates don't pass tsc yet, re-enable once they're fixed.
// run_pnpm(&["exec", "tsc", "--noEmit"], project_path)?;
So no client code is ever compiled. That isn't hypothetical: building
every TypeScript template the way the smoketest scaffolds it shows that
vue-ts already doesn't type-check (vue-tsc rejects three expressions in
App.vue), tanstack-ts's build can't find an entry module, and bun-ts's
build can't start. All three are green in CI today. Users meet these on
their first 'npm run build'.
The commented-out tsc call wouldn't have caught all of them anyway. Plain
tsc doesn't understand .vue or .svelte files, so it can't check the
frameworks where type errors hide in templates.
The test now runs each template's own build script ('pnpm run
--if-present build'). That uses whatever checker the template's
framework uses (tsc -b, vue-tsc, svelte-check, ng build, next build), and
--if-present covers deno-ts, which has no build script. The three
templates that fail today are listed in TYPESCRIPT_CLIENT_BUILD_KNOWN_FAILURES
with the reason for each. Their builds are skipped, with a log line, until
someone fixes them and deletes the entry. A new unit test fails if an
entry no longer names a TypeScript template, so the list can't quietly
outlive a rename.
Checked by scaffolding all 19 TypeScript templates with the CLI, pointing
them at the local SDK and running their builds: 15 build, deno-ts has no
build script, and the three listed fail. Then, with the real smoketests:
svelte-ts passes with its build running; vue-ts passes with its build
skipped; deno-ts passes via --if-present; and with vue-ts removed from the
list its smoketest fails, quoting vue-tsc's errors.
…ncy.
The template smoketest now builds each TypeScript template's client, and
vue-ts was on its known-failures list because vue-tsc rejected App.vue:
src/App.vue(52,29): error TS2339: Property 'length' does not exist on type 'Readonly<Ref<readonly { readonly name: string; }[], ...>>'.
That reads like a bug in the template, or in the Vue bindings' useTable
types. If so, every Vue user would hit it on their first build. They
don't: the same template type-checks cleanly inside the repo, and the
error only appears in the project the smoketest scaffolds.
The difference is how that project gets the SDK. The smoketest points
'spacetimedb' at crates/bindings-typescript, and pnpm symlinks a local
directory dependency. The SDK's type declarations then resolve their
optional framework peers from the monorepo's node_modules, so in the
scaffolded vue-ts project the SDK sees vue 3.5.26 while the app has its
own fresh vue 3.5.45. Vue brands Ref with a unique symbol, so a Ref
declared against one copy isn't recognised as a Ref by the other, and
vue-tsc can't unwrap 'people' in the template. A user installing the
published package gets one copy of vue, resolved from their project.
So the smoketest wasn't testing what users get. It now also sets
dependenciesMeta.spacetimedb.injected, which makes pnpm copy the SDK into
the project and resolve its peers there, as a registry install would. The
helper comment explains why. vue-ts comes off the known-failures list.
Injecting the SDK also turns an old race into a reliable failure. Every
TypeScript test called build_typescript_sdk(), which runs pnpm install
and pnpm build in crates/bindings-typescript, and the local runner runs
16 tests at once. One test's build clears dist while another test's
pnpm install is copying it, so a parallel run fails at random: pnpm
reports missing files under dist, or a template can't import
spacetimedb/server. With a symlink the race was easy to miss, because a
project only read dist once the build had finished. CI's partitions run
with -j 1, so CI never saw it.
So the runner now builds the SDK once, before any test starts, both for
a local run and for CI's run-archive, and sets
SPACETIME_SMOKETEST_TS_SDK_PREBUILT for the tests, which makes
build_typescript_sdk() return early. templates.rs drops its own copy of
that build and uses the library's. A test run directly with cargo test
still builds the SDK itself, as before.
- The runner finds pnpm with which, so Windows resolves pnpm.cmd.
- It builds relative to the current directory rather than the library's
workspace_root(), which is fixed at compile time, because CI runs the
runner in a different job from the one that built it.
Checked with the template smoketests for all 19 TypeScript templates, one
at a time as CI runs them (-j 1): all pass, vue-ts now builds its client,
and only bun-ts and tanstack-ts are still skipped. With the runner's
default of -j 16, the whole templates:: suite (less the C++ and C#
templates, which can't run on this machine) also passes: 23 tests in
69s, where before the fix six TypeScript templates failed.
…st again.
The template smoketest builds each TypeScript template's client, but it has
been skipping tanstack-ts as a known failure:
("tanstack-ts", "`vite build` can't resolve an entry module (index.html)"),
That failure came from the template asking for Vite 7 while
@tanstack/react-start 1.169.0 and later need Vite 8. On Vite 7, TanStack
Start's plugin doesn't register its build environments, so Vite falls back
to looking for an index.html the template was never meant to have. Master's
dependency update (25567d1) has since moved the template to vite ^8.3.8,
@vitejs/plugin-react ^6.3.0 and react-start ^1.169.7, which fixes the build.
But nothing told the smoketest, so it would go on skipping a build that now
works, and a future regression would go unnoticed.
This removes tanstack-ts from TYPESCRIPT_CLIENT_BUILD_KNOWN_FAILURES, leaving
only bun-ts.
Verified: in-repo, `pnpm run build` in templates/tanstack-ts succeeds on
Vite 8.
krisajenkins
force-pushed
the
kris/template-client-builds
branch
from
November 26, 2026 16:08
7952591 to
15119a6
Compare
krisajenkins
force-pushed
the
kris/init-drop-gen-bindings-script
branch
from
November 26, 2026 16:08
9723c25 to
30d0f13
Compare
This branch has not been 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.
Stacked on #6709. Review only the last three commits.
Description of Changes
The template smoketest now builds each TypeScript template's client, so a broken client template fails CI. It also installs the local SDK the way a real install does.
Until now, the TypeScript template smoketest published the server module, ran
pnpm installfor the client, and stopped. The type-check was commented out:So no client code was ever compiled. An SDK change that broke a template's
App.vueorApp.sveltestayed green in CI, and users found the breakage on their firstnpm run build. Plaintscwouldn't have caught much anyway, because it doesn't understand.vueor.sveltefiles.This PR has three commits:
Build each TypeScript template's client. The test now runs the template's own build script (
pnpm run --if-present build). That script uses the framework's own checker:tsc -b,vue-tsc,svelte-check,ng buildornext build. Templates that fail today are listed inTYPESCRIPT_CLIENT_BUILD_KNOWN_FAILURES, with a reason for each, and their builds are skipped with a log line. A unit test fails if an entry stops naming a real TypeScript template.Install the local SDK as an injected dependency.
vue-tslooked broken, becausevue-tscrejectedApp.vue. The template was fine; the smoketest's install was not. pnpm symlinks a local directory dependency, so the SDK resolved itsvuepeer from the monorepo'snode_modules. The project then had two copies of Vue's types, and Vue brandsRefwith aunique symbol. The smoketest now setsdependenciesMeta.spacetimedb.injected, so the SDK is copied into the project and resolves its peers there, as a registry install would.Injecting the SDK exposed an existing race. Every TypeScript test rebuilt the SDK, so one test's build cleared
dist/while another test was copying it. CI runs its partitions with-j 1, so it never saw the race. The smoketest runner now builds the SDK once before any test starts, for both local runs and CI'srun-archive. It then setsSPACETIME_SMOKETEST_TS_SDK_PREBUILTso the tests skip the rebuild. A test run directly withcargo teststill builds the SDK itself.Check
tanstack-tsagain. Master's dependency update moved it to Vite 8, which fixed its build, so it comes off the known-failures list. Onlybun-tsremains: pnpm doesn't run thebunpackage's postinstall, sobun buildcan't start.API and ABI breaking changes
None.
Rollback safety impact
n/a
Expected complexity level and risk
Testing
Added one unit test:
All 19 TypeScript template smoketests were run one at a time, as CI runs them (
-j 1), withtanstack-tsstill on the list. All passed, andvue-tsnow builds its client. Before the injected-dependency fix, buildingvue-tsfailed its smoketest withvue-tsc's errors.tanstack-tswas checked by runningpnpm run buildin the repo after the Vite 8 update. That build succeeds, but its smoketest has not been run with the build enabled.Running the whole
templates::suite at the runner's default-j 16(without the C++ and C# templates, which can't run locally) passed 23 tests. Before the runner prebuilt the SDK, six TypeScript templates failed this way.