ReviewOS

home-lang/home

fix(router): normalize asset-prefixed scriptSrc with one origin separator

#730
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Parent: #66.

Bun.FileSystemRouter constructs MatchedRoute.src through URL.joinWrite. Home's local normalizeURLPath always prefixes the normalized result with /, while Bun's live URL::join_normalize delegates to relative normalize_string_buf. joinWrite then writes the origin plus its own /, so Home produces https://nextjs.org//_next/static/posts/[id].tsx instead of Bun's https://nextjs.org/_next/static/posts/[id].tsx.

Port the relative normalization result and adjust the direct URL.joinNormalize oracle. Verify dot-segment collapse and full joinWrite output with an origin and slash-delimited asset prefix. Audit the only callers so bundler public paths retain one separator.

Acceptance keeps the unchanged filesystem-router assertion and existing URL tests green without trimming the final string at the call site.

9 days ago

Published 81cb9e9d5 to origin/main, authored by glennmichael123 <gtorregosa@gmail.com> without coauthors. The commit references #730 and #66.

Home's URL join normalization now returns the same relative path shape as Bun's live normalize_string_buf, so the origin supplies exactly one separator. The direct oracle now verifies https://nextjs.org/_next/static/posts/[id].tsx, including a slash-delimited asset prefix and dot-segment normalization.

Focused verification compiled the URL module and passed all 13 URL/bitset tests. zig fmt --check and git diff --check passed. Supervisor peak was 174 MB.

The unchanged filesystem-router acceptance run against a newly linked runtime remains pending because the sequential debug link exceeded both conservative memory ceilings earlier in this session. The old binary reproduced the exact double-slash failure before this patch. This issue remains open until a fresh-runtime corpus run confirms it.

9 days ago

Verified complete on current origin/main at 2e2b71edde.

Implementation is in 81cb9e9d5. The direct URL.joinNormalize/joinWrite oracle is present in the native source, and the fresh unchanged filesystem_router.test.ts run exercises the production path: assetPrefix, src, and origin passes with the exact one-separator https://nextjs.org/_next/static/posts/[id].tsx assertion.

The complete file finishes 22 pass / 1 upstream skip / 0 fail with 1,500 assertions under its original five-second test deadline. No final-string trimming, test edit, retry, or deadline change was used. Closing as completed; parent #66 remains open for full parity.

Sign in to comment on this issue.