Files
DongHyeonka 4ab35c4a05
frontend-quality-gates / merge / static checks (pull_request) Successful in 2m50s
frontend-quality-gates / merge / tests (pull_request) Failing after 14m15s
frontend-quality-gates / merge / browser tests (pull_request) Successful in 10m29s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Skipped
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Skipped
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Skipped
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Skipped
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Skipped
frontend-quality-gates / external-vulnerability-provider (pull_request) Skipped
frontend-quality-gates / external-provenance-provider (pull_request) Skipped
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Skipped
frontend-quality-gates / deploy-promoted-release (pull_request) Skipped
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Skipped
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Skipped
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Skipped
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Skipped
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Skipped
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Skipped
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Skipped
frontend-quality-gates / main / checker self-tests (pull_request) Skipped
fix(test): 템플릿 시험이 사본에 만드는 기능 ID를 예약 접두어로 옮긴다
템플릿 시험과 드릴이 저장소 사본에 고정 ID로 기능을 만든다. 매뉴얼
코드 조각 시험은 매뉴얼 예시 invoice-feature를(FE-GATE-005), 생성 기능
e2e·청크 복구·부팅 실패 spec은 order-feature를(FE-GATE-008), scaffold
드릴은 scaffold-feature를(FE-GATE-020) 쓴다. 사본에는 제품 기능이 들어
있고 create:feature는 같은 ID나 같은 접두어를 거부한다. 그래서 매뉴얼
1단계 예시대로 invoice-feature를 만든 제품은 기능 코드와 상관없이 merge
게이트에서 막힌다.

고른 방법: 사본에 만드는 기능 ID를 모두 이미 정한 예약 접두어
typecheck-probe-로 옮기고 scripts/lib/template-probe-features.ts 한 곳에
둔다. 매뉴얼 조각은 invoice-feature 기준 그대로 두고, 시험이 조각과
검사 파일의 이름(INVOICE_, Invoice, invoice-, invoice)을 예약 기능의
이름으로 바꿔 넣는다(renameFeatureText). 생성 기능 e2e는 메시지 키와
계약 이름을 ID에서 만든다. 버린 대안: 사본에서 제품의 같은 이름
기능을 먼저 지우기(등록·조립 파일까지 지워야 해 사본이 제품과 달라진다),
create:feature가 흔한 이름을 거부하기(제품 이름을 막는다).

위험·한계: 이름 바꾸기는 낱말 단위 치환이라 조각의 영어 문장 속
invoice도 바뀐다(조각과 검사가 함께 바뀌어 결과는 같다). 제품이
typecheck-probe-로 시작하는 기능을 만들면 다시 부딪친다. 매뉴얼과
create-feature 참조에 쓰지 말라고 적었고 생성 명령이 막지는 않는다.
measure-feature-shape-growth의 s000-feature 꼴 ID는 그대로 뒀다.

검증: desktop에서 RED(이 커밋의 시험을 기준 커밋에 얹음)와 GREEN,
제품 상태(invoice-feature·order-feature를 만든 사본)의 FE-GATE-005·008
재현은 PR 본문에 적는다.

Refs: 1112/08-02
2026-11-12 22:32:09 +09:00

127 lines
5.2 KiB
TypeScript

import { spawnSync } from "node:child_process";
import { existsSync } from "node:fs";
import { mkdir, rm, writeFile } from "node:fs/promises";
import path from "node:path";
import { loadCiGateContract } from "./contracts/ci-gates.ts";
import {
SCAFFOLD_PROBE_FEATURE_ID,
SCAFFOLD_WRITE_PROBE_FEATURE_ID,
} from "./lib/template-probe-features.ts";
import {
runScaffoldDrillCommand,
scaffoldDrillCommands,
} from "./lib/feature-scaffold-drill.ts";
import {
createRemovalFixtureRoot,
prepareRemovalFixture,
REMOVAL_FIXTURE_COPY_TARGETS,
REMOVAL_FIXTURE_DOCUMENT_TARGETS,
renderRemovalJunit,
requireRemovalFixtureEnvironment,
runRemovalFixtureCheck,
sealRemovalFixtureRepository,
type RemovalCheck,
} from "./lib/removal-fixture.ts";
/**
* U7. A feature from `create:feature` passes the merge gates without an edit
* and breaks no other test. A copy of the repository, sample feature
* included, gets a default feature and a `--with-create --keyed` one, then
* runs the merge stage of its
* config/ci/gates.json: every command except those
* SCAFFOLD_DRILL_EXCLUDED_SCRIPTS names with a reason (the browser gates,
* test:system, the install check and the removal drills). 1103/12-02: this
* used to be a hand-kept list of 15 commands.
*
* 1103/16-02. The generated feature is then removed again with
* `test:sample-removal -- --feature=<id>`, the path the manual tells every
* product feature to take and that no gate ran.
*
* test:sample-removal repeats the generation after deleting the sample
* (decision 4), which proves the command needs nothing from it.
*/
/** 1112/08-02. Reserved probe ids: the copy holds the product's own features. */
const FEATURE_ID = SCAFFOLD_PROBE_FEATURE_ID;
/** 1103/09-06. The `--with-create --keyed` slice, in its own context. */
const WRITE_FEATURE_ID = SCAFFOLD_WRITE_PROBE_FEATURE_ID;
const REPORT = "artifacts/tests/feature-scaffold.xml";
const pnpmCli = requireRemovalFixtureEnvironment("npm_execpath");
const fixtureRoot = await createRemovalFixtureRoot("feature-scaffold");
function fixtureCommit(root: string): string {
const head = spawnSync("git", ["rev-parse", "HEAD"], { cwd: root, encoding: "utf8" });
if (head.status !== 0) throw new Error(`feature scaffold fixture has no commit: ${head.stderr}`);
return head.stdout.trim();
}
function check(name: string, script: string, extra: readonly string[] = []): RemovalCheck {
return runRemovalFixtureCheck(name, fixtureRoot, pnpmCli, script, extra);
}
try {
// verify:documentation and the documentation tests read these.
await prepareRemovalFixture(fixtureRoot, [
...REMOVAL_FIXTURE_COPY_TARGETS,
...REMOVAL_FIXTURE_DOCUMENT_TARGETS,
]);
const created = check("create-feature", "create:feature", [FEATURE_ID]);
const createdWrite = check("create-feature-write", "create:feature", [
WRITE_FEATURE_ID,
"--with-create",
"--keyed",
]);
const checks: RemovalCheck[] = [created, createdWrite];
if (created.passed && createdWrite.passed) {
// The generator's Next: 3. A project re-records the initial JavaScript
// with its features (config/scale/feature-shape-ceilings.json, which
// test:unit compares with a build) and commits it with them. A project
// that deleted the measurement has no record to keep.
const measurement = "scripts/scale/measure-feature-shape-growth.ts";
if (existsSync(path.join(fixtureRoot, measurement))) {
const recorded = spawnSync(process.execPath, [measurement, "--initial-baseline", "--write"], {
cwd: fixtureRoot,
stdio: "inherit",
}).status;
checks.push(
recorded === 0
? { name: "initial-javascript-record", passed: true }
: {
name: "initial-javascript-record",
passed: false,
failure: `node ${measurement} --initial-baseline --write exited ${recorded ?? "on a signal"}`,
},
);
}
// Commits the copy with the feature, as a project would: git-based
// checks (git grep, git ls-files) then see the feature's files.
sealRemovalFixtureRepository(fixtureRoot);
// build:release-candidate records the build's commit and refuses one that
// is not a commit ID. CI sets VITE_COMMIT_SHA for the whole workflow; a
// local run gets the copy's own sealed commit instead of "local".
if (!process.env["VITE_COMMIT_SHA"]?.trim()) {
process.env["VITE_COMMIT_SHA"] = fixtureCommit(fixtureRoot);
}
for (const command of scaffoldDrillCommands(await loadCiGateContract(fixtureRoot))) {
checks.push(runScaffoldDrillCommand(command, fixtureRoot, pnpmCli));
}
checks.push(check("feature-removal", "test:sample-removal", ["--", `--feature=${FEATURE_ID}`]));
}
const failed = checks.filter((entry) => !entry.passed);
await mkdir("artifacts/tests", { recursive: true });
await writeFile(REPORT, renderRemovalJunit("feature-scaffold", checks));
if (failed.length > 0) {
process.stderr.write(
`feature scaffold failed:\n${failed
.map((entry) => ` ${entry.name}: ${entry.failure ?? "failed"}`)
.join("\n")}\n`,
);
process.exitCode = 1;
} else {
process.stdout.write(`feature scaffold: PASS (${checks.length} checks)\n`);
}
} finally {
await rm(fixtureRoot, { recursive: true, force: true });
}