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>
108 lines
3.4 KiB
TypeScript
108 lines
3.4 KiB
TypeScript
import {
|
|
mkdir,
|
|
readFile,
|
|
rm,
|
|
writeFile,
|
|
} from "node:fs/promises";
|
|
import path from "node:path";
|
|
|
|
import {
|
|
filesBelow,
|
|
prepareRemovalFixture,
|
|
pruneRemovalFixtureCiContract,
|
|
pruneScriptOrchestration,
|
|
regenerateRemovalFixtureWorkflow,
|
|
requireRemovalFixtureEnvironment,
|
|
runRemovalFixturePnpm,
|
|
} from "./lib/removal-fixture.ts";
|
|
|
|
const fixtureRoot = path.resolve(".tmp/optional-recipe-removal");
|
|
const pnpmCli = requireRemovalFixtureEnvironment("npm_execpath");
|
|
|
|
function runPnpm(script: string): boolean {
|
|
return runRemovalFixturePnpm(fixtureRoot, pnpmCli, script);
|
|
}
|
|
|
|
await prepareRemovalFixture(fixtureRoot);
|
|
for (const rootOnlyTest of [
|
|
"tests/unit/ci-workflow-generation.test.ts",
|
|
"tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap",
|
|
]) {
|
|
await rm(path.join(fixtureRoot, rootOnlyTest), { force: true });
|
|
}
|
|
await rm(path.join(fixtureRoot, "recipes"), { recursive: true, force: true });
|
|
await rm(path.join(fixtureRoot, "tests/recipes"), {
|
|
recursive: true,
|
|
force: true,
|
|
});
|
|
|
|
const removedCiScripts = new Set([
|
|
"check:types:recipes",
|
|
"test:recipes",
|
|
"check:optional-recipes",
|
|
"check:optional-recipes:source",
|
|
"check:optional-recipe-fixtures",
|
|
"test:optional-recipe-removal",
|
|
]);
|
|
const fixturePackagePath = path.join(fixtureRoot, "package.json");
|
|
const fixturePackage = JSON.parse(await readFile(fixturePackagePath, "utf8")) as {
|
|
scripts: Record<string, string>;
|
|
};
|
|
pruneScriptOrchestration(fixturePackage.scripts, "check:types", removedCiScripts);
|
|
pruneScriptOrchestration(fixturePackage.scripts, "test:all", removedCiScripts);
|
|
await writeFile(fixturePackagePath, `${JSON.stringify(fixturePackage, null, 2)}\n`);
|
|
await pruneRemovalFixtureCiContract({
|
|
root: fixtureRoot,
|
|
removedScripts: removedCiScripts,
|
|
removedEvidencePathFragments: [
|
|
"optional-recipes",
|
|
"optional-recipe-fixtures",
|
|
"optional-recipe-removal",
|
|
],
|
|
});
|
|
await regenerateRemovalFixtureWorkflow(fixtureRoot);
|
|
|
|
const checks: Array<[string, boolean]> = [
|
|
["typecheck", runPnpm("check:types")],
|
|
["architecture", runPnpm("check:architecture")],
|
|
["test", runPnpm("test:all")],
|
|
["build", runPnpm("build")],
|
|
["ci-contract", runPnpm("check:ci")],
|
|
];
|
|
const residue: string[] = [];
|
|
for (const file of await filesBelow(path.join(fixtureRoot, "dist"))) {
|
|
if (!/\.(?:js|css|html|json)$/.test(file)) continue;
|
|
const content = await readFile(file, "utf8");
|
|
if (content.includes("frontend-optional-recipe-must-not-reach-production")) {
|
|
residue.push(path.relative(fixtureRoot, file));
|
|
}
|
|
}
|
|
checks.push(["bundle-residue", residue.length === 0]);
|
|
const passed = checks.every(([, result]) => result);
|
|
await mkdir("artifacts/tests", { recursive: true });
|
|
await writeFile(
|
|
"artifacts/tests/optional-recipe-removal.xml",
|
|
`<?xml version="1.0" encoding="UTF-8"?>\n` +
|
|
`<testsuite name="optional-recipe-removal" tests="${checks.length}" failures="${passed ? 0 : 1}">` +
|
|
checks
|
|
.map(
|
|
([name, result]) =>
|
|
`<testcase name="${name}">${result ? "" : `<failure>${residue.join(", ")}</failure>`}</testcase>`,
|
|
)
|
|
.join("") +
|
|
`</testsuite>\n`,
|
|
);
|
|
await rm(fixtureRoot, { recursive: true, force: true });
|
|
if (!passed) {
|
|
process.stderr.write(
|
|
`Optional recipe removal failed: ${checks
|
|
.filter(([, result]) => !result)
|
|
.map(([name]) => name)
|
|
.join(", ")}\n`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
process.stdout.write(
|
|
`Optional recipe removal: PASS (${checks.length} base checks)\n`,
|
|
);
|