Skip to content

fix(ssr): keep compiled framework cache graphs reusable - #3118

Merged
kojiwakayama merged 1 commit into
mainfrom
fix/portable-framework-cache-paths
Jul 26, 2026
Merged

fix(ssr): keep compiled framework cache graphs reusable#3118
kojiwakayama merged 1 commit into
mainfrom
fix/portable-framework-cache-paths

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Problem

Compiled framework modules use physical paths ending in .ts.src or .tsx.src. Three cache-path mismatches made valid entries look stale during concurrent preview SSR:

  • file URL extraction truncated the terminal .src suffix
  • dependency hashing rewrote embedded physical imports to .js
  • temporary module paths did not content-address compiled .src inputs

The result was repeated context/router re-transforms, invalid-local-path warnings, and elevated 500/503 latency under cold concurrency.

Fix

  • validate complete file URLs and preserve supported .src paths
  • hash the physical embedded dependency graph for compiled framework sources
  • emit content-addressed .js artifacts for terminal .ts.src/.tsx.src inputs
  • add regressions at URL extraction, dependency hashing, cache validation, and temp-path boundaries

This deliberately does not increase timeouts or bypass cache validation.

Verification

  • deno task verify:quick
  • focused cache/path suite: 80 steps passed
  • fresh compiled-binary E2E: 62/62 passed in 3m17s
  • full framework suite: 3,113 tests / 25,292 steps passed; two unrelated baseline packaging checks fail on origin/main as well (existing gaxios ownership metadata and absent generated npm MCP handler output)
  • git diff --check

Release

Bumps framework version to 0.1.1154.

@kojiwakayama
kojiwakayama requested a review from kwakayama as a code owner July 26, 2026 05:24
Copilot AI review requested due to automatic review settings July 26, 2026 05:24

Copilot AI 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.

Pull request overview

This PR fixes SSR transform cache reusability for compiled framework modules whose physical paths end in .ts.src / .tsx.src, preventing unnecessary re-transforms and elevated error/latency under concurrent preview SSR.

Changes:

  • Preserve and validate compiled .src file URLs during cached-code path extraction, including stripping query/hash safely.
  • Normalize dependency graph paths so .src modules hash their physical embedded dependency graph (without rewriting to .js).
  • Generate content-addressed temporary .js artifacts for terminal .ts.src / .tsx.src inputs, with new regression tests.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils/version-constant.ts Bumps framework version constant to 0.1.1154.
deno.json Bumps package version to 0.1.1154.
src/modules/react-loader/ssr-module-loader/tmp-paths.ts Updates temp module path rewriting to support terminal `.(ts
src/modules/react-loader/ssr-module-loader/tmp-paths.test.ts Adds regression test for hashed temp paths from compiled framework .src files.
src/modules/react-loader/ssr-module-loader/ssr-cache-manager.test.ts Adds validation regression test for cache entries referencing compiled framework .src sources.
src/modules/react-loader/ssr-module-loader/http-bundle-helpers.ts Broadens file:// extraction then filters supported extensions, preserving .src and stripping ?/#.
src/modules/react-loader/ssr-module-loader/http-bundle-helpers.test.ts Adds tests for .src preservation and avoiding unsupported suffix truncation.
src/cache/dependency-graph.ts Normalizes dependency paths to preserve .src physical graph when the importing file is .src.
src/cache/dependency-tracking.test.ts Adds regression ensuring dependency hashing changes when compiled .src dependencies change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/modules/react-loader/ssr-module-loader/http-bundle-helpers.ts Outdated
Comment thread src/modules/react-loader/ssr-module-loader/ssr-cache-manager.test.ts Outdated
Compiled Deno binaries embed framework sources as *.ts.src and *.tsx.src. Cache validation truncated those URLs, dependency hashing probed rewritten .js paths, and SSR temp paths ignored content hashes for embedded sources. Preserve the physical source identity during graph hashing and validation, reject host-bearing file URLs, then emit content-addressed JavaScript cache artifacts.

Constraint: Compiled framework sources retain their authored extension before the .src suffix.

Rejected: Raise SSR deadlines or skip local-path validation | either would hide repeated invalidation without repairing the cache graph.

Confidence: high

Scope-risk: narrow

Directive: Keep embedded .src recognition aligned across dependency hashing, cache validation, and temp-path generation.

Tested: deno task verify:quick; 81 focused cache/dependency steps; fresh compiled-binary E2E (62/62); source-built app cold concurrency (20/20 review and 20/20 chat HTTP 200); framework suite 3113 passed with 2 unrelated baseline packaging failures.

Not-tested: Authenticated staging concurrency until v0.1.1154 is released and deployed.
Copilot AI review requested due to automatic review settings July 26, 2026 05:32
@kojiwakayama
kojiwakayama force-pushed the fix/portable-framework-cache-paths branch from 84efd76 to 4106e5a Compare July 26, 2026 05:32
@kojiwakayama
kojiwakayama enabled auto-merge July 26, 2026 05:39

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread src/cache/dependency-graph.ts
Copilot stopped reviewing on behalf of kojiwakayama due to an error July 26, 2026 05:58
@kojiwakayama
kojiwakayama added this pull request to the merge queue Jul 26, 2026
@kwakayama
kwakayama removed this pull request from the merge queue due to a manual request Jul 26, 2026
@kojiwakayama
kojiwakayama added this pull request to the merge queue Jul 26, 2026
Merged via the queue into main with commit 7f20d86 Jul 26, 2026
30 of 31 checks passed
@kojiwakayama
kojiwakayama deleted the fix/portable-framework-cache-paths branch July 26, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants