Repository navigation
feat(platform): integrate experimental streaming SSR - #2531
benpsnyder wants to merge 4 commits into
Conversation
|
Warning Review limit reachedNext included review available in 12 minutes. View limit detailsLimit details: You’ve used all 8 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (72)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This PR touches multiple package scopes: Please confirm the changes are closely related. |
|
View your CI Pipeline Execution ↗ for commit 3f4f78d
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
✅ Deploy Preview for analog-app ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for analog-blog ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:
We replaced waitUntil: 'networkidle' with waitUntil: 'load' in apps/analog-app-e2e/tests/page-load-hydration.spec.ts to resolve the playwright/no-networkidle ESLint error introduced by the new test file. This fix is safe because the test's subsequent await expect(page.locator('#greeting')).toHaveText(...) assertions already leverage Playwright's built-in auto-waiting to confirm DOM stability after navigation.
Tip
✅ We verified this fix by re-running analog-app-e2e:lint.
diff --git a/apps/analog-app-e2e/tests/page-load-hydration.spec.ts b/apps/analog-app-e2e/tests/page-load-hydration.spec.ts
index cacc24b5..a75f7211 100644
--- a/apps/analog-app-e2e/tests/page-load-hydration.spec.ts
+++ b/apps/analog-app-e2e/tests/page-load-hydration.spec.ts
@@ -11,7 +11,7 @@ test('hydrates the native load once and shares fresh query loads with getLoadRes
page.on('pageerror', (error) => errors.push(error.message));
const response = await page.goto('/greet/reader?shout=false', {
- waitUntil: 'networkidle',
+ waitUntil: 'load',
});
expect(response?.status()).toBe(200);
expect(await response?.text()).toContain('Hello, reader!');
Because this branch comes from a fork, it is not possible for us to apply fixes directly, but you can apply the changes locally using the available options below.
Apply changes locally with:
npx nx-cloud apply-locally Zwjo-hylA
Apply fix locally with your editor ↗ View interactive diff ↗
🎓 Learn more about Self-Healing CI on nx.dev
Rebuild this contribution directly on upstream alpha, keeping prerequisite changes in their own PRs. Co-Authored-By: OpenAI Codex <noreply@openai.com>
86e6204 to
c381ee6
Compare
…ites Qualify independent streaming builds, native context, and deferred function hydration. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Restore caller-header filtering from eeda7af. Preserve Request adapter fields, runtime context and cancellation; verify configured SSR rules over built HTTP. The route-policy contribution owns this shared prerequisite for independent renderer copies in the split. Refs: analogjs#2523, analogjs#2516
PR Checklist
Closes #2526.
This connects the existing experimental streaming renderer to the split Vite/Nitro integration and gives its capture hooks, response body, Angular platform, and browser bootstrap a tested lifecycle. A dashboard can deliver its shell and resolved deferred previews while later data remains pending, then hydrate against the complete authoritative document.
Review scope and shared prerequisites
The streaming implementation remains separate from the other feature PRs. This branch includes the shared prerequisites required to build and test it independently: Node/Nx Agent setup, route policy and SSR entry discovery, platform declarations, router lint setup, navigation tracking, Worker output/bundling, the server-mode optimizer correction, and native request/context and proxy-transform ordering for the deferred server-function example.
These are selected prerequisite fixes, not the full compiler, HTTP, or request/Query lifecycle contributions.
The shared route-policy prerequisite also strips caller-supplied
x-analog-no-ssrbefore internal renderer dispatch. analogjs/analog#2523 owns this repair and its tests. The copied regression verifies that caller headers cannot override configured SSR policy, while request URL/query, method/body, runtime context, and cancellation are preserved.Affected scope
platform.router/serverstreaming and reconciliation, optional server-context fields, the streaming example, documentation, and runtime qualification.Recommended merge strategy for maintainer [optional]
What is the new behavior?
Enable
analog({ experimental: { streaming: true } }), keep the separateangular()andnitro()plugins, and exportrenderStream(App, config)from the server entry.@deferblocks with hydration triggers can produce early previews. A route rule such as'/checkout': { streaming: false }retains buffered rendering when the final status must be known before sending headers.The transform checks the actual Angular defer-function structure using OXC AST positions. It supports symbolic and numeric profiler calls without assuming their ordinal values, is idempotent, and leaves browser/disabled paths alone. The qualified minimum is Angular 21. An absent or unsupported capture primitive retains buffered fallback with diagnostics.
Capture state remains local across overlapping native-async and Zone executions. Completion, failure, cancellation, and disconnected bodies dispose the platform and queued work. The optional host signal and
waitUntilkeep Worker cleanup reachable; idle comments allow a silent pending render to observe disconnects.Module assets are preloaded with the shell but execute only after the authoritative body is installed. Failed or truncated documents show a generic non-indexable error view without bootstrapping Angular against a missing root. Preview text is escaped. The HTTP host uses generic error framing after headers are committed; direct renderer callers retain stream errors unless they opt into framing.
Prerendering and crawler responses remain complete buffered documents. Progressive HTTP responses use identity encoding and
no-store, no-transform; explicit buffered routes and static assets retain their normal policy.Test plan
Verified head:
dcf5dcf91a93844e37ee5849e2781116396da9f0; current CI checks. Local qualification used Linux, Node24.15.0, pnpm10.33.0, andNX_DAEMON=false NX_NO_CLOUD=true. These are recorded executable results; this description update does not change source.pnpm nx test platform: 424 tests pass after the caller-header repair.pnpm nx lint platform,pnpm nx lint analog-app-e2e, andpnpm nx run analog-app-e2e:typecheckpass.pnpm nx run streaming-app-e2e-playwright:e2e: all three built-example tests pass, including buffered/streamed deferred hydration with caller SSR and streaming hints, the same transferred token, and zero refetch.Workerd qualification uses local Miniflare and the documented runtime compatibility boundary. The streaming policy/prerender tests also verify filtering both caller hints while retaining the configured buffering rules.
git diff --checkpass.Does this PR introduce a breaking change?
Streaming remains experimental and opt-in, and the new
ServerContextfields are optional. The shared Module/Durable Worker output correction changes the accidental Pages-shapeddist/_worker.jslocation: deployments must use Nitro's generated Wrangler configuration and separate public/server directories. Cloudflare Pages retains its existing layout. The streaming guide documents this migration. Angular internal shapes are checked for the recorded versions.Other information
Workstream 6 of Brandon Roberts' requested split. Compiler environment fixes, Vitest upgrades, buffered SSR/Worker output boundaries, HTTP transport, and request/hydration ownership remain in their prerequisite contributions. This adds streaming SSR, not server components. Assisted by OpenAI Codex.