[PR #1060] [MERGED] feat(app-router): mint semantic route graph ids #1059

Closed
opened 2026-05-06 13:11:47 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/1060
Author: @NathanDrake2406
Created: 5/5/2026
Status: Merged
Merged: 5/5/2026
Merged by: @james-elicx

Base: mainHead: nathan/726-graph-semantic-ids


📝 Commits (1)

  • ebd6f72 feat(app-router): mint semantic route graph ids

📊 Changes

6 files changed (+266 additions, -17 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-manifest.ts (+2 -0)
📝 packages/vinext/src/routing/app-route-graph.ts (+131 -14)
📝 packages/vinext/src/routing/app-router.ts (+3 -3)
📝 packages/vinext/src/server/app-page-route-wiring.tsx (+4 -0)
📝 tests/app-route-graph.test.ts (+53 -0)
📝 tests/entry-templates.test.ts (+73 -0)

📄 Description

What this changes

Implements #726-GRAPH-01 from #726 by having the existing App Router route graph mint stable semantic IDs for route, page, route handler, layout, template, and parallel slot facts.

The generated RSC manifest now carries those graph-owned IDs through route and slot metadata, but this PR intentionally does not promote planner decisions, root-boundary IDs, cache compatibility, or wire-key enforcement. Those are later #726-GRAPH-*, #726-CORE-*, and #726-WIRE-* tasks.

Why

The current flat payload bridge works, but route meaning is still reconstructed from route patterns, tree paths, and slot keys in later layers. For the #726 migration, topology identity needs to be a build-time graph fact before the planner and compatibility layers can stop treating wire keys as semantic authority.

Correctness oracle: Vinext internal invariant. Equivalent app filesystem topology should produce the same semantic IDs regardless of absolute filesystem root, while route groups and dynamic segment markers that affect topology must remain visible in graph IDs.

Approach

  • Added AppRouteSemanticIds to the existing route graph output.
  • Minted IDs from the existing graph facts: route pattern, page and route-handler presence, route segments, layout/template tree positions, and parallel slot ownership.
  • Added slot-level semantic IDs at discovery time and preserved the route ids plus slot id in generated App Router RSC route metadata.
  • Kept the constructors local for now because #726-GRAPH-01 only needs minted graph facts. Exporting canonical constructors can happen when a later PR has an actual import boundary for them.

Validation

  • vp test run tests/app-route-graph.test.ts tests/entry-templates.test.ts
  • vp check packages/vinext/src/routing/app-route-graph.ts packages/vinext/src/entries/app-rsc-manifest.ts packages/vinext/src/server/app-page-route-wiring.tsx tests/app-route-graph.test.ts tests/entry-templates.test.ts
  • vp run knip --no-progress
  • vp staged
  • vp test run tests/entry-templates.test.ts -u

Note: the pre-commit hook currently assumes tests/__snapshots__/entry-templates.test.ts.snap exists and fails when entry-template files are staged, even after the snapshot update test passes. I ran the hook checks above manually and committed with --no-verify for that broken hook path.

Risks / follow-ups

This PR preserves current runtime behavior. The new IDs are carried as metadata only; later #726 PRs still need to define root boundary IDs, RouteManifest read models, wire-key fences, planner contracts, and compatibility envelopes before semantic decisions move out of current runtime paths.

Refs #726


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/1060 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 5/5/2026 **Status:** ✅ Merged **Merged:** 5/5/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `nathan/726-graph-semantic-ids` --- ### 📝 Commits (1) - [`ebd6f72`](https://github.com/cloudflare/vinext/commit/ebd6f72eef684df58aa8673a4fc84cb11939f0f6) feat(app-router): mint semantic route graph ids ### 📊 Changes **6 files changed** (+266 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-manifest.ts` (+2 -0) 📝 `packages/vinext/src/routing/app-route-graph.ts` (+131 -14) 📝 `packages/vinext/src/routing/app-router.ts` (+3 -3) 📝 `packages/vinext/src/server/app-page-route-wiring.tsx` (+4 -0) 📝 `tests/app-route-graph.test.ts` (+53 -0) 📝 `tests/entry-templates.test.ts` (+73 -0) </details> ### 📄 Description ## What this changes Implements `#726-GRAPH-01` from #726 by having the existing App Router route graph mint stable semantic IDs for route, page, route handler, layout, template, and parallel slot facts. The generated RSC manifest now carries those graph-owned IDs through route and slot metadata, but this PR intentionally does not promote planner decisions, root-boundary IDs, cache compatibility, or wire-key enforcement. Those are later `#726-GRAPH-*`, `#726-CORE-*`, and `#726-WIRE-*` tasks. ## Why The current flat payload bridge works, but route meaning is still reconstructed from route patterns, tree paths, and slot keys in later layers. For the #726 migration, topology identity needs to be a build-time graph fact before the planner and compatibility layers can stop treating wire keys as semantic authority. Correctness oracle: Vinext internal invariant. Equivalent app filesystem topology should produce the same semantic IDs regardless of absolute filesystem root, while route groups and dynamic segment markers that affect topology must remain visible in graph IDs. ## Approach - Added `AppRouteSemanticIds` to the existing route graph output. - Minted IDs from the existing graph facts: route pattern, page and route-handler presence, route segments, layout/template tree positions, and parallel slot ownership. - Added slot-level semantic IDs at discovery time and preserved the route `ids` plus slot `id` in generated App Router RSC route metadata. - Kept the constructors local for now because `#726-GRAPH-01` only needs minted graph facts. Exporting canonical constructors can happen when a later PR has an actual import boundary for them. ## Validation - `vp test run tests/app-route-graph.test.ts tests/entry-templates.test.ts` - `vp check packages/vinext/src/routing/app-route-graph.ts packages/vinext/src/entries/app-rsc-manifest.ts packages/vinext/src/server/app-page-route-wiring.tsx tests/app-route-graph.test.ts tests/entry-templates.test.ts` - `vp run knip --no-progress` - `vp staged` - `vp test run tests/entry-templates.test.ts -u` Note: the pre-commit hook currently assumes `tests/__snapshots__/entry-templates.test.ts.snap` exists and fails when entry-template files are staged, even after the snapshot update test passes. I ran the hook checks above manually and committed with `--no-verify` for that broken hook path. ## Risks / follow-ups This PR preserves current runtime behavior. The new IDs are carried as metadata only; later #726 PRs still need to define root boundary IDs, RouteManifest read models, wire-key fences, planner contracts, and compatibility envelopes before semantic decisions move out of current runtime paths. Refs #726 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:47 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#1059
No description provided.