diff --git a/config/contracts/registry-change-evidence.json b/config/contracts/registry-change-evidence.json index 0329c0a2..c0b92d8b 100644 --- a/config/contracts/registry-change-evidence.json +++ b/config/contracts/registry-change-evidence.json @@ -104,6 +104,14 @@ "compatibilityWindow": "No wire, storage or runtime-config format changes: the old id was never emitted by any producer, so no consumer could observe it.", "rollback": "Restore the previous telemetryEvent string on QUERY_CACHE_FAILURE in src/contracts/errors.ts and widen ErrorObservationEvent back to string.", "owner": "frontend-platform" + }, + { + "changeId": "FE-REG-ROUTE:REFERENCE_RESOURCE_DETAIL:path:field-changed", + "versionBump": "The reference detail route moves from /examples/reference-resources/:resourceId to /examples/reference-resources/items/:resourceId (maturity review 08-13), so a server id equal to the static segments new or status opens its detail instead of the form or status screen.", + "migration": "The only in-app link (reference-resource-page.tsx) builds the new path from the contract route. The reference feature is a sample; downstream features that copied it keep their own paths.", + "compatibilityWindow": "None for bookmarked sample detail URLs: an old /examples/reference-resources/ URL no longer matches the detail route; new and status keep opening the form and status screens.", + "rollback": "Restore the previous path in src/features/reference-feature/contracts/reference-feature-contract.ts and the link in reference-resource-page.tsx, then drop this entry.", + "owner": "frontend-platform" } ] } diff --git a/src/features/reference-feature/contracts/reference-feature-contract.ts b/src/features/reference-feature/contracts/reference-feature-contract.ts index 3bac006e..fb06ea59 100644 --- a/src/features/reference-feature/contracts/reference-feature-contract.ts +++ b/src/features/reference-feature/contracts/reference-feature-contract.ts @@ -88,7 +88,8 @@ export const REFERENCE_FEATURE_CONTRACT = Object.freeze({ }), REFERENCE_RESOURCE_DETAIL: Object.freeze({ routeId: "REFERENCE_RESOURCE_DETAIL", - path: "/examples/reference-resources/:resourceId", + // 08-13. `items/` keeps an id such as `new` or `status` off the static routes. + path: "/examples/reference-resources/items/:resourceId", paramsSchema: "ReferenceResourceParams", searchSchema: null, access: "session-required", diff --git a/src/features/reference-feature/presentation/reference-resource-page.tsx b/src/features/reference-feature/presentation/reference-resource-page.tsx index 2658a55a..16b04572 100644 --- a/src/features/reference-feature/presentation/reference-resource-page.tsx +++ b/src/features/reference-feature/presentation/reference-resource-page.tsx @@ -63,7 +63,7 @@ export default function ReferenceResourcePage() { {(query.data ?? []).map((resource) => (
  • {resource.title} diff --git a/tests/features/reference-feature/installed-context-routing.test.ts b/tests/features/reference-feature/installed-context-routing.test.ts index 64b98ec1..ac16c22f 100644 --- a/tests/features/reference-feature/installed-context-routing.test.ts +++ b/tests/features/reference-feature/installed-context-routing.test.ts @@ -16,7 +16,7 @@ describe("installed context routing", () => { const routes = await context!.loadRoutes(); expect(routes.map((route) => [route.id, route.path])).toEqual([ ["REFERENCE_RESOURCE_LIST", "/examples/reference-resources"], - ["REFERENCE_RESOURCE_DETAIL", "/examples/reference-resources/:resourceId"], + ["REFERENCE_RESOURCE_DETAIL", "/examples/reference-resources/items/:resourceId"], ["REFERENCE_RESOURCE_FORM", "/examples/reference-resources/new"], ["REFERENCE_RESOURCE_STATUS", "/examples/reference-resources/status"], ]); diff --git a/tests/features/reference-feature/reference-page.test.tsx b/tests/features/reference-feature/reference-page.test.tsx index 2c0da30f..a9e69d67 100644 --- a/tests/features/reference-feature/reference-page.test.tsx +++ b/tests/features/reference-feature/reference-page.test.tsx @@ -147,7 +147,7 @@ describe("reference feature page states", () => { const detail = renderReference( inputWith(), - "/examples/reference-resources/reference-1", + "/examples/reference-resources/items/reference-1", ); await screen.findByText("Detail"); const detailKey = detail.client.getQueryCache().getAll()[0]?.queryKey; @@ -247,6 +247,36 @@ describe("reference feature page states", () => { expect(resultCount()).toBeNull(); }); + // 08-13. A server id equal to a static segment still opens its detail. + it.each(["new", "status"])( + "opens the detail screen for an item whose id is %s", + async (resourceId) => { + const user = userEvent.setup(); + const getResource = vi.fn(async (id: string) => ({ + ok: true as const, + value: { resourceId: id, title: "Detail", createdAt: null }, + })); + renderReference( + inputWith({ + listResources: async () => ({ + ok: true, + value: [ + { resourceId, title: `Item ${resourceId}`, createdAt: null }, + ], + }), + getResource, + }), + ); + await user.click( + await screen.findByRole("link", { name: `Item ${resourceId}` }), + ); + expect( + await screen.findByRole("heading", { level: 1, name: "Detail" }), + ).toBeVisible(); + expect(getResource.mock.calls[0]?.[0]).toBe(resourceId); + }, + ); + it("renders backend forbidden even when the client access hint allowed entry", async () => { const user = userEvent.setup(); renderReference(