Skip to content

build: make native Svelte checks fast and fail closed - #416

Merged
chhoumann merged 1 commit into
masterfrom
build/native-svelte-check
Oct 12, 2026
Merged

chhoumann merged 1 commit into
masterfrom
build/native-svelte-check

Conversation

@chhoumann

@chhoumann chhoumann commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Run Svelte checks through TypeScript 7's native API and reject compiler startup failures. Keep TypeScript 6 for the JavaScript APIs used by Svelte and lint tooling. lint:tsconfig checks both project configs for empty input sets before checking components.

svelte-check 4.7.6 is still the latest release. A small Node installer backports the outer-catch exit-status fix from sveltejs/language-tools#3133. It recognizes the exact published and patched hashes, runs after install and at check entry, and fails on an unexpected version or file. This avoids adding a patching dependency. The checker is pinned with a temporary Dependabot ignore; AGENTS.md documents removing the patch and ignore when upstream ships the fix.

npm test runs application tests. npm run test:tooling separately runs the checker regression suite, and the CI Test job runs both on every PR. AGENTS.md also uses npm ci, matching CONTRIBUTING.md.

Fixes #405.

Verification

  • Fresh npm ci on Node 22.23.2 / npm 10.9.8 passed with the patch applied.
  • Clean fixtures exit 0. Warning-only, type-error, unparseable component, deleted-component import, unresolved compiler, and killed-compiler fixtures each exit 1. Both empty-config cases exit 2 with TS18003.
  • Broken-recipe controls prove the tests catch removal of warning failures, the second checker, preflights, and the startup patch. Plain --tsgo fails the parser, missing-import and compiler-fault controls. A separate manual probe killed the real installed native compiler after observing its live PID and got exit 1.
  • The temporary installer is idempotent and rejects an unexpected version or modified vendor file without changing it.
  • npm run test:e2e passed 68 tests across 11 files on Obsidian 1.13.7, Linux x64. This run preceded the merge of fix: make podcast name lookups exact and safe #413. It used the isolated worktree vault and the suite's local HTTP/WAV fixtures. The runner stopped the instance and removed its private profile afterward.

Final checks after merging origin/master at 6c6f40e all passed:

Command Result
npm run lint no warnings or errors
npm run format:check clean
npm run typecheck source and test projects pass
npm run build production bundle built
npm run test 1,684 tests, 96 files pass; both Svelte checks clean
npm run test:tooling 10 tests pass
npm run docs:build 18 pages; internal links and 112 legacy fragments pass
npm run size 283,516 raw bytes; 90,148 gzip bytes, within budgets

cmp against a fresh build of 6c6f40e passed. Both main.js files have SHA-256 674f5b401eed58847d28db38cd73e3a5cea5d79cc2fb5d55ae6ab1eb58532b5d. No Svelte preprocessing or production build settings changed.

Local timings and review evidence

Seconds, median of five runs with min-max in parentheses, Node 22.23.2 on Linux x64. Baseline and combined-candidate runs alternated on the same 2cd9974 source tree. Every run passed. The split-suite and serial/parallel trials followed on that same tree.

Command TS6 baseline Native API
check:a11y 24.24 (14.25-31.71) 6.84 (5.05-15.75)
npm test, tooling included in candidate 39.23 (28.70-75.36) 41.77 (34.74-61.63)
npm test, tooling separate (final layout) same baseline 23.36 (15.21-38.32)
test:tooling alone absent 18.45 (10.33-20.89)
build 3.06 (2.29-5.45) 5.75 (2.74-9.30)

This shared 12-CPU host was heavily loaded. The later split runs were not interleaved with combined runs, so their difference is not a controlled estimate of the split alone. Build inputs and outputs are identical; overlapping timing ranges do not establish a build regression. Separate CPU profiles put TS6 loading/checking at 2.41 of 3.72 seconds, versus 0.03 of 1.55 seconds on the API path, with native IPC and loader work accounting for most remaining time.

Five alternating full-gate trials (lint, format:check, build, test, test:tooling) measured 49.26 seconds serially (32.38-73.31) and 24.91 seconds in parallel (22.79-27.02). That is a 24.35-second median difference on this host, not a prediction for GitHub runners. No task-runner dependency or CI parallelization was added; scheduling belongs to CI3.

Independent Fable and Astra reviews approved the patch, fixtures, and final CI split with no blockers. Accepted follow-ups clarify removal of the lint/format paths with the patch and give tests more time than their subprocess timeout. The mutation harness now selects the separate tooling config.

CI also passed on e634347. These are single successful runs on GitHub's Ubuntu runner, comparing the unchanged source base 6c6f40e with this PR:

CI measurement TS6 baseline Native API with separate tooling
check:a11y log interval 8.83 s 3.86 s
npm test step 32 s 27 s
test:tooling step absent 8 s
build step 2 s 2 s
Whole Test job 57 s 63 s

The checker interval runs from the npm script header to the second final diagnostic line; it includes both projects and, for the candidate, patch validation and preflights. Step/job timings use GitHub's second-resolution timestamps. The checker and local test path are faster; the full CI job is six seconds longer in these runs because it now also runs the failure regression suite. All five required checks passed. The PR remains unmerged.

Release impact

None. No plugin source, settings, storage, API, URI, or migration changes. The production bundle is byte-identical to the matching master base.

Note

Make check:a11y use native Svelte compiler checks and fail closed

  • Pins svelte-check to exactly 4.7.6 in package.json and adds a postinstall step that patches it via patches/svelte-check.mjs to exit 1 on failed checks. The patch refuses to modify anything on an unrecognized version or entry-file hash.
  • Rewrites check:a11y to apply the patch, verify TypeScript project inputs with a new lint:tsconfig script, and run native-API Svelte checks on both source and test projects.
  • Adds a test:tooling Vitest suite in svelteCheck.test.ts that runs the real npm run check:a11y in temporary workspaces and covers diagnostics, empty projects, unavailable native compiler, and killed compiler processes. CI runs it as a new step in test.yml.
  • Documents the patched svelte-check flow, pin rationale, and tooling commands in AGENTS.md, and ignores svelte-check updates in Dependabot.
  • Behavioral Change: npm install now patches the installed svelte-check file in place; check:a11y now fails on empty TypeScript projects (TS18003) and native compiler faults, where the old direct svelte-check calls did not.

Macroscope summarized e634347.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Deploying podnotes with  Cloudflare Pages  Cloudflare Pages

Latest commit: e634347
Status: ✅  Deploy successful!
Preview URL: https://cda1103a.podnotes.pages.dev
Branch Preview URL: https://build-native-svelte-check.podnotes.pages.dev

View logs

@chhoumann
chhoumann merged commit e41a1df into master Oct 12, 2026
13 checks passed
@chhoumann
chhoumann deleted the build/native-svelte-check branch October 12, 2026 19:47
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.

build: move Svelte checks to native TypeScript after upstream false-success fixes

1 participant