From 0435fcdf2dd866e7ef53c7e9b88bd4587cb29371 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Mon, 16 Nov 2026 00:11:28 -0500 Subject: [PATCH] Record that a guest document reads its frame's virtual path A guest page's location is /~/@/http//..., not the path its server was asked for, so a client router matches the wrong path. React Router hydrates its server-rendered home route into the 404, and react-router.spec.ts passes only when its poll reads #hi in the ~0.5 s before hydration. The spec is a fixme until a guest document gets its own path, which needs a design choice: the shim rewriting the URL, or an origin per guest server. --- packages/kernel/tests/http-routing.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/kernel/tests/http-routing.spec.ts b/packages/kernel/tests/http-routing.spec.ts index e8cf86c..b3d4461 100644 --- a/packages/kernel/tests/http-routing.spec.ts +++ b/packages/kernel/tests/http-routing.spec.ts @@ -29,6 +29,21 @@ test("an absolute link navigates the iframe inside the prefix", async ({ page }) expect(frame && new URL(frame.url()).pathname).toBe(`${await appUrl(page)}about`); }); +// A guest document's location is the frame's virtual URL, so its scripts read +// /~/@/http// where the server was asked for /. A client router matches +// that path: React Router hydrates the server-rendered home route into its 404, which +// is why tests/react-router.spec.ts passes only when it reads #hi before hydration. +// Fixing this means choosing how a guest document gets its own path (the shim +// rewriting its URL, or an origin per guest server), so it is recorded, not fixed. +test.fixme("a guest document's location is the path its server was asked for", async ({ page }) => { + await bootServer(page); + const app = page.frameLocator("#app"); + expect(await app.locator(":root").evaluate(() => location.pathname)).toBe("/"); + await app.locator("#about").click(); + await expect(app.locator("#about-h")).toHaveText("About"); + expect(await app.locator(":root").evaluate(() => location.pathname)).toBe("/about"); +}); + test("a form POST to an absolute action keeps its method and body", async ({ page }) => { await bootServer(page); await page.frameLocator("#app").locator("#f button").click(); -- knotmirror 0.0.1