chore(review): 1106 테스트 기반 조치 브랜치를 합친다
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
bundlePerformanceArtifactSchema,
|
||||
} from "./contracts/release-artifacts.ts";
|
||||
import { classifyViteJavascript } from "./lib/classify-vite-bundle.ts";
|
||||
import { checkoutBuildReadFailure } from "./lib/run-isolation.ts";
|
||||
import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts";
|
||||
|
||||
type ViteManifest = Record<
|
||||
@@ -21,6 +22,16 @@ type BundleBudgets = {
|
||||
lazyChunkGzipBytes: number;
|
||||
};
|
||||
|
||||
// 1106/12-02. This reads dist/.vite/manifest.json and the inventory
|
||||
// scripts/generate-supply-chain.ts made of dist. Under RUN_OUTPUT_ROOT the
|
||||
// build wrote elsewhere, and this passed a build over budget on the earlier
|
||||
// one the checkout still held.
|
||||
const outputRootFailure = checkoutBuildReadFailure("scripts/check-bundle.ts");
|
||||
if (outputRootFailure !== undefined) {
|
||||
process.stderr.write(`${outputRootFailure}\n`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const report = bundleOutputInventoryArtifactSchema.parse(
|
||||
JSON.parse(await readFile("artifacts/performance/bundle.json", "utf8")) as unknown,
|
||||
);
|
||||
|
||||
@@ -39,8 +39,18 @@ import {
|
||||
parseRepositoryFileInventoryPolicy,
|
||||
} from "./lib/repository-file-inventory.ts";
|
||||
import { collectDistOutputs, distSha256 } from "./lib/release-candidate.ts";
|
||||
import { checkoutBuildReadFailure } from "./lib/run-isolation.ts";
|
||||
import { deterministicSupplyChainGeneratedAt } from "./lib/supply-chain-time.ts";
|
||||
|
||||
// 1106/12-02. This reads artifacts/release/build-manifest.json and dist where
|
||||
// the checkout keeps them. Under RUN_OUTPUT_ROOT the build wrote elsewhere,
|
||||
// and this recorded the earlier build the checkout still held.
|
||||
const outputRootFailure = checkoutBuildReadFailure("scripts/generate-supply-chain.ts");
|
||||
if (outputRootFailure !== undefined) {
|
||||
process.stderr.write(`${outputRootFailure}\n`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
type Document = Record<string, unknown>;
|
||||
|
||||
function isRecord(value: unknown): value is Document {
|
||||
|
||||
@@ -66,13 +66,19 @@ export const REMOVAL_FIXTURE_DOCUMENT_TARGETS = Object.freeze([
|
||||
* CHANGELOG.md, whatever the removal did. prepareRemovalFixture deletes them
|
||||
* from such a fixture, and the repository's own test:unit keeps running them.
|
||||
* This is the only list; the sample drill used to keep the exclusion to itself.
|
||||
*
|
||||
* 1106/12-01. The unit is a file, so every test in a listed file reads the
|
||||
* documents. A test that reads none goes in another file: listing a file for
|
||||
* one document test took the file's other tests out of those drills too.
|
||||
*/
|
||||
export const REMOVAL_FIXTURE_DOCUMENT_TESTS = Object.freeze([
|
||||
"tests/unit/changelog-review-ids.test.ts",
|
||||
"tests/unit/documentation-readiness.test.ts",
|
||||
// 1105/03-01. Reads the 6.1 table of the frontend contract document.
|
||||
"tests/unit/backend-contract-pin.test.ts",
|
||||
// 1105/16-01. Reads the 03 manual and docs/architecture/starter-experience.md.
|
||||
// 1105/03-01. Reads the 6.1 table of the frontend contract document; the
|
||||
// pin checks that read none are in backend-contract-pin.test.ts.
|
||||
"tests/unit/backend-contract-pin-document.test.ts",
|
||||
// 1105/16-01. Reads the 03 manual and docs/architecture/starter-experience.md;
|
||||
// the generator's list is checked in feature-tracked-file-rewrites.test.ts.
|
||||
"tests/unit/feature-tracked-files.test.ts",
|
||||
// 1105/14-01
|
||||
"tests/unit/template-feature-removal-documents.test.ts",
|
||||
|
||||
@@ -82,6 +82,34 @@ export function runOutputPath(
|
||||
return path.posix.join(runOutputRoot(environment), relativePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1106/12-02. Why `step`, which reads the build where the checkout keeps it
|
||||
* (`dist/`, the build manifest and the evidence under `artifacts/`), must not
|
||||
* run in this environment; `undefined` when it may. With RUN_OUTPUT_ROOT set
|
||||
* the build writes under that folder, so such a step would judge whatever
|
||||
* build the checkout still holds: check:bundle passed an over-budget build
|
||||
* that way, on the earlier one. `.` is the checkout itself, which is what a
|
||||
* Playwright config hands its web server without a run ID.
|
||||
*/
|
||||
export function checkoutBuildReadFailure(
|
||||
step: string,
|
||||
environment: Environment = process.env,
|
||||
): string | undefined {
|
||||
let root: string;
|
||||
try {
|
||||
root = runOutputRoot(environment);
|
||||
} catch (error) {
|
||||
return `${step}: ${error instanceof Error ? error.message : String(error)}`;
|
||||
}
|
||||
if (root === ".") return undefined;
|
||||
return (
|
||||
`${step} reads the build at this checkout's paths (dist/, artifacts/), but ` +
|
||||
`${RUN_OUTPUT_ROOT_VARIABLE}=${root} makes the build write under ${root}/, so it ` +
|
||||
`would judge an earlier build. Unset ${RUN_OUTPUT_ROOT_VARIABLE}, build again and ` +
|
||||
`run ${step} again.`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The port variable of each Playwright config's web server. Unset, the config
|
||||
* picks a free port; set, it uses that one (to pin a port while debugging).
|
||||
|
||||
@@ -131,9 +131,16 @@ try {
|
||||
}
|
||||
await writeFile(catalogPath, `${JSON.stringify(catalog, null, 2)}\n`);
|
||||
|
||||
await rm(path.join(fixtureRoot, "playwright.capabilities.config.ts"), {
|
||||
force: true,
|
||||
});
|
||||
// 1106/10-01. The capabilities config goes with this runtime, and so do its
|
||||
// run-isolation checks, by name: the template's test:unit runs them, this
|
||||
// copy has nothing for them to check. Without `force`, so a renamed file
|
||||
// stops the drill here instead of failing its typecheck later.
|
||||
for (const capabilityConfigFile of [
|
||||
"playwright.capabilities.config.ts",
|
||||
"tests/unit/playwright-capabilities-run-isolation.test.ts",
|
||||
]) {
|
||||
await rm(path.join(fixtureRoot, capabilityConfigFile));
|
||||
}
|
||||
await rm(
|
||||
path.join(fixtureRoot, "scripts/check-browser-file-storage-boundaries.ts"),
|
||||
{ force: true },
|
||||
|
||||
Reference in New Issue
Block a user