fix(reference): move the detail route under items/ (08-13)
The detail path /examples/reference-resources/:resourceId lost to the static new and status routes, so an item with one of those ids opened the wrong screen. The breaking route change carries registry evidence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cef6744299
commit
d7b81c633d
@@ -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.",
|
"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.",
|
"rollback": "Restore the previous telemetryEvent string on QUERY_CACHE_FAILURE in src/contracts/errors.ts and widen ErrorObservationEvent back to string.",
|
||||||
"owner": "frontend-platform"
|
"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/<id> 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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ export const REFERENCE_FEATURE_CONTRACT = Object.freeze({
|
|||||||
}),
|
}),
|
||||||
REFERENCE_RESOURCE_DETAIL: Object.freeze({
|
REFERENCE_RESOURCE_DETAIL: Object.freeze({
|
||||||
routeId: "REFERENCE_RESOURCE_DETAIL",
|
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",
|
paramsSchema: "ReferenceResourceParams",
|
||||||
searchSchema: null,
|
searchSchema: null,
|
||||||
access: "session-required",
|
access: "session-required",
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export default function ReferenceResourcePage() {
|
|||||||
{(query.data ?? []).map((resource) => (
|
{(query.data ?? []).map((resource) => (
|
||||||
<li key={resource.resourceId}>
|
<li key={resource.resourceId}>
|
||||||
<Link
|
<Link
|
||||||
to={`/examples/reference-resources/${encodeURIComponent(resource.resourceId)}`}
|
to={`/examples/reference-resources/items/${encodeURIComponent(resource.resourceId)}`}
|
||||||
>
|
>
|
||||||
{resource.title}
|
{resource.title}
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ describe("installed context routing", () => {
|
|||||||
const routes = await context!.loadRoutes();
|
const routes = await context!.loadRoutes();
|
||||||
expect(routes.map((route) => [route.id, route.path])).toEqual([
|
expect(routes.map((route) => [route.id, route.path])).toEqual([
|
||||||
["REFERENCE_RESOURCE_LIST", "/examples/reference-resources"],
|
["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_FORM", "/examples/reference-resources/new"],
|
||||||
["REFERENCE_RESOURCE_STATUS", "/examples/reference-resources/status"],
|
["REFERENCE_RESOURCE_STATUS", "/examples/reference-resources/status"],
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ describe("reference feature page states", () => {
|
|||||||
|
|
||||||
const detail = renderReference(
|
const detail = renderReference(
|
||||||
inputWith(),
|
inputWith(),
|
||||||
"/examples/reference-resources/reference-1",
|
"/examples/reference-resources/items/reference-1",
|
||||||
);
|
);
|
||||||
await screen.findByText("Detail");
|
await screen.findByText("Detail");
|
||||||
const detailKey = detail.client.getQueryCache().getAll()[0]?.queryKey;
|
const detailKey = detail.client.getQueryCache().getAll()[0]?.queryKey;
|
||||||
@@ -247,6 +247,36 @@ describe("reference feature page states", () => {
|
|||||||
expect(resultCount()).toBeNull();
|
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 () => {
|
it("renders backend forbidden even when the client access hint allowed entry", async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
renderReference(
|
renderReference(
|
||||||
|
|||||||
Reference in New Issue
Block a user