fix: harden routed lifecycle guards

This commit is contained in:
lda
2026-08-04 23:41:36 +07:00 Verified
parent f14d9f1278
commit d6f8b44001
8 changed files with 507 additions and 127 deletions
@@ -117,6 +117,31 @@ describe("LifecycleRoute", () => {
expect(currentController.selectArtifact).not.toHaveBeenCalled();
});
it("suppresses stale detail synchronously until it matches the URL identity", () => {
const currentController = controller({
...emptyState(),
selectedArtifactId: "old@1",
artifactDetail: {
artifactId: "old",
version: 1,
title: "Old artifact",
kind: "workflow",
description: null,
outcomes: [],
plan: { nodes: [], edges: [] },
requiredCapabilities: [],
workflowDependencies: {},
createdFromCatalogVersion: null,
},
});
mockUseLifecycleExplorer.mockReturnValue(currentController);
renderRoute("/console/artifacts/report/2");
expect(screen.queryByText("Old artifact")).toBeNull();
expect(currentController.selectArtifact).toHaveBeenCalledWith("report@2");
});
it("navigates to the canonical detail URL before selection follows it", async () => {
const currentController = controller({
...emptyState(),