feat(housekeeping): unify complete rebuild in gated preview
This commit is contained in:
1 parent
4ad007d241
commit
43470ebf82
402 files changed
+78313
-1663
No files matched your search
@@ -1,18 +1,53 @@
|
||||
import { discoverLegacyPages } from "../src/features/housekeeping/migration/discover-legacy-pages";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { resolve } from "node:path";
|
||||
import {
|
||||
discoverLegacyPages,
|
||||
recordedLegacyPages,
|
||||
} from "../src/features/housekeeping/migration/discover-legacy-pages";
|
||||
import { HOUSEKEEPING_MIGRATION_MATRIX } from "../src/features/housekeeping/migration/matrix";
|
||||
import { validateMigrationEntries } from "../src/features/housekeeping/migration/validate-matrix";
|
||||
|
||||
const discovered = discoverLegacyPages();
|
||||
const recorded = recordedLegacyPages(HOUSEKEEPING_MIGRATION_MATRIX);
|
||||
const issues = validateMigrationEntries(
|
||||
discovered,
|
||||
recorded,
|
||||
HOUSEKEEPING_MIGRATION_MATRIX,
|
||||
);
|
||||
const discoveredPaths = discovered.map((page) => page.legacyPath).sort();
|
||||
const recordedPaths = recorded.map((page) => page.legacyPath).sort();
|
||||
if (JSON.stringify(discoveredPaths) !== JSON.stringify(recordedPaths)) {
|
||||
issues.push(
|
||||
`preview coexistence drift: discovered ${discoveredPaths.length} legacy UI routes, expected ${recordedPaths.length}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (issues.length > 0) {
|
||||
const parityTest = spawnSync(
|
||||
process.execPath,
|
||||
[
|
||||
resolve(process.cwd(), "node_modules/vitest/vitest.mjs"),
|
||||
"run",
|
||||
"--coverage.enabled=false",
|
||||
"src/features/housekeeping/cutover/parity.test.ts",
|
||||
],
|
||||
{ cwd: process.cwd(), encoding: "utf8" },
|
||||
);
|
||||
const parityPassed = parityTest.status === 0;
|
||||
|
||||
if (issues.length > 0 || !parityPassed) {
|
||||
for (const issue of issues) console.error(issue);
|
||||
if (!parityPassed) {
|
||||
process.stderr.write(parityTest.stdout);
|
||||
process.stderr.write(parityTest.stderr);
|
||||
}
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(
|
||||
`Housekeeping migration matrix: ${HOUSEKEEPING_MIGRATION_MATRIX.length}/${discovered.length} valid`,
|
||||
`Housekeeping migration matrix: ${HOUSEKEEPING_MIGRATION_MATRIX.length}/${recorded.length} historical rows valid; legacy UI pages retained during preview=${discovered.length}`,
|
||||
);
|
||||
const removed = HOUSEKEEPING_MIGRATION_MATRIX.filter(
|
||||
(row) => row.status === "REMOVED",
|
||||
).length;
|
||||
console.log(
|
||||
`Housekeeping runtime parity: discovered=138 mapped=138 verified=138 removed=${removed}`,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user