Repository navigation
fix: serve immutable files with native Bun routes and match re-encoded static paths - #17123
Merged
Merged
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/dbd6f5188750502b271740eb69e53ad032fe3defOpen in |
🦋 Changeset detectedLatest commit: dbd6f51 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
# Conflicts: # packages/adapter-bun/test/adapter.spec.ts
Nic-Polumeyv
marked this pull request as ready for review
September 17, 2026 19:06
teemingc
previously requested changes
Sep 18, 2026
test --------- Co-authored-by: Rich Harris <[email protected]> Co-authored-by: svelte-triage-bot[bot] <316883489+svelte-triage-bot[bot]@users.noreply.github.com> Co-authored-by: svelte-triage-bot <[email protected]> Co-authored-by: Copilot App <[email protected]> Co-authored-by: Nic Polumeyv <[email protected]> Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
…lient files, honour q=0 refusals
edbfi
added a commit
to edbfi/otpravkarr
that referenced
this pull request
Oct 4, 2026
Re-copy the canonical rules/svelte5-sveltekit-app.md from revision r2 of the agent-rules change (SHA256 7b04df7fe87001cac0b67dfb10b1f1ff807b53e3d857eb4dcd52503c63f35714), replacing r1 (5579d7e8552efac02467f5442b601ba2961c65b2f6ad5f374dea55d39a8d7d3e). r2 corrects the env example: in SvelteKit 3.0.0 a declared variable without a validator is required, so optional variables need a schema that accepts undefined. It also adds notes on sveltejs/kit#17123 (encoded asset paths), oven-sh/bun#43816 (idle event streams on unix sockets), ending proxied event streams cleanly on shutdown, and re-delivering a signal received while the adapter loads. src/env.ts already declares every variable with a function schema, so no code change follows. It still depends on the agent-rules change landing first. Signed-off-by: edbfi <[email protected]>
edbfi
added a commit
to edbfi/agent-rules
that referenced
this pull request
Oct 4, 2026
* docs(rules): target SvelteKit 3 and the official Bun adapter Rewrite the svelte5-sveltekit-app rule for SvelteKit 3 and @sveltejs/adapter-bun: configuration in the sveltekit() Vite plugin, $app/tsconfig, #lib imports, the production build under Bun, and the removed modules and moved types. Add sections for declared environment variables, handleError kinds, navigation and external redirects, the widened server-only rule, and superforms 3 (prerelease until stable, pinned exactly; Formsnap is no longer recommended). Replace the adapter-node deployment guidance with adapter-bun's runtime needs, environment variables and origin rules, including the app-owned front, the plain-HTTP startup warning, and cookie Secure flags taken from the request scheme. Signed-off-by: edbfi <[email protected]> * chore(rules): opt setun into SvelteKit and Python guidance setun already carries both rules at .agents/rules/, and at setun main 1989cde89be0c853ffba19718a611bdd40553db3 its copies equal the canonical bytes (svelte5-sveltekit-app 65c464cc..., python-3_14-core 0cbd8924...). Record it as an explicit opt-in. [accepted] is unchanged and keeps the previous svelte5-sveltekit-app hash. Signed-off-by: edbfi <[email protected]> * docs: record the SvelteKit 3 toolchain floors Add a dated 2026-10-02 inspection for the SvelteKit 3 rule: Node 22.17, Bun 1.4.0, the optional TypeScript ^6 peer, Svelte 5.57.1, Vite ^8.0.12 and vite-plugin-svelte ^7. List setun as a consumer and keep the rule that delivery does not raise consumer floors or recreate lockfiles. Signed-off-by: edbfi <[email protected]> * fix(rules): require a validator for optional env variables In @sveltejs/kit 3.0.0 a variable declared in src/env.ts without a schema is required: validate() in src/exports/internal/env.js reports "Value is missing" when the value is undefined, and the EnvVarConfig typings say "If omitted, the value must be set, but may be an empty string". The example declared LOG_LEVEL as {} and called it optional, so an app following it fails to build or start when the variable is unset. Declare optional variables with a validator that accepts undefined (v.optional(v.string()) or a function), mark the validator-less public example as required, and state the rule next to the "unset stays undefined" guidance. Signed-off-by: edbfi <[email protected]> * docs(rules): note adapter-bun front and socket findings Findings from the SvelteKit 3 app migrations that the front guidance did not cover: - a proxied event stream that the adapter force-closes when its shutdown drain expires must end normally at the front; passing the error on resets the browser's connection - a front that binds its listener before loading the adapter must re-deliver a signal received during the load, or sveltekit:shutdown never fires and the process hangs - the socket idle close is consistent with oven-sh/bun#43816 (server.timeout(req, 0) is inert on unix listeners) and reproduces on linux/arm64 and with a bare Bun.serve({ unix }); fronts call server.timeout(req, 0) on their public TCP listener - URL-encoded static asset paths 404 or fall through to the app until sveltejs/kit#17123 lands Signed-off-by: edbfi <[email protected]> * fix(rules): run the sv codemod with bunx Replace the npx invocation with bunx, since consumers are Bun-only. sv 1.1.0 declares no engines and its bin keeps a node shebang, which bunx honours, so the codemod still needs Node; it warns below 22.17.0, so the 22.18 floor was sv's own development runtime, not its requirement. Signed-off-by: edbfi <[email protected]> * docs(rules): encode the shared public-origin contract Make ORIGIN the one public-origin setting: one parsing and canonical export for every network front, app-level origin settings that derive from it, one startup warning that names the failure users see, and the ADDRESS_HEADER and XFF_DEPTH guidance. Port the front fixes (peer address header, raw-path forwarding, socket cleanup on exit, exit on a second early signal), extend the cookie rule to relayed backend cookies, and size the container shutdown default to the stop budget. Signed-off-by: edbfi <[email protected]> * docs(rules): add a single-page app note An SPA builds with @sveltejs/adapter-static 4.0 (peer kit ^3.0.0-next.0) with a fallback page and ssr = false, and is served by its backend on the same origin; adapter-static writes the public variables into _app/env.js at build. The adapter-bun, front and server-side cookie and origin guidance then does not apply. Signed-off-by: edbfi <[email protected]> * docs: align the codemod Node floor with sv Signed-off-by: edbfi <[email protected]> --------- Signed-off-by: edbfi <[email protected]>
edbfi
added a commit
to edbfi/otpravkarr
that referenced
this pull request
Oct 4, 2026
Re-copy the canonical rules/svelte5-sveltekit-app.md from revision r2 of the agent-rules change (SHA256 7b04df7fe87001cac0b67dfb10b1f1ff807b53e3d857eb4dcd52503c63f35714), replacing r1 (5579d7e8552efac02467f5442b601ba2961c65b2f6ad5f374dea55d39a8d7d3e). r2 corrects the env example: in SvelteKit 3.0.0 a declared variable without a validator is required, so optional variables need a schema that accepts undefined. It also adds notes on sveltejs/kit#17123 (encoded asset paths), oven-sh/bun#43816 (idle event streams on unix sockets), ending proxied event streams cleanly on shutdown, and re-delivering a signal received while the adapter loads. src/env.ts already declares every variable with a function schema, so no code change follows. It still depends on the agent-rules change landing first. Signed-off-by: edbfi <[email protected]>
edbfi
added a commit
to edbfi/otpravkarr
that referenced
this pull request
Oct 4, 2026
* build: move to SvelteKit 3 and @sveltejs/adapter-bun Pin @sveltejs/kit 3.0.0 and @sveltejs/adapter-bun 1.0.0 exactly and drop svelte-adapter-bun, whose typescript ^5 peer is unmet on TypeScript 6 (edbfi-ci blocker B5). Raise the floors to Kit 3's peers: svelte ^5.57.1, vite ^8.0.12, svelte-check ^4.7.5. Applied with [email protected] migrate sveltekit-3, one task at a time, then reviewed: - svelte.config.ts moves into sveltekit({...}) in vite.config.ts (CSP unchanged). The adapter keeps precompress: true; serveAssets has no adapter-bun equivalent (native static routes) and envPrefix '' is adapter-bun's default, so both go. - $lib is no longer generated: an explicit Vite alias plus a tsconfig path. - tsconfig.json extends $app/tsconfig, which supplies every compiler option the codemod dropped; include restores the old type-check scope (src and vite.config.ts) instead of the codemod's src only. - Handle, HandleServerError from @sveltejs/kit/hooks; ActionResult from $app/forms. The imports task reformatted three Svelte files wholesale, so these moves were made by hand. - The audit filters' goto() options are renamed (replaceState -> replace, keepFocus -> reset: false); the scroll behaviour is handled separately. Smallest repairs check:types needs: - src/env.ts declares the six private variables the app reads (identity validators, so unset stays undefined), and $lib/server/private-env now re-exports $app/env/private: SvelteKit 3 exposes only declared variables and has no types for $env/*. - handleError takes Kit 3's { kind, error, event }. app, validation and framework errors (404, 405, 413, ...) pass through with their own status and message and are not logged; only unknown errors are logged and answered with the generic 'Internal Error' body. Tests cover each kind. Signed-off-by: edbfi <[email protected]> * test: check declared environment variables against what the app reads SvelteKit 3 reads an undeclared private variable as undefined without an error. The test collects every env.NAME read in files that import $lib/server/private-env and requires it to equal the set declared in src/env.ts, rejects dynamic env[...] access there, and checks that each declaration leaves an unset value undefined and a set one unchanged. Signed-off-by: edbfi <[email protected]> * fix: allow only app.plex.tv for the Plex OAuth redirect SvelteKit 3 refuses an external redirect() unless the call opts in. The Plex sign-in action redirects to the URI @ctrl/plex builds, which is always https://app.plex.tv/auth#?... (pin.js oauthUrl), so it now allows exactly that origin rather than every external URL. Without the option the two existing sign-in tests fail; a new test shows a URI on another host is refused. Every other redirect() in src/ targets a local path. Signed-off-by: edbfi <[email protected]> * feat: front the adapter with scripts/serve.ts when ORIGIN is set SvelteKit 3 adapters no longer read a runtime ORIGIN, and adapter-bun derives the origin as https + Host, so a plain-HTTP deployment would fail Kit's form CSRF check. scripts/serve.ts is the new production entry (start script and the Playwright web server): - Without ORIGIN it loads build/index.js and the adapter listens directly. When neither ORIGIN nor PROTOCOL_HEADER is set it logs one warning that plain-HTTP writes will be rejected and ORIGIN must be set. - With ORIGIN (a bare http(s) origin, validated with an error that never echoes the value) it binds HOST/PORT (default 0.0.0.0:3000), starts the adapter on a private mkdtemp Unix socket, and forwards every request with its own origin and peer headers, overwritten on each request. The origin never comes from the request's Host header. An operator ADDRESS_HEADER passes through. - The public port is bound before the adapter loads (requests wait for it), so a busy port never starts the app and a failed load leaves no listener or socket directory behind. - IDLE_TIMEOUT maps to adapter-bun's CONNECTION_IDLE_TIMEOUT (an explicit CONNECTION_IDLE_TIMEOUT wins), and IDLE_TIMEOUT is kept equal to the effective client idle window, which the Dispatcharr client's interactive timeout reads. Behind the front the adapter side has no idle timeout and the front exempts event streams, because adapter-bun's exemption does not work on a Unix socket listener (Bun 1.4.2). - Shutdown drains both sides within one SHUTDOWN_TIMEOUT budget: the public listener stops accepting on the signal, and after the adapter's sveltekit:shutdown it waits for in-flight public responses until the deadline before force-closing and removing the socket directory. scripts/serve.test.ts runs in the server Vitest project (Node) and spawns real Bun processes against a stand-in adapter (scripts/fixtures). tsconfig.json adds both files to the type-check scope. Signed-off-by: edbfi <[email protected]> * fix(audit): scroll to the top when changing pages SvelteKit 2's goto(..., { keepFocus: true }) kept focus and reset scroll. SvelteKit 3 merges keepFocus and noScroll into reset, and has no mode that keeps focus but resets scroll (sveltejs/kit#16990). The audit page keeps reset: false, so focus stays on the control that was used, and pagination now scrolls to the top itself after the navigation resolves. Filter changes (action, actor, limit, dates) keep the scroll position: an accepted behaviour change (M4(b)). Component tests check the goto options and the scroll for Next/Previous and that a filter change does not scroll; the e2e pagination spec checks that the page is at the top after paging from a scrolled position, that focus stays on Next, and that a keyboard user can keep paging to the last page. Signed-off-by: edbfi <[email protected]> * test(hooks): expect SvelteKit's status in CSRF 403 bodies SvelteKit 3's error() adds status to the error body, so the JSON that toForbiddenResponse returns for a rejected origin is now { message, status: 403 }. otpravkarr keeps it rather than stripping it (accepted behaviour change, M4(c)). With Kit 3 installed and the tests untouched, exactly these three failed; they now expect the status: - returns hostile-origin CSRF rejections with security headers - returns missing-Origin CSRF rejections with security headers - blocks authenticated cross-site browser POSTs before internal API endpoint logic No client code or e2e spec reads the 403 body. Signed-off-by: edbfi <[email protected]> * fix(auth): derive the cookie Secure flag from the request origin Every production cookie was Secure (isSecure = !dev). Browsers refuse a Secure cookie, and a Secure deletion, over plain HTTP outside loopback, so a plain-HTTP deployment with ORIGIN=http://<LAN address> passed the origin check but could not log in or out. SvelteKit 3's own default (secure except dev and http://localhost) does not change that. isSecureRequest(url) returns url.protocol === 'https:', and the shared cookie options in auth.ts and the route modules become functions of event.url (adminCookieOptions, adminOAuthCookieOptions, userCookieOptions, sessionCookieDeleteOptions, and the OAuth, onboarding, initial-password and setup-claim options). Every cookies.set and cookies.delete now passes that secure value; deletions that passed only a path no longer fall back to Kit's secure: true. httpOnly, sameSite, path and maxAge are unchanged. With ORIGIN set, the front makes event.url carry ORIGIN's scheme; without it the adapter assumes https (TLS proxy), so cookies stay Secure there; vite dev serves http://localhost, so dev stays non-Secure as before. Accepted behaviour change (M13): cookies on a plain-HTTP origin are no longer marked Secure. Tests cover both schemes for the session, OAuth, onboarding and setup-claim cookies and their deletions; the existing tests now pass a request URL, and the ISSUE-001 single-call-site guard follows the renamed adminOAuthCookieOptions. Signed-off-by: edbfi <[email protected]> * docs: update CLAUDE.md and README for SvelteKit 3 and the Bun adapter - CLAUDE.md: SvelteKit 3; the production entry; a Deployment and origin section (ORIGIN and the front, the plain-HTTP rule and startup warning, the IDLE_TIMEOUT mapping, the cookie Secure rule); the widened server-only rule; declared environment variables; the idle-connection wording for the Dispatcharr client; the CSP's new home in vite.config.ts; the Vitest note for scripts/serve.test.ts. The rule-conflict table is reconciled with the updated shared rule: the adapter and Kit-config rows no longer conflict and go; $lib (explicit alias, the rule's second option) and the dev runtime are reworded; UnoCSS, component tests, forms and the check script still differ. - README.md: start runs scripts/serve.ts and must ship with build/; a Public origin section (plain HTTP must set ORIGIN, the warning, the origin never comes from Host, Secure cookies only on https); the environment table adds IDLE_TIMEOUT, SHUTDOWN_TIMEOUT, BODY_SIZE_LIMIT, PROTOCOL_HEADER and ADDRESS_HEADER/XFF_DEPTH, and ORIGIN has no default; the checklist no longer tells operators to set PROTOCOL_HEADER/HOST_HEADER when ORIGIN is set. - .env.example: ORIGIN is the public URL and is required for plain HTTP. Signed-off-by: edbfi <[email protected]> * test(e2e): stop the Playwright web server with SIGTERM Playwright stops its web server with SIGKILL by default, so the front in scripts/serve.ts could never remove its private socket directory and each e2e run left an empty otpravkarr-* directory in the temp dir. With SIGTERM the front and the adapter drain and clean up (10 s budget). Signed-off-by: edbfi <[email protected]> * docs: update the shared SvelteKit agent rule Copy the canonical rules/svelte5-sveltekit-app.md from the agent-rules change that retargets the shared rule at SvelteKit 3 and @sveltejs/adapter-bun (SHA256 5579d7e8552efac02467f5442b601ba2961c65b2f6ad5f374dea55d39a8d7d3e). It depends on that agent-rules change landing first. Signed-off-by: edbfi <[email protected]> * fix(serve): finish shutdown when a signal arrives during startup adapter-bun installs its SIGTERM/SIGINT handlers only after it has finished loading (after its top-level server.init). A signal that arrived earlier stopped the public listener, but nothing emitted sveltekit:shutdown, so the process stayed up with its socket directory until the orchestrator killed it. The front now remembers such a signal and delivers it again once the adapter is loaded, so the adapter drains and the front cleans up as usual. The stand-in adapter can delay its load (STANDIN_LOAD_DELAY_MS); the new test signals while the public port accepts but the adapter is still loading and expects exit 0 with no socket directory left. It failed before this change. (Found in review.) Signed-off-by: edbfi <[email protected]> * refactor: return the logged message from handleError handleError logged its message constant but returned a repeated 'Internal Error' literal; return the same constant so the logged and returned text cannot drift apart. (Found in review.) Signed-off-by: edbfi <[email protected]> * docs(readme): drop the stale ORIGIN remark about the dev port The dev server never reads ORIGIN, so failing fast on a busy port does not keep anything aligned with it. (Found in review.) Signed-off-by: edbfi <[email protected]> * test(serve): say what the slow-client shutdown test proves The test asserts the outcome (every byte delivered, no new connections, socket directory removed) but cannot tell a bounded public drain from a force-close at sveltekit:shutdown on Bun 1.4.2, because the body is already buffered in the front once the adapter has drained. Rename it and document that; the SHUTDOWN_TIMEOUT=3 test pins the deadline. (Found in review.) Signed-off-by: edbfi <[email protected]> * docs: name @sveltejs/adapter-bun in the migrations path comment The comment in src/lib/db/migrate.ts still named svelte-adapter-bun. The layout it describes (server code in build/server/chunks, migrations copied to build/server/migrations) is unchanged with @sveltejs/adapter-bun. (Found in review.) Signed-off-by: edbfi <[email protected]> * docs: update the shared SvelteKit agent rule Re-copy the canonical rules/svelte5-sveltekit-app.md from revision r2 of the agent-rules change (SHA256 7b04df7fe87001cac0b67dfb10b1f1ff807b53e3d857eb4dcd52503c63f35714), replacing r1 (5579d7e8552efac02467f5442b601ba2961c65b2f6ad5f374dea55d39a8d7d3e). r2 corrects the env example: in SvelteKit 3.0.0 a declared variable without a validator is required, so optional variables need a schema that accepts undefined. It also adds notes on sveltejs/kit#17123 (encoded asset paths), oven-sh/bun#43816 (idle event streams on unix sockets), ending proxied event streams cleanly on shutdown, and re-delivering a signal received while the adapter loads. src/env.ts already declares every variable with a function schema, so no code change follows. It still depends on the agent-rules change landing first. Signed-off-by: edbfi <[email protected]> * fix(serve): end a proxied event stream normally when the adapter breaks it off At the end of its shutdown drain the adapter force-closes the streams still open. The front passed that failure on, so a client holding an event stream saw a broken connection (curl exit 56; a browser reports a reset) instead of an ordinary end it can reconnect from. The shared rule this PR ships (agent-rules r2, "The app-owned front", forwarding) requires the clean end. The front now wraps text/event-stream bodies in endQuietly(), which closes the public stream when the upstream read fails and still cancels the upstream when the client goes away. Every other body is passed through unchanged, so a truncated download still fails visibly. Tests: the stand-in adapter gains /sse-hold and /break; serve.test.ts checks that a held event stream ends normally at the SIGTERM drain deadline, that a broken-off event stream ends normally while a broken-off plain body still fails, and unit-tests endQuietly. Three of the four failed before the fix. Signed-off-by: edbfi <[email protected]> * fix(serve): parse ORIGIN leniently and export its canonical form Parse ORIGIN as the shared origin contract requires (00 3.1, M15): trim it (blank means unset), accept any http(s) URL whose pathname is "/" and that carries no credentials, query or fragment, and use url.origin as the canonical value. An uppercase scheme or host, a default port and a trailing slash are now accepted and normalised instead of rejected. Every failure exits 1 before binding with the one shared sentence, printed alone and never echoing the value. The front now writes the canonical value back to process.env.ORIGIN before the adapter loads, so the app reads the same string the front sends. That also fixes the bootstrap banner, which printed "http://host:port//setup" when ORIGIN had a trailing slash. Signed-off-by: edbfi <[email protected]> * fix(serve): warn about a missing ORIGIN in the shared wording Use the startup warning text the origin contract fixes for every edbfi app (00 3.1, M15). It names what the user sees fail (signing in and saving changes over plain HTTP) and how to fix it, in the same words as the other apps. Signed-off-by: edbfi <[email protected]> * fix(csrf): always allow ORIGIN beside the stored allowed origins Once setup was complete, the app checked writes only against the stored allowed_origins list and ignored ORIGIN, so changing ORIGIN after setup (a new address or port) rejected every POST, including the settings form that could repair the list. The origin contract (00 3.1, M15) makes ORIGIN the one public-origin setting: stored values may add origins, never replace it. effectiveAllowedOrigins() in $lib/server/origins now gives the CSRF hook ORIGIN (canonical) plus the stored list, and without ORIGIN the stored list or, while it is empty, the request origin as before. The settings lockout guard checks the same effective list with canonical comparison, and the settings page says that ORIGIN is always allowed instead of the stale "if empty, falls back to ORIGIN". Signed-off-by: edbfi <[email protected]> * fix(serve): forward the raw request path The front rebuilt the forwarded path with new URL(request.url), which throws when the client sends a Host header that is not a valid host (Bun then gives a bare path or an unparsable URL), so the front failed the request itself with a 500 and logged a TypeError. Slice the path and query from the request URL after any authority, as setun's front does (forwardPath, 00 3.1 front parity, M17). The adapter now gets every request and gives its own answer (adapter-bun: 400 for an unparsable URL); the origin still comes only from ORIGIN. Signed-off-by: edbfi <[email protected]> * fix(serve): remove the socket directory on every exit The front removed its socket directory only after sveltekit:shutdown or a failed load. A second signal during the drain makes the adapter call process.exit(1) without sveltekit:shutdown, which left the private temporary directory behind. Remove it in an exit handler too (synchronously, as exit handlers must), as zondarr's front does (00 3.1 front parity, M17). Signed-off-by: edbfi <[email protected]> * fix(serve): exit 1 on a second signal before the adapter has loaded The front handled only the first SIGTERM or SIGINT (process.once). A second signal while the adapter was still loading fell through to the default action, killing the process by signal and skipping the exit cleanup. Keep the handlers registered and exit with status 1 on a second early signal, as the adapter does for a second signal once it has loaded and as zondarr's front does (00 3.1 front parity, M17). The exit handler removes the socket directory. Signed-off-by: edbfi <[email protected]> * refactor: read IDLE_TIMEOUT through the declared env The Dispatcharr client read IDLE_TIMEOUT from raw process.env, outside the SvelteKit 3 env model, so src/env.ts did not list a variable the app depends on. Declare it in src/env.ts and read it through $lib/server/private-env like every other private variable. Kit 3 allows it for this module: the client is server-only (bridge, scheduler and server routes import it; no client code does), and $app/env/private is filled from process.env by server.init before the hooks and routes load, after scripts/serve.ts has set IDLE_TIMEOUT to the effective idle window. A runtime check with the real build confirmed the value reaches the client (the /users Dispatcharr deadline followed CONNECTION_IDLE_TIMEOUT=4 and IDLE_TIMEOUT=6). The tests that load the client now mock $lib/server/private-env, as the repo convention requires, and a new test pins that the declared value wins over process.env. Signed-off-by: edbfi <[email protected]> * docs: document ORIGIN and the proxy settings per the origin contract Align README, .env.example and CLAUDE.md (AGENTS.md is a symlink to it) with the shared user docs of the origin contract (00 3.1, M15): - ORIGIN is the address people open in the browser, required for plain HTTP, and left unset only behind an HTTPS reverse proxy that passes the original Host; how it is normalised and what stops startup; - the app always allows ORIGIN and saved allowed origins only add to it; - ADDRESS_HEADER=x-forwarded-for with XFF_DEPTH (the number of proxies, default 1) only when every request goes through the proxy; PROTOCOL_HEADER/HOST_HEADER only without ORIGIN; - SHUTDOWN_TIMEOUT (30 s) and BODY_SIZE_LIMIT (512K) with their effective defaults. The Docker example now sets ORIGIN to a LAN address, matching its plain-HTTP port mapping. CLAUDE.md also describes forwardPath, the canonical export and the exit cleanup of scripts/serve.ts. Signed-off-by: edbfi <[email protected]> * docs: update the shared SvelteKit agent rule Re-copy rules/svelte5-sveltekit-app.md from agent-rules docs/sveltekit-3 (r3, SHA256 fc5351e2d20e36e2818b246dd88b5e2fd612ca0c39b7483c31cedb69e57a212f), replacing r2 (7b04df7f...35714). r3 adds the shared origin contract (ORIGIN parsing, export and warning text, app origin settings derived from ORIGIN, proxy settings), the front parity rules (raw-path forwarding, socket cleanup on exit, second early signal), the container shutdown note, a single-page app note and bunx sv migrate for the codemod. Signed-off-by: edbfi <[email protected]> * fix(serve): keep a bare request path whole when its query holds a URL For a Host header Bun cannot parse, request.url is the bare path, and forwardPath searched it for "://" to find an authority. A query such as ?next=http://x/y matched, so the front forwarded "/y" instead of the path. A path that starts with "/" is now forwarded as it is. Found in review (Pullfrog). The adapter answers such requests 400 anyway, so nothing observable broke, but the forwarded path is now right. Signed-off-by: edbfi <[email protected]> --------- Signed-off-by: edbfi <[email protected]>
4 of 6 tasks
teemingc
approved these changes
Nov 5, 2026
Merged
clean99
added a commit
to clean99/kit
that referenced
this pull request
Nov 6, 2026
Resolved the conflict in packages/adapter-bun/index.js from sveltejs#17123, which replaced the generated route table with src/assets.js and dropped validate_file_paths. Kept client_only_assets from this branch and applied it to the new `builder.copy(server, ...)` call in the !embed path.
teemingc
pushed a commit
that referenced
this pull request
Nov 10, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @sveltejs/[email protected] ### Minor Changes - feat: Add clickable links to remote function invocation in dev server logs ([#17547](#17547)) ### Patch Changes - fix: reject URL inputs in `resolve` ([#17627](#17627)) - fix: respond with JSON instead of rendering the error page for a `__data.json` request to a missing route ([#17630](#17630)) - fix: resolve relative paths against the page URL in data requests when `paths.relative` is `true` ([#17630](#17630)) - fix: reject binary remote forms referencing files with an empty file-offset table as 400 Bad Request ([#17579](#17579)) - fix: correctly populate route and params for `afterNavigate` during hydration ([#17577](#17577)) - fix: include assets imported through dynamic imports, remote functions and param matchers in `builder.findServerAssets` so that `read` can find them ([#17505](#17505)) - fix: set `navigation.from` to `null` in `afterNavigate` on start when SSR is disabled ([#17587](#17587)) - fix: include remote function name and declaration file in schema validation failure logs ([#17495](#17495)) - fix: reuse SSR results of remote functions from packages during hydration in dev ([#17604](#17604)) - fix: remove empty type output directories for removed routes ([#17472](#17472)) - fix: use the UTF-8 byte length when reading inline assets ([#17590](#17590)) - chore: simplify a few server and build helpers ([#17531](#17531)) - fix: ignore the query string and hash of an imported asset's URL when using `read` ([#17507](#17507)) - fix: avoid reloading unrelated server modules when saving files during development ([#17462](#17462)) ## @sveltejs/[email protected] ### Patch Changes - fix: apply the Vite config and plugins of the detected adapter ([#17572](#17572)) - Updated dependencies: - @sveltejs/[email protected] ## @sveltejs/[email protected] ### Patch Changes - fix: serve client and prerendered files whichever way the request path is percent-encoded, and allow `*` and a leading `:` in their filenames ([#17123](#17123)) - perf: let Bun serve immutable files without calling into JavaScript ([#17123](#17123)) - fix: support the `ORIGIN` environment variable when `paths.origin` is not set ([#17632](#17632)) - Updated dependencies: - @sveltejs/[email protected] ## @sveltejs/[email protected] ### Patch Changes - fix: ignore `Range` headers on `HEAD` requests for static assets ([#17602](#17602)) - fix: respond with a 500 instead of crashing the server when handling a request fails unexpectedly ([#17696](#17696)) - fix: support the `ORIGIN` environment variable when `paths.origin` is not set ([#17632](#17632)) - Updated dependencies: - @sveltejs/[email protected] ## @sveltejs/[email protected] ### Patch Changes - fix: accept every Node.js version from 26 (`nodejs27.x`, `nodejs28.x`, ...), not only even ones ([#17584](#17584)) - fix: serve prerendered pages when `paths.base` is set ([#17525](#17525)) - Updated dependencies: - @sveltejs/[email protected] ## @sveltejs/[email protected] ### Patch Changes - fix: compute the missing `width` or `height` at runtime for images imported in the script, instead of outputting `NaN` ([#17499](#17499)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot
added a commit
to clement-songis/sveltekit-adapter-bun
that referenced
this pull request
Nov 14, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @sveltejs/[email protected] ### Minor Changes - feat: Add clickable links to remote function invocation in dev server logs ([#17547](sveltejs/kit#17547)) ### Patch Changes - fix: reject URL inputs in `resolve` ([#17627](sveltejs/kit#17627)) - fix: respond with JSON instead of rendering the error page for a `__data.json` request to a missing route ([#17630](sveltejs/kit#17630)) - fix: resolve relative paths against the page URL in data requests when `paths.relative` is `true` ([#17630](sveltejs/kit#17630)) - fix: reject binary remote forms referencing files with an empty file-offset table as 400 Bad Request ([#17579](sveltejs/kit#17579)) - fix: correctly populate route and params for `afterNavigate` during hydration ([#17577](sveltejs/kit#17577)) - fix: include assets imported through dynamic imports, remote functions and param matchers in `builder.findServerAssets` so that `read` can find them ([#17505](sveltejs/kit#17505)) - fix: set `navigation.from` to `null` in `afterNavigate` on start when SSR is disabled ([#17587](sveltejs/kit#17587)) - fix: include remote function name and declaration file in schema validation failure logs ([#17495](sveltejs/kit#17495)) - fix: reuse SSR results of remote functions from packages during hydration in dev ([#17604](sveltejs/kit#17604)) - fix: remove empty type output directories for removed routes ([#17472](sveltejs/kit#17472)) - fix: use the UTF-8 byte length when reading inline assets ([#17590](sveltejs/kit#17590)) - chore: simplify a few server and build helpers ([#17531](sveltejs/kit#17531)) - fix: ignore the query string and hash of an imported asset's URL when using `read` ([#17507](sveltejs/kit#17507)) - fix: avoid reloading unrelated server modules when saving files during development ([#17462](sveltejs/kit#17462)) ## @sveltejs/[email protected] ### Patch Changes - fix: apply the Vite config and plugins of the detected adapter ([#17572](sveltejs/kit#17572)) - Updated dependencies: - @sveltejs/[email protected] ## @sveltejs/[email protected] ### Patch Changes - fix: serve client and prerendered files whichever way the request path is percent-encoded, and allow `*` and a leading `:` in their filenames ([#17123](sveltejs/kit#17123)) - perf: let Bun serve immutable files without calling into JavaScript ([#17123](sveltejs/kit#17123)) - fix: support the `ORIGIN` environment variable when `paths.origin` is not set ([#17632](sveltejs/kit#17632)) - Updated dependencies: - @sveltejs/[email protected] ## @sveltejs/[email protected] ### Patch Changes - fix: ignore `Range` headers on `HEAD` requests for static assets ([#17602](sveltejs/kit#17602)) - fix: respond with a 500 instead of crashing the server when handling a request fails unexpectedly ([#17696](sveltejs/kit#17696)) - fix: support the `ORIGIN` environment variable when `paths.origin` is not set ([#17632](sveltejs/kit#17632)) - Updated dependencies: - @sveltejs/[email protected] ## @sveltejs/[email protected] ### Patch Changes - fix: accept every Node.js version from 26 (`nodejs27.x`, `nodejs28.x`, ...), not only even ones ([#17584](sveltejs/kit#17584)) - fix: serve prerendered pages when `paths.base` is set ([#17525](sveltejs/kit#17525)) - Updated dependencies: - @sveltejs/[email protected] ## @sveltejs/[email protected] ### Patch Changes - fix: compute the missing `width` or `height` at runtime for images imported in the script, instead of outputting `NaN` ([#17499](sveltejs/kit#17499)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Bun's router matches route keys against the raw request path, so adapter-bun registers every static file twice (as browsers send it, and fully percent-encoded), bans
*and a leading:in filenames, and still 404s on spellings that match neither, such as/encoded%20name.tx%74. Every static file also runs a JS handler.src/assets.jsreplacesroutes.jsandroutes-util.js. AMapkeyed by decoded pathname serves any percent-encoding of a path, and Bun routes are only registered for paths user agents never re-encode. Bun 1.4 file routes honour a suppliedetagandlast-modified, so immutable files are handed to Bun as a plainResponse(Bun.file)and never reach JavaScript.accept-encodingsent