Skip to content

feat(edge,tanstack-start): add SSR and static framework adapters for spliced translations - #3098

Open
eoinest wants to merge 14 commits into
gt-edge/pr2-compiler-splicefrom
gt-edge/pr3-ssr-frameworks
Open

eoinest wants to merge 14 commits into
gt-edge/pr2-compiler-splicefrom
gt-edge/pr3-ssr-frameworks

Conversation

@eoinest

@eoinest eoinest commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

PR 3 of the gt-edge / delivery: 'splice' stack. It stacks on #3095 (gt-edge/pr2-compiler-splice).

What this adds

gt-edge framework adapters (no runtime dependencies; each symbol is exported from one subpath)

  • gt-edge/tanstack-start: createTanStackStartProxy({ store }). Its wrapFetch(handler.fetch) serves /_gt/* chunks, returns 404 for every spelling of /_gt-headers/*, and passes everything else to TanStack Start. When a document is rendered under a locale prefix (/fr/...), its streamed HTML is rewritten so each quoted chunk URL loads that locale's copy. That covers <script src>, modulepreload, inline dynamic imports, and the router state TanStack inlines into the page. No Vary: Cookie is added, because the URL already names the locale. The entry also exports localizeAssetUrl, rewriteSsrAssetTags and wrapHtmlResponse. It imports nothing from node:*, and purity.test.ts now checks dist/tanstack-start.js for that.
  • gt-edge/astro:
    • createAstroMiddleware() is duck-typed onRequest middleware. By default it reads headers from dist/server/gt, because Astro's SSR adapters serve dist/client before middleware runs.
    • The gtEdgeAstro({ mode }) integration either emits static files (verify, materialize, write _headers, delete _gt-headers/) or, in SSR mode, moves the headers out of the client directory. It refuses a headersRoot inside dist/client.
  • gt-edge/gatsby: createGatsbyPlugin() gives onPostBuild, which emits static files by default, and onCreateDevServer, which mounts the Express middleware when public/ has a manifest.
  • gt-edge/vite: gtEdgeVite() splices in vite preview, reading from the client environment's outDir. Optionally it runs a post-build verify or static emit on client builds.

passthroughChunks (manifest addition, needed for zero-redirect SSR)

With hashStrategy: 'locale', a localized route chunk's relative imports (./i18n-config-*.js, vendor chunks) resolve under /_gt/fr/<localeHash>/. Before this change, untranslated chunks there returned 404. The manifest now lists them in passthroughChunks, and the handler serves them unchanged (immutable, ETag, 304) only when the hash in the URL is that locale's single hash. The allowlist rule still holds. Validation requires that each locale have one hash, and materializeStatic and verifyBuildOutput handle these chunks.

gt-tanstack-start

  • experimentalCompilerOptions.delivery (typed as Pick<GTUnpluginOptions, 'delivery'>) is passed through to the compiler.
  • createCompilerPlugin now handles the compiler returning Plugin | Plugin[] and adapts each plugin.

Compiler fixes found while running the real TanStack Start build

  • Vite 8 shares one plugin instance across the client and ssr environments, and configResolved runs once per environment. The last call (ssr) switched splicing off for the client, and the SSR bundle kept raw @gt/slot: strings. The splice hooks now read this.environment: only the client environment splices, and server modules keep looking translations up per request.
  • With hashStrategy: 'locale', the build emits passthroughChunks. SPA documents then point every chunk at the locale prefix, so they need no import map.
  • With hashStrategy: 'locale', the compiler sets experimental.renderBuiltUrl to return { relative: true } for JS chunks. Without it, Vite's __vite__mapDeps preloads absolute /assets/*.js URLs, so localized pages also download the default-locale chunks. Any renderBuiltUrl the user already set takes precedence.

Real E2E: tests/apps/tanstack-start check:splice

The default vite build is unchanged; splicing turns on only when GT_DELIVERY=splice. The script:

  1. Builds twice with { mode: 'splice', hashStrategy: 'locale', routing: 'path', documents: false } and the locale-routing config. All 23 client files must be byte-identical across the two builds.
  2. Checks one hash per locale, const __gt=[...];\n headers, no placeholders in client or server code, and that verifyBuildOutput passes.
  3. Serves the build through createTanStackStartProxy + createFsAssetStore in front of the built TanStack Start server. A spliced chunk is immutable with no Vary, and its relative imports resolve with 0 redirects. /_gt-headers/* returns 404. /fr/ssr loads only /_gt/fr/<hash>/ chunks and /ssr loads none.
  4. In Chromium, /ssr, /fr/ssr and /fr/ render the right text with 0 console or page errors. Every script returns 200 from its locale's prefix, including after a client navigation into the lazy /fr/ssr route.

Verification

  • CI=true pnpm exec turbo run build --filter=gt-edge --filter=@generaltranslation/compiler --filter=gt-tanstack-start --force --env-mode=loose (publint + attw): pass
  • typecheck for gt-edge, compiler, gt-tanstack-start and the test app: pass
  • tests: gt-edge 560, compiler 1136, gt-tanstack-start 174: pass
  • check:library-defaults, check:reexports, check:test-locations, check:src-entry-points, check:export-owners, oxlint, oxfmt --check .: pass
  • tests/apps/tanstack-start check:splice: pass. PR 2's tests/apps/vite-react check:splice still passes.

Out of scope

gt-edge/client / liveSwitch (PR 4) and gt-edge/next (PR 5). Splice is reload-only, so a locale switch has to navigate.

Confidence Score: 5/5RetriggerView in Greptile

The requested passthrough fix appears safe to merge; no new actionable issue was established.

Summary

This PR adds framework adapters for spliced translations and keeps untranslated JavaScript available under locale URLs.

  • Locale-prefixed chunk URLs also serve untranslated JavaScript files.
  • TanStack Start pages load the chunk copies for their locale.
  • Astro, Gatsby, and Vite builds can serve spliced translations.
  • TanStack Start passes splice settings to the compiler for server-rendered apps.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Request an older passthrough URL] --> B{File also listed in current passthroughChunks?}
  B -->|Yes| C[Read getFallbackAsset only]
  C --> D{Older copy found?}
  D -->|No| E[Redirect to current locale URL]
  D -->|Yes| F[Return older copy or 304]
  B -->|No| G[Use existing previous-file lookup]
Loading

Reviews (4) · Last reviewed commit: "fix(edge): redirect fixed-name previous ..." · Reviewed by Greptile

@eoinest
eoinest requested a review from a team as a code owner December 2, 2026 03:11
@eoinest eoinest added the samsara Targets the samsara prerelease branch label Dec 2, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it is a large multi-package SSR adapter and compiler change (35 files, ~2.8k additions) that exceeds the low-risk threshold and adds public framework surfaces. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present after the first check poll.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
generaltranslation 21.27 KB (0%)
generaltranslation/api 7.78 KB (0%)
generaltranslation/runtime 10.29 KB (0%)
generaltranslation/id 2.51 KB (0%)
generaltranslation/internal 15.18 KB (0%)
generaltranslation/diagnostics 400 B (0%)
generaltranslation/config-schema 5.09 KB (0%)
@generaltranslation/format 7.2 KB (0%)
@generaltranslation/format/internal 210 B (0%)
@generaltranslation/icu/convert { checkTranslation } 4.04 KB (0%)
@generaltranslation/icu/convert { checkIcuTranslation } 9.17 KB (0%)
@generaltranslation/icu/convert { getPluralCategories, isExactKey } 303 B (0%)
gt-i18n 25.65 KB (0%)
gt-i18n/internal 25.3 KB (0%)
gt-i18n/internal/compat 13.05 KB (0%)
gt-i18n/internal/cookies 228 B (0%)
gt-i18n/internal/string 13.15 KB (0%)
@generaltranslation/react-core/pure 29.27 KB (0%)
@generaltranslation/react-core/hooks 24.3 KB (0%)
@generaltranslation/react-core/components 25.72 KB (0%)
@generaltranslation/react-core/components-rsc 9.85 KB (0%)
@generaltranslation/react-core/compat 28.68 KB (0%)
gt-react (client) 37.23 KB (0%)
gt-react { initializeGTSPA, GTProvider, useGT } 29.47 KB (0%)
gt-react (rsc) 32.34 KB (0%)
gt-react (server) 35.52 KB (0%)
gt-react/compat (client) 29.55 KB (0%)
gt-react/compat (rsc) 13.41 KB (0%)
gt-react/compat (server) 29.82 KB (0%)
gt-vue 10.6 KB (0%)
gt-vue (SPA) 16.93 KB (0%)
gt-next (client) 61.93 KB (0%)
gt-next (rsc) 66 KB (0%)
gt-next (server) 61.13 KB (0%)
gt-next/config 70.74 KB (0%)
gt-next/server 63.91 KB (0%)
gt-next/compat (client) 60.43 KB (0%)
gt-next/compat (rsc) 68.23 KB (0%)
gt-next/compat (server) 61.95 KB (0%)
gt-next/compat/server 56.45 KB (0%)
gt-next/middleware 47.27 KB (0%)
gt-next/link 60.72 KB (0%)
gt-next/internal/_dictionary 144 B (0%)
gt-next/internal/_load-translations 144 B (0%)
gt-next/internal/_load-dictionary 144 B (0%)
gt-next/internal/_getLocale 125 B (0%)
gt-next/internal/_getRegion 122 B (0%)
gt-node 26.55 KB (0%)
gt-node/compat 13.24 KB (0%)
gt-node/internal 1.44 KB (0%)
gt-tanstack-start (client) 36.32 KB (0%)
gt-tanstack-start (server) 36.4 KB (0%)
gt-tanstack-start/compat (client) 34.54 KB (0%)
gt-tanstack-start/compat (server) 35.16 KB (0%)
gt-react-native 34.33 KB (0%)
gt-react-native/compat 30.54 KB (0%)
gt-react-native/plugin 9.51 KB (0%)
gt-react-native/internal 746 B (0%)

Comment thread packages/edge/src/adapters/astro.ts Resolved
Comment thread packages/edge/src/adapters/astro.ts Resolved
Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/html/localizeHtml.ts Resolved
Comment thread packages/edge/src/html/localizeHtml.ts Resolved
Comment thread packages/edge/src/adapters/astro.ts Resolved
Comment thread packages/edge/src/html/localizeHtml.ts Resolved
Comment thread packages/edge/src/astro.ts Resolved
Comment thread packages/edge/src/html/localizeHtml.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Changes requested. The TanStack end-to-end check passes with locale hashing, but the default setting breaks a client import. Static preview and several framework deployment paths also fail, and Astro can delete unrelated build files.

Approach Sharing the manifest and chunk handler across adapters makes sense. Each adapter also needs to connect that handler to its framework’s actual build output and request routing.

Reviewed changes I reviewed the compiler, manifest, handler, static output, four framework adapters, and their tests.

  • Compiler and delivery. The Vite plugin separates server transforms from client splicing, configures relative JS preload URLs, and emits locale-hash aliases for untranslated chunks.
  • Edge serving. The manifest, request handler, and static materializer now validate, serve, and copy passthrough chunks.
  • Framework integration. TanStack Start forwards delivery options and wraps SSR responses. Astro adds middleware and build hooks, Gatsby adds build and dev-server hooks, and Vite adds preview and post-build handling.
  • Verification. All three packages built. Across their suites, 1,870 tests passed and eight compiler tests were skipped. The TanStack Chromium check passed, including navigation into the lazy French route.

P1 A standard Gatsby build cannot produce the manifest these hooks consume

Gatsby builds its browser chunks with webpack, while the splice compiler accepts only Vite. Both Gatsby hooks return when the manifest is missing, and the tests supply that manifest by hand. A site adding these hooks to its own Gatsby build gets no localized chunks. Gatsby build stages · Splice compiler support

Technical details
# Establish the Gatsby build contract

## Affected sites

- `packages/edge/src/adapters/gatsby.ts:76` and `:95` require a prebuilt manifest in the site’s output.
- `packages/edge/src/adapters/__tests__/vite-gatsby.test.ts:79` seeds the files before invoking the hook.

## Required outcome

- Demonstrate a supported way to generate and load spliced Gatsby chunks in a real site. If this API is intended only for sites hosting separately built Vite assets, document and test that narrower contract.

Non-blocking

  • Streamed markup can wait for an unrelated chunk. With <main class="page">Bonjour</main> as the first piece, the reader received only <main class="page until more input arrived. Retain a suffix only while it can still be the start of a quoted asset URL, so an SSR shell can paint while deferred content is pending. Stream boundary calculation

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

Comment thread packages/edge/src/adapters/astro.ts Resolved
Comment thread packages/edge/src/adapters/astro.ts Resolved
Comment thread packages/edge/src/adapters/astro.ts Resolved
Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/html/localizeHtml.ts Resolved
Comment thread packages/edge/src/html/localizeHtml.ts Resolved
eoinest added a commit that referenced this pull request Dec 2, 2026
…nd rebase onto PR #3095

- compiler: type renderBuiltUrl as Vite's RenderBuiltAssetUrl and make only
  client JS asset URLs relative; share one config() hook with the module
  preload filter; list JS assets in passthroughChunks under hashStrategy locale
- gt-tanstack-start: delivery { mode: 'splice' } defaults to hashStrategy
  locale, documents false and routing path
- gt-edge: streaming quoted-URL rewriter with no length cap; Vary on every
  rewritable document; base-aware path locale; leave 'chunk'-hash documents
  unchanged and report once; createSplitAssetStore and headersStore for
  TanStack Start; gtEdgeVite headersRoot move and static/base-aware preview;
  guarded headers move; localized prerendered pages for Astro and Gatsby;
  manifestPath derived from headersPrefix; pure gt-edge/astro with Node
  integration in gt-edge/astro/integration
- tests/apps/tanstack-start: serve dist/client in front of the proxy, read
  headers from dist/server/_gt-headers, check both builds are deterministic
@eoinest
eoinest force-pushed the gt-edge/pr3-ssr-frameworks branch from ceb2c14 to 1dab2c0 Compare December 2, 2026 03:43

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it is a large multi-package SSR adapter and compiler change (43 files, ~3.8k additions) that exceeds the low-risk threshold and adds public framework surfaces. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present after the first check poll.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Changes requested. Vite can leave private headers in the client build, and a worker update can reuse an immutable URL. Preview and static-page failures are detailed inline.

Reviewed changes I reviewed the fixes and accompanying tests since ceb2c149.

  • Separated private headers from client assets. Added split stores, a Node-specific Astro entry point, guarded directory moves, and Vite build and preview handling.
  • Reworked HTML localization. Replaced the streaming URL matcher, preserved cookie-based cache variation, handled a shared router and asset base, and rewrote prerendered Astro and Gatsby pages.
  • Changed splice defaults and asset handling. TanStack Start now defaults to locale hashing and path routing, and the compiler includes emitted JavaScript assets in the passthrough list.
  • Verified the build and browser behavior. All three packages built, 1,957 package tests passed with eight skipped, and the TanStack Chromium fixture passed for default and French routes. Two consecutive builds produced identical client and server files.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/adapters/vite.ts Resolved
eoinest added a commit that referenced this pull request Dec 2, 2026
…nd rebase onto PR #3095

- compiler: type renderBuiltUrl as Vite's RenderBuiltAssetUrl and make only
  client JS asset URLs relative; share one config() hook with the module
  preload filter; list JS assets in passthroughChunks under hashStrategy locale
- gt-tanstack-start: delivery { mode: 'splice' } defaults to hashStrategy
  locale, documents false and routing path
- gt-edge: streaming quoted-URL rewriter with no length cap; Vary on every
  rewritable document; base-aware path locale; leave 'chunk'-hash documents
  unchanged and report once; createSplitAssetStore and headersStore for
  TanStack Start; gtEdgeVite headersRoot move and static/base-aware preview;
  guarded headers move; localized prerendered pages for Astro and Gatsby;
  manifestPath derived from headersPrefix; pure gt-edge/astro with Node
  integration in gt-edge/astro/integration
- tests/apps/tanstack-start: serve dist/client in front of the proxy, read
  headers from dist/server/_gt-headers, check both builds are deterministic
@eoinest
eoinest force-pushed the gt-edge/pr3-ssr-frameworks branch from 1dab2c0 to 592a12f Compare December 2, 2026 04:02

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it is a large multi-package SSR adapter and compiler change (43 files, ~3.8k additions) that exceeds the low-risk threshold and adds public framework surfaces. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present after the first check poll.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Five P1 findings still block approval. They cover Vite header relocation and preview, custom manifest paths in Vite and Gatsby, cache invalidation for fixed-name workers, and Astro’s file-format locale homepages. The rebase introduced no new findings. Previous review

Reviewed changes since 1dab2c08 center on the rebase onto the updated splice compiler and edge runtime.

  • Rebased the adapter stack onto the compiler’s token-based slot replacement and deterministic build IDs, plus the edge runtime’s cache and source-map changes.
  • Verified the affected packages. All three builds passed. The package suites passed 1,983 tests, with eight compiler tests skipped.
  • Exercised TanStack Start in Chromium. English and French SSR and lazy navigation loaded their scripts with zero redirects or browser errors. Two builds produced byte-identical output across all 18 client files and 28 server files.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@generaltranslation/api

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/api@aba7cb7

@generaltranslation/auth

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/auth@aba7cb7

gt

npm i https://pkg.pr.new/generaltranslation/gt@aba7cb7

@generaltranslation/compiler

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/compiler@aba7cb7

generaltranslation

npm i https://pkg.pr.new/generaltranslation/gt/generaltranslation@aba7cb7

gt-edge

npm i https://pkg.pr.new/generaltranslation/gt/gt-edge@aba7cb7

@generaltranslation/format

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/format@aba7cb7

gtx-cli

npm i https://pkg.pr.new/generaltranslation/gt/gtx-cli@aba7cb7

gt-i18n

npm i https://pkg.pr.new/generaltranslation/gt/gt-i18n@aba7cb7

@generaltranslation/icu

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/icu@aba7cb7

gt-next

npm i https://pkg.pr.new/generaltranslation/gt/gt-next@aba7cb7

gt-node

npm i https://pkg.pr.new/generaltranslation/gt/gt-node@aba7cb7

@generaltranslation/paraglide-js

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/paraglide-js@aba7cb7

gt-payload

npm i https://pkg.pr.new/generaltranslation/gt/gt-payload@aba7cb7

@generaltranslation/python-extractor

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/python-extractor@aba7cb7

gt-react

npm i https://pkg.pr.new/generaltranslation/gt/gt-react@aba7cb7

@generaltranslation/react-core

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/react-core@aba7cb7

@generaltranslation/react-core-linter

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/react-core-linter@aba7cb7

gt-react-native

npm i https://pkg.pr.new/generaltranslation/gt/gt-react-native@aba7cb7

gt-remark

npm i https://pkg.pr.new/generaltranslation/gt/gt-remark@aba7cb7

gt-rrweb

npm i https://pkg.pr.new/generaltranslation/gt/gt-rrweb@aba7cb7

gt-sanity

npm i https://pkg.pr.new/generaltranslation/gt/gt-sanity@aba7cb7

@generaltranslation/supported-locales

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/supported-locales@aba7cb7

gt-svelte

npm i https://pkg.pr.new/generaltranslation/gt/gt-svelte@aba7cb7

@generaltranslation/svelte-extractor

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/svelte-extractor@aba7cb7

gt-tanstack-start

npm i https://pkg.pr.new/generaltranslation/gt/gt-tanstack-start@aba7cb7

gt-vue

npm i https://pkg.pr.new/generaltranslation/gt/gt-vue@aba7cb7

@generaltranslation/vue-extractor

npm i https://pkg.pr.new/generaltranslation/gt/@generaltranslation/vue-extractor@aba7cb7

commit: aba7cb7

eoinest added a commit that referenced this pull request Dec 2, 2026
…nd rebase onto PR #3095

- compiler: type renderBuiltUrl as Vite's RenderBuiltAssetUrl and make only
  client JS asset URLs relative; share one config() hook with the module
  preload filter; list JS assets in passthroughChunks under hashStrategy locale
- gt-tanstack-start: delivery { mode: 'splice' } defaults to hashStrategy
  locale, documents false and routing path
- gt-edge: streaming quoted-URL rewriter with no length cap; Vary on every
  rewritable document; base-aware path locale; leave 'chunk'-hash documents
  unchanged and report once; createSplitAssetStore and headersStore for
  TanStack Start; gtEdgeVite headersRoot move and static/base-aware preview;
  guarded headers move; localized prerendered pages for Astro and Gatsby;
  manifestPath derived from headersPrefix; pure gt-edge/astro with Node
  integration in gt-edge/astro/integration
- tests/apps/tanstack-start: serve dist/client in front of the proxy, read
  headers from dist/server/_gt-headers, check both builds are deterministic
eoinest added a commit that referenced this pull request Dec 2, 2026


- gtEdgeVite shares the pending headers move across the plugin instance
  of each environment, and moves the headers once every environment is
  built, whether Vite builds them in a custom buildApp or after it.
- vite preview splices from headersRoot once the headers moved, and
  Vite preview and the Gatsby dev server pass the derived manifestPath.
- Fixed-name passthrough JavaScript assets go into the locale hash.
- Static pages include Astro's build.format 'file' pages; a headersRoot
  holding a file its manifest does not name is never replaced; and
  materializeStatic({ overwriteDocuments: false }) keeps framework pages.
- localizeDocumentResponse varies by Cookie when the manifest names an
  enable-i18n cookie and keeps documents with i18n off private.
- gtTanstackStart warns about hashStrategy 'chunk' with splice delivery.
@eoinest
eoinest force-pushed the gt-edge/pr3-ssr-frameworks branch from 592a12f to 2e147c3 Compare December 2, 2026 04:26

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it is a large multi-package SSR adapter and compiler change that exceeds the low-risk threshold and adds public framework surfaces. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present after the first check poll.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

eoinest added a commit that referenced this pull request Dec 2, 2026
…nd rebase onto PR #3095

- compiler: type renderBuiltUrl as Vite's RenderBuiltAssetUrl and make only
  client JS asset URLs relative; share one config() hook with the module
  preload filter; list JS assets in passthroughChunks under hashStrategy locale
- gt-tanstack-start: delivery { mode: 'splice' } defaults to hashStrategy
  locale, documents false and routing path
- gt-edge: streaming quoted-URL rewriter with no length cap; Vary on every
  rewritable document; base-aware path locale; leave 'chunk'-hash documents
  unchanged and report once; createSplitAssetStore and headersStore for
  TanStack Start; gtEdgeVite headersRoot move and static/base-aware preview;
  guarded headers move; localized prerendered pages for Astro and Gatsby;
  manifestPath derived from headersPrefix; pure gt-edge/astro with Node
  integration in gt-edge/astro/integration
- tests/apps/tanstack-start: serve dist/client in front of the proxy, read
  headers from dist/server/_gt-headers, check both builds are deterministic
@eoinest
eoinest force-pushed the gt-edge/pr3-ssr-frameworks branch from 2e147c3 to 0bde56c Compare December 2, 2026 04:28
eoinest added a commit that referenced this pull request Dec 2, 2026


- gtEdgeVite shares the pending headers move across the plugin instance
  of each environment, and moves the headers once every environment is
  built, whether Vite builds them in a custom buildApp or after it.
- vite preview splices from headersRoot once the headers moved, and
  Vite preview and the Gatsby dev server pass the derived manifestPath.
- Fixed-name passthrough JavaScript assets go into the locale hash.
- Static pages include Astro's build.format 'file' pages; a headersRoot
  holding a file its manifest does not name is never replaced; and
  materializeStatic({ overwriteDocuments: false }) keeps framework pages.
- localizeDocumentResponse varies by Cookie when the manifest names an
  enable-i18n cookie and keeps documents with i18n off private.
- gtTanstackStart warns about hashStrategy 'chunk' with splice delivery.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it is a large multi-package SSR adapter and compiler change (45 files, ~4.4k additions) that exceeds the low-risk threshold and adds public framework surfaces. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present after the first check poll.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

eoinest added a commit that referenced this pull request Dec 2, 2026
…nd rebase onto PR #3095

- compiler: type renderBuiltUrl as Vite's RenderBuiltAssetUrl and make only
  client JS asset URLs relative; share one config() hook with the module
  preload filter; list JS assets in passthroughChunks under hashStrategy locale
- gt-tanstack-start: delivery { mode: 'splice' } defaults to hashStrategy
  locale, documents false and routing path
- gt-edge: streaming quoted-URL rewriter with no length cap; Vary on every
  rewritable document; base-aware path locale; leave 'chunk'-hash documents
  unchanged and report once; createSplitAssetStore and headersStore for
  TanStack Start; gtEdgeVite headersRoot move and static/base-aware preview;
  guarded headers move; localized prerendered pages for Astro and Gatsby;
  manifestPath derived from headersPrefix; pure gt-edge/astro with Node
  integration in gt-edge/astro/integration
- tests/apps/tanstack-start: serve dist/client in front of the proxy, read
  headers from dist/server/_gt-headers, check both builds are deterministic
eoinest added a commit that referenced this pull request Dec 2, 2026


- gtEdgeVite shares the pending headers move across the plugin instance
  of each environment, and moves the headers once every environment is
  built, whether Vite builds them in a custom buildApp or after it.
- vite preview splices from headersRoot once the headers moved, and
  Vite preview and the Gatsby dev server pass the derived manifestPath.
- Fixed-name passthrough JavaScript assets go into the locale hash.
- Static pages include Astro's build.format 'file' pages; a headersRoot
  holding a file its manifest does not name is never replaced; and
  materializeStatic({ overwriteDocuments: false }) keeps framework pages.
- localizeDocumentResponse varies by Cookie when the manifest names an
  enable-i18n cookie and keeps documents with i18n off private.
- gtTanstackStart warns about hashStrategy 'chunk' with splice delivery.
@eoinest
eoinest force-pushed the gt-edge/pr3-ssr-frameworks branch from 0bde56c to 8dd7a29 Compare December 2, 2026 04:34
… build order and forward cookie names to splice

- gtEdgeVite records the app build in a buildApp pre hook and moves the
  headers once every environment it lists is built, so programmatic
  createBuilder() without a builder option and builds split between
  builder.buildApp and a later plugin keep the manifest; vite.build()
  still moves right after the client build
- vite preview splices whenever a manifest option or a manifest on disk
  exists, and reads headers from headersRoot whenever they moved there,
  even with a manifestPath left in the client build
- localizeDocumentResponse adds Vary: Cookie and, with i18n turned off,
  Cache-Control: private, no-store to HEAD and compressed HTML responses
- gtTanstackStart passes localeCookieName and enableI18nCookieName to the
  splice delivery, so its manifest names the runtime's cookies
… materialized chunks in preview

Track builder.build calls so the headersRoot move waits only for in-flight
builds and environments whose outDir overlaps the target, which covers
parallel builds and skipped environments. Preview with an explicit manifest
now splices only when runtime headers exist on disk, so a materialized
static build is served from disk.
…ut dir, and preview under the manifest's headersPrefix

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it adds SSR and static adapters across compiler, edge, and TanStack Start with a large runtime blast radius and new public framework surfaces, which is above the low-risk threshold. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@eoinest
eoinest force-pushed the gt-edge/pr3-ssr-frameworks branch from 21f669a to 42df041 Compare December 2, 2026 05:13

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it adds SSR and static adapters across compiler, edge, and TanStack Start with a large runtime blast radius and new public framework surfaces, which is above the low-risk threshold. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@eoinest

eoinest commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai Please re-review 42df041 — fixed-name previous passthrough chunks now redirect to the current canonical URL when no fallback copy exists instead of serving new bytes under the old immutable hash.

greptile-apps[bot]
greptile-apps Bot previously approved these changes Dec 2, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Changes requested. I reproduced a build that deleted an existing file, a second client output that retained private headers, a static preview that returned HTTP 500, and an old immutable URL that served another release’s JavaScript.

Reviewed changes I reviewed the two commits since c5157b0d, including the passthrough fix that landed during verification.

  • Changed Vite header relocation. The adapter tracks active builds and temporarily moves headers aside when a later environment writes to their directory.
  • Changed preview routing. Preview reads the private header prefix from a supplied manifest or loader to select the client or server directory.
  • Changed previous-release chunk handling. The handler redirects a previous passthrough URL to the current locale hash when both releases list the filename as passthrough and the archive has no copy.
  • Verified the edge package. The build, package checks, typecheck, and all 731 tests passed. Separate Vite and handler fixtures reproduced the findings below.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/handler/handler.ts Resolved
… keep static preview working, and establish previous passthrough ownership
@greptile-apps
greptile-apps Bot dismissed their stale review December 2, 2026 05:23

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it adds SSR and static adapters across compiler, edge, and TanStack Start with a large runtime blast radius and new public framework surfaces, which is above the low-risk threshold. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present after the first check poll.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Changes requested. Static preview can expose a custom private headers directory, a valid multi-output static build fails, and adding a second copy of the same archived chunk identity can turn a 200 into a 404.

Reviewed changes in 1c0bef32 since the review of 42df0417 cover the Vite adapter and previous-release chunk handling.

  • Tracked header relocation. The adapter records completed moves and preserves the staged directory when restoring it fails.
  • Processed multiple client outputs. The build hook verifies each output containing a manifest and materializes each one in static mode.
  • Restored file-backed static preview. Materialized pages and chunks can load after the build deletes the manifest that the provider reads.
  • Checked historical chunk ownership. The handler considers both passthrough and translated files when choosing an archive response or a redirect.

The gt-edge build, package checks, typecheck, and all 739 tests passed.

Non-blocking

  • A later build can restore an earlier build’s headers. With Vite 7.3.7, I ran a standalone build and then a fresh app build in the same process. The second client emitted no GT assets, but the adapter restored the first build’s manifest after the second SSR build emptied its output. Associate a recorded move with the client environment that performed it before adopting it in a new builder. Relocation tracking

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/adapters/vite.ts Resolved
Comment thread packages/edge/src/handler/handler.ts Resolved
…t static with headersRoot, and deduplicate identical archived passthrough hashes

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it is a large multi-package SSR/static adapter change (46 files, ~5.7k additions) that exceeds the low-risk threshold and adds public framework surfaces. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Changes requested. A Vite preview of a materialized build returns 500 for pages and chunks when its manifest provider uses a JSON import.

Reviewed changes in 2819fe3c cover Vite preview, multi-output static builds, and archived passthrough chunks.

  • Resolved the preview prefix from the manifest provider. Static preview now uses the provider’s custom headers prefix and classifies loader failures before handing requests to Vite.
  • Allowed multiple static outputs with headersRoot. Each output is verified and materialized. The single-target restriction applies only when headers are relocated.
  • Recognized identical archived chunks. Retained releases can share a passthrough file when they agree on its path and locale hash.

The gt-edge build, package checks, typecheck, and all 741 unit tests passed.

Non-blocking

  • An old worker URL can serve current bytes after a switch to per-chunk hashing. The new build can still ship assets/worker.js even though its passthroughChunks is empty. With two matching retained manifests and no archived copy, the handler returned the current worker under the old ETag with a one-year immutable cache lifetime. Require a matching archived copy before serving a fixed-name file in this case. Previous-owner check

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

Comment thread packages/edge/src/adapters/vite.ts Resolved

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it adds SSR and static adapters across compiler, edge, and TanStack Start with a large runtime blast radius and new public framework APIs, which exceeds the low-risk threshold. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Changes requested. A relative path to the configured manifest still makes Vite preview return 500 for a materialized homepage and its localized chunks.

Reviewed changes in 6781b149 cover manifest loading during Vite preview.

  • Updated missing-file detection. Preview now checks filesystem, ESM, and CommonJS lookup errors against candidate manifest paths in the client and relocated headers directories.
  • Added a regression test. It verifies that a deleted JSON import allows the static page and chunk to load and that a missing release selector produces a 500.

The gt-edge build, package checks, typecheck, and all 742 tests passed.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

Comment thread packages/edge/src/adapters/vite.ts Resolved

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. This PR is not approved: it adds SSR and static adapters across compiler, edge, and TanStack Start with a large runtime blast radius and new public framework surfaces, which is above the low-risk threshold. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present after the first check poll.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Changes requested. A CommonJS manifest provider in a workspace app can still make Vite preview return 500 for the materialized homepage and localized chunks.

Reviewed changes in 7c908a99 cover how Vite preview identifies a manifest removed by a static build.

  • Replaced substring matching with exact comparisons. Preview now checks filesystem and module-loading errors against the configured client and relocated manifest paths.
  • Verified the previous fix. A relative readFile of the removed manifest allows static serving, and a missing .sha256 sidecar still surfaces the provider error.

The gt-edge build, package checks, typecheck, and all 742 tests passed.

Non-blocking

  • An apostrophe in the project path breaks ESM manifest detection. The parser stops at the apostrophe inside the filename. With a JSON import, both the homepage and the French chunk returned 500 under app's files and 200 under an ordinary directory name. Node supplied the complete target in error.url, which can be converted with fileURLToPath. Error parser

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

Comment thread packages/edge/src/adapters/vite.ts Resolved

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: high. Not approved. This adds SSR and static framework adapters across multiple packages with a large blast radius and new public interfaces, which is above the low-risk approval threshold. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Changes requested. Vite preview returns HTTP 500 for materialized pages and chunks when a CommonJS provider omits the manifest’s .json extension.

Reviewed changes in 429beecf cover how Vite preview handles a provider after static generation removes its manifest.

  • Resolved relative CommonJS paths from the caller. Preview uses the requiring module’s directory and resolves symlinks before comparing filenames.
  • Preserved apostrophes in module paths. A JSON import from a workspace path containing an apostrophe now lets Vite serve the materialized output.
  • Added preview coverage. The new test exercises client and relocated manifests, a missing sidecar, and an unrelated missing file.

The gt-edge build, package checks, typecheck, and all 743 tests passed.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

Comment thread packages/edge/src/adapters/vite.ts Resolved

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: high. This PR is not approved: it is a large multi-package SSR adapter and compiler change that exceeds the low-risk threshold and adds public framework surfaces. Human review is needed and no reviewers were assigned. Cursor Bugbot and Cursor Security Agent were not present after the first check poll.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No blocking issues. The extensionless CommonJS manifest fix works in Vite preview.

Reviewed changes in aba7cb74 cover manifest providers after static materialization removes the private headers directory.

  • Recognized CommonJS JSON lookups. Preview now serves materialized pages and chunks when a direct require() omits .json or resolves a directory through index.json.
  • Extended the preview tests. The regression test checks the homepage, localized chunk, and private-header 404 with an extensionless provider. It also verifies that a missing manifest.js surfaces as HTTP 500.

The gt-edge build, package checks, typecheck, and all 743 tests passed.

Non-blocking

  • Static preview can hide a broken package alias. With a package.json imports alias pointing to ./dist/client/_gt-headers/manifest, Node throws MODULE_NOT_FOUND even while manifest.json exists because the alias target is exact. I verified that static preview returned HTTP 200 for this broken provider. Limit the extra JSON candidates to ordinary CommonJS file and directory lookups so package-map errors propagate. Vite adapter · Node resolution algorithm

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6.2-astra | 𝕏

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

samsara Targets the samsara prerelease branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant