Skip to content

fix(hosting,core,create-blocks-app): refuse SvelteKit 3 before the build runs - #1713

Draft
osama-rizk wants to merge 1 commit into
mainfrom
fix/sveltekit-version-preflight
Draft

osama-rizk wants to merge 1 commit into
mainfrom
fix/sveltekit-version-preflight

Conversation

@osama-rizk

Copy link
Copy Markdown
Contributor

Problem

A project scaffolded with npx sv create today uses SvelteKit 3 (@sveltejs/kit ^3, Vite 8, config in vite.config.ts). Hosting supports SvelteKit 2 only (>=2.0.0 <3.0.0), but nothing said so up front:

  • Hosting ran the app's buildCommand first, and only then did the SvelteKit adapter refuse the project with UnsupportedSvelteKitVersionError, so the user waited for a full build that was then rejected.
  • The error said only that the version was "outside the verified range", not what to pin.
  • The Hosting README never stated a SvelteKit range (it does for OpenNext and Next.js).
  • create-blocks-app . added the backend to a SvelteKit 3 project without a word, leaving a project that could not deploy.

Full SvelteKit 3 support stays with #984. This change makes the limit visible and fail fast.

Changes

  • @aws-cdk-blocks/hosting: new assertFrameworkSupported(framework, projectDir) in @aws-cdk-blocks/hosting/adapters. It runs a built-in adapter's build-free checks and writes nothing; today that is the SvelteKit version check (unknown frameworks and frameworks without a check pass through). The SvelteKit 3 error now reads SvelteKit 3.x is not supported yet: Hosting supports SvelteKit 2 (>=2.0.0 <3.0.0), and its resolution names @sveltejs/kit@^2 @sveltejs/adapter-node@^5 @sveltejs/vite-plugin-svelte@^5 vite@^6, the config in svelte.config.js, and Migrate test apps and templates to Vite 8, SvelteKit 3 and TypeScript 6 #984. The SvelteKit 1 message is unchanged.
  • @aws-cdk-blocks/core: Hosting calls assertFrameworkSupported right after it resolves the framework, before buildCommand. A customAdapter skips it (it owns its own checks).
  • @aws-cdk-blocks/create-blocks-app: add-to-existing mode stops before it writes anything when the project's @sveltejs/kit is major 3 or later (the installed version when node_modules has it, else the lowest version of the package.json range; a range with no version such as latest passes through to the synth check). It prints the versions to pin and exits 1. It refuses rather than warns because that is how the CLI treats the other "this can't work" cases in this mode (an npm workspace that doesn't list cdk-blocks/, an existing cdk-blocks/): stop, say why, write nothing.
  • Docs: a "SvelteKit: the supported version" section and an UnsupportedSvelteKitVersionError row in the Hosting README, the range on the sveltekitAdapter row, a sentence in the core README on the check before buildCommand, and a paragraph in the create-blocks-app README.
  • Changeset: patch for hosting, core and create-blocks-app.

Behaviour change: a SvelteKit 3 (or not-installed SvelteKit) project now fails at the start of synth instead of after buildCommand; the error is the same UnsupportedSvelteKitVersionError. create-blocks-app . now exits 1 in a SvelteKit 3 project where it used to scaffold.

Testing

Red first, on origin/main:

  • packages/core Hosting — unsupported framework version: 2 failing (buildCommand should not run; the log shows Building frontend (sveltekit) before the refusal).
  • packages/hosting assertFrameworkSupported (no such export) and tells a SvelteKit 3 user which versions to pin: failing.
  • packages/create-blocks-app refuses an existing SvelteKit 3 project before it writes anything and reads the installed SvelteKit version over the package.json range: 2 failing (exit 0, backend written).

Green:

  • packages/hosting npm test: 1878/1878 pass.
  • packages/core npm test: 3308 pass, 0 fail (2 skipped).
  • packages/create-blocks-app npm test: 406/407 pass. The one failure, refuses to scaffold into an npm workspace that does not list the app's cdk-blocks/ folder, is the fresh-project path on macOS (/private/var temp dirs) and fails the same way without this change; CI on Linux must cover it.
  • npm run build, npm run lint, npm run lint:deps, npm run check:api (no API report change).
  • Against a real npx sv@latest create project (@sveltejs/kit 3.4.0, with @sveltejs/adapter-node): synth on origin/main ran npm run build (about 2 s) and then refused; with this change it refuses in 2 ms and no build/ is written. create-blocks-app . --yes in the same project exits 1 with the pin instructions, and the directory listing and package.json are unchanged.

CI must cover: the full unit suites on Linux (including the create-blocks-app workspace test above) and e2e.

Overlap: will conflict with #1674 (packages/hosting/README.md, both add text before "SSR compute"; sveltekit.ts and sveltekit.test.ts auto-merge) and with #1669 (packages/core/README.md, the buildCommand paragraph; core/src/hosting.ts, create-blocks-app/src/index.ts and its README auto-merge). Merges cleanly with #1680.

Deployed verification

Redeployed an existing SvelteKit 2.70 test app (@sveltejs/adapter-node 5, Vite 6, CloudFront door, Lambda Web Functions compute, production npm run deploy) with packages packed from this branch. The deploy completed (43 resources) and the new build was confirmed live. A Playwright run against it (sign-up, sign-in, board create/move/delete, realtime updates between two browsers, attachments, SSR page) passed 37/37 with no failed requests, so SvelteKit 2 still deploys.

SvelteKit 3 was verified at synth level only (see Testing): the refusal happens before any build or AWS call.

…ild runs

Hosting supports SvelteKit 2 only. Synth used to run the app's buildCommand
first and only then refuse SvelteKit 3 in the adapter. Hosting now runs the
adapter's build-free version check (assertFrameworkSupported) before
buildCommand, the error names the SvelteKit 2 versions to pin, and
create-blocks-app stops before it writes anything in a SvelteKit 3 project.
The Hosting README states the supported range.
assert.strictEqual(result.exitCode, 1, result.stdout);
assert.match(result.stderr, /SvelteKit 3 is not supported yet/);
assert.ok(result.stderr.includes('@sveltejs/kit@^2 @sveltejs/adapter-node@^5 @sveltejs/vite-plugin-svelte@^5 vite@^6'), result.stderr);
assert.ok(result.stderr.includes('https://github.com/aws/cdk-blocks/issues/984'), result.stderr);
@github-actions

Copy link
Copy Markdown
Contributor
📖 Glossary & notes — scoring, indicators, per-metric thresholds (click to expand)
  • N = 1 — one rep per cell, so a small delta may be model variance, not a real change; re-run for certainty.
  • Indicators (change vs baseline, per metric): ✨ noticeably improved · ✅ OK / no significant change (within noise band) · ⚠️ slight regression (beyond 1× threshold) · ❌ serious regression (beyond 2× threshold) · 🆕 new — no baseline value yet (current value shown, tagged (new)) · — nothing to show this run · 🗑️ cell gone since the baseline. Each cell shows <indicator> <value> (<Δ vs main>) inline.
  • Columns: Tests (pass/denom) · Judge (overall 0-10 score with signed delta; per-dimension breakdown lives in the judge artifact JSON) · Cost · Turns (agent cycles) · Score · Stop reason.
  • Threshold definitions (per metric, DELTA_THRESHOLDS in overview.mjs):
    • composite/score: ±5 points — a change ≤5 pts is ✅; >5 improving is ✨; >5 worsening is ⚠️; >10 worsening is ❌.
    • judge (overall): ±0.3 — a shift ≤0.3 is ✅; >0.3 improving is ✨; >0.3 worsening is ⚠️; >0.6 worsening is ❌.
    • tests: ±1 pass — a ≤1 pass change is ✅; >1 improving is ✨; >1 worsening is ⚠️; >2 worsening is ❌.
    • cost: ±10% of baseline (floor $0.02) — within 10% is ✅; >10% cheaper is ✨; >10% more expensive is ⚠️; >20% more expensive is ❌.
    • turns: ±3 cycles — a ≤3 turn change is ✅; >3 fewer is ✨; >3 more is ⚠️; >6 more is ❌.
  • Directions: higher is better for tests, judge, and score; lower is better for cost and turns.
  • Composite (0-100) = round(60·test_rate + 4·judge·min(1, 4·test_rate), 1) — 60% objective pass-rate + 40% judge, the judge term gated below a 25% pass-rate.
  • Cost = builder token spend at Bedrock Claude Opus 4.8 rates ($5 in / $25 out per 1M tokens; BUILDER_PRICING in scoring.mjs).
  • SCORE = composite ÷ cost — composite points per dollar (higher = better). Cost, not raw token volume, is the denominator, so tokens can't dominate; a broken (composite 0) cell scores 0 no matter how cheap. Flip SCORE_PER_DOLLAR in scoring.mjs for cost-per-point (lower = better).
  • Baseline = the most recent main-branch bench (bench/runs/latest-main.json), NOT the PR base commit — the PR always diffs against the current state of main.
  • Excluded from the mean: harness_error cells (infra failures) and gradeable cells that ran no tests. agent_fail (agent produced no app in budget) and dead_server (built app never served / crashed) are BOTH included, as composite 0.
  • Run artifacts — per-cell source + full agent traces · 🕒 Last run: 2026-11-20T12:19:22Z · run #44727625422

Results — PR vs main baseline

Each metric shows its current value colored by the change vs the latest main baseline b71d2db. ✨ improved · ✅ within noise · ⚠️ slight regression · ❌ serious regression · 🆕 no baseline yet (value shown, tagged (new)).

  • Mean composite 90.1/100 across 10 scored cell(s) — ✅ -0.5 vs main · judge mean 8.92/10.
  • Verdicts: 9 pass · 1 partial · 0 fail · 0 harness_error.
  • Totals: cost $156.47 · tokens 30.3M in / 190.1K out · 433 turns.
  • Biggest gains: collab-presence-board/default (+2.4), cognito-profile/auth (+0.8), email-digest/demo (+0.8).
  • Biggest drops: oidc-dsql-notes/react (-5.2), observability-api/backend (-2.4), auth-notes/demo (-1.6).
  • Config: baseline b71d2db.
  • ✅ Composite band 🟢 across 10 scored cell(s). Threshold 65 — pass.
Task Template Tests Judge Cost Turns Score Stop reason
async-word-counter bare ✅ 13/13 (0) ✅ 9.4 (0) ✨ $3.69 (-$4.13) ✨ 18 (-16) ✨ 26.4 (+13.9) endTurn
auth-notes demo ✅ 11/11 (0) ⚠️ 9.2 (-0.4) ✨ $24.68 (-$11.88) ✅ 67 (-2) ✅ 3.9 (+1.2) endTurn
cognito-profile auth ✅ 10/10 (0) ✅ 8.4 (+0.2) ✨ $17.53 (-$16.56) ✨ 51 (-25) ✅ 5.3 (+2.6) endTurn
collab-presence-board default ✅ 11/11 (0) ✨ 9.6 (+0.6) ❌ $13.27 (+$7.07) ❌ 50 (+20) ⚠️ 7.4 (-8.1) endTurn
email-digest demo ✅ 12/12 (0) ✅ 9.4 (+0.2) ✨ $3.36 (-$2.3) ✨ 20 (-4) ✨ 29.1 (+12) endTurn
file-gallery bare ✅ 12/12 (0) ✅ 9.6 (+0.2) ✅ $2.81 (+$0.25) ✅ 13 (+1) ✅ 35.1 (-3.1) endTurn
kb-chat-agent demo ✅ 9/9 (0) ✅ 9.2 (+0.2) ✨ $29.61 (-$13.93) ✨ 59 (-20) ✅ 3.3 (+1.1) endTurn
observability-api backend ✅ 18/18 (0) ⚠️ 8.8 (-0.6) ✨ $4.26 (-$1.16) ✨ 20 (-12) ✅ 22.3 (+4.3) endTurn
oidc-dsql-notes react ✅ 2/11 (0) ❌ 6.6 (-1.8) ✨ $24.73 (-$14.84) ✨ 54 (-24) ✅ 1.2 (+0.3) endTurn
sql-kb-catalog nextjs ✅ 9/9 (0) ⚠️ 9 (-0.4) ❌ $32.53 (+$18.02) ❌ 81 (+38) ✅ 3 (-3.7) endTurn

Merge verdict

✅ This bench run does not block the PR.

  • ✅ Absolute floor — mean composite 90.1 >= floor 65.
  • ✅ Regression vs main — mean composite delta -0.5 pts vs main is within the 10-pt limit.

The Δ vs base ball above is a fixed ±5-pt display band; the regression gate uses BENCH_MAX_REGRESSION. The ball is cosmetic — the gate threshold is what blocks.

This branch had an error being deployed

1 failed and 1 inactive deployments
agent-bench — 61de9688 Deployed Nov 20, 2026 by osama-rizk via bench / summary #6650
e2e — 61de9688 Deployed Nov 20, 2026 by osama-rizk via E2E Teardown Verify #7619
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.

2 participants