chore: sync the frontend template from a0fbafb to 5434760
Carries eight template commits: the provider sandbox actually running, release
admission to a named environment, the product feature manifest with its runtime
kill switch, architecture and documentation rules that match what is enforced,
the removability fixtures, and the browser, visual and performance evidence.
Product identity is unchanged. `package.json` keeps `tech-log-frontend` and the
catalog keeps the Tech Log naming; the home page was not in the delta. The
visual baselines are this product's own — the template's were excluded from the
transplant and these were regenerated here, where the only difference is the
platform overview's new product-feature section.
What this repository gains operationally: `config/runtime/{local,development,
staging,production}.json` with `FE-GATE-027` refusing an artifact whose runtime
document does not match the environment it is being admitted to, and
`FEATURE_OVERRIDES` for taking an installed feature out of service without a
rebuild.
Verified here: eight gates green, build green, visual 5/5, and 1,858 of 1,859
tests in the suites that do not need a sandbox — the one failure passes in
isolation and is a jsdom lazy-chunk timeout under parallel load. The provider
suites cannot run on this machine at all: `kernel.apparmor_restrict_unprivileged
_userns=1` makes `bwrap --unshare-net` fail, reproducible without any code from
either repository.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
325a2a0843
commit
bdee07a93b
@@ -0,0 +1,83 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createAnonymousSessionAdapter } from "../../src/adapters/auth/external-session-adapter.ts";
|
||||
import { ROUTE_REGISTRY } from "../../src/features/installed-feature-contracts.ts";
|
||||
import { INSTALLED_PRODUCT_FEATURE_IDS } from "../../src/features/installed-product-manifest.ts";
|
||||
import { ApplicationProvider } from "../../src/presentation/providers/application-provider.tsx";
|
||||
import { AppRouter } from "../../src/presentation/routes/app-router.tsx";
|
||||
import { createTestApplication } from "../helpers/create-test-application.ts";
|
||||
import { createProductFeaturesStub } from "../helpers/runtime-capabilities-stub.ts";
|
||||
|
||||
/**
|
||||
* §3.5. The runtime kill switch, exercised through the running app rather than
|
||||
* through the resolver that computes it.
|
||||
*
|
||||
* Withdrawing a feature from navigation is not the same as taking it out of
|
||||
* service: a typed deep link would still mount it. Both halves are asserted
|
||||
* here, on the same render, so the switch cannot be half-wired.
|
||||
*/
|
||||
|
||||
const FEATURE_ID = INSTALLED_PRODUCT_FEATURE_IDS[0]!;
|
||||
const FEATURE_ROUTE = ROUTE_REGISTRY.REFERENCE_RESOURCE_LIST;
|
||||
|
||||
function renderAt(path: string, disabled: boolean) {
|
||||
window.history.pushState({}, "", path);
|
||||
return render(
|
||||
<ApplicationProvider
|
||||
application={createTestApplication({
|
||||
session: createAnonymousSessionAdapter(),
|
||||
...(disabled
|
||||
? {
|
||||
productFeatures: createProductFeaturesStub({
|
||||
[FEATURE_ID]: "DISABLED_BY_CONFIG",
|
||||
}),
|
||||
}
|
||||
: {}),
|
||||
})}
|
||||
>
|
||||
<AppRouter />
|
||||
</ApplicationProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
describe("runtime product feature switch", () => {
|
||||
it("advertises the feature's route while the feature is active", async () => {
|
||||
renderAt("/", false);
|
||||
expect(
|
||||
await screen.findByRole("link", { name: FEATURE_ROUTE.navigationLabel! }),
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
it("withdraws the feature's route from navigation when it is disabled", async () => {
|
||||
renderAt("/", true);
|
||||
// The shell itself still renders: disabling a feature is not an outage.
|
||||
expect(await screen.findByRole("navigation")).toBeTruthy();
|
||||
expect(
|
||||
screen.queryByRole("link", { name: FEATURE_ROUTE.navigationLabel! }),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("takes the feature out of service for a direct deep link", async () => {
|
||||
renderAt(FEATURE_ROUTE.path, true);
|
||||
const surface = await screen.findByText(
|
||||
(_, element) =>
|
||||
element?.getAttribute("data-disabled-feature") === FEATURE_ID,
|
||||
{},
|
||||
{ timeout: 5000 },
|
||||
);
|
||||
expect(surface).toBeTruthy();
|
||||
});
|
||||
|
||||
it("serves the same deep link while the feature is active", async () => {
|
||||
renderAt(FEATURE_ROUTE.path, false);
|
||||
expect(
|
||||
screen.queryByText(
|
||||
(_, element) =>
|
||||
element?.getAttribute("data-disabled-feature") === FEATURE_ID,
|
||||
),
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user