Merge pull request 'fix(r9): 업로드 401을 주인에게 보내고 짝 계약 pin과 SW 제품 칸을 고친다' (#53) from donghyeon.kang/r9-credential-contract-sw into main
frontend-quality-gates / merge / static checks (push) Successful in 1m29s
frontend-quality-gates / merge / browser tests (push) Canceled after 0s
frontend-quality-gates / FE-GATE-014 / config-compatibility (push) Canceled after 0s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (push) Canceled after 0s
frontend-quality-gates / FE-GATE-026 / lab-performance (push) Canceled after 0s
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (push) Canceled after 0s
frontend-quality-gates / external-vulnerability-provider (push) Canceled after 0s
frontend-quality-gates / external-provenance-provider (push) Canceled after 0s
frontend-quality-gates / promote-verified-immutable-candidate (push) Canceled after 0s
frontend-quality-gates / deploy-promoted-release (push) Canceled after 0s
frontend-quality-gates / FE-GATE-019 / hosting-header (push) Canceled after 0s
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (push) Canceled after 0s
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (push) Canceled after 0s
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (push) Canceled after 0s
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (push) Canceled after 0s
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (push) Canceled after 0s
frontend-quality-gates / FE-GATE-018 / field-web-vitals (push) Canceled after 0s
frontend-quality-gates / FE-GATE-017 / diagram-review (push) Canceled after 0s
frontend-quality-gates / main / self-tests and removal drills (push) Canceled after 0s
frontend-quality-gates / merge / tests (push) Canceled after 6m1s

This commit was merged in pull request #53.
This commit is contained in:
2026-11-13 18:03:45 +00:00
35 changed files with 1276 additions and 271 deletions
+27 -8
View File
@@ -23,13 +23,16 @@ import {
* (`backend.scaffoldSources`) that `create:feature --with-create` copies
* four facts from (path plural rule, name limit, error codes, check
* order). Each changed file names the frontend copy to recheck.
* 5. 1105/01-02: nor have the backend code files (`backend.codeSources`)
* the frontend reads a code table from, such as the Fileserver codes the
* upload client reads as refused before publishing.
*
* corepack pnpm check:backend-contract-drift [--backend <dir>] [--write-excerpt]
*
* `--write-excerpt` copies the excerpt from the pinned commit first: run it
* after moving the pin, then fix the answer table until this passes.
*
* Exit 0: all four hold. Exit 1: one does not; the output names the rows or
* Exit 0: all five hold. Exit 1: one does not; the output names the rows or
* files. Recheck the frontend contract 6.1 table, the answer table, the
* excerpt, the generator copies and the pin in one change. Exit 2: nothing
* was compared (no checkout, or the pinned commit or document is missing),
@@ -46,12 +49,15 @@ type ScaffoldSource = Readonly<{
copiedTo: Readonly<{ file: string; symbol: string }>;
}>;
type CodeSource = ScaffoldSource & Readonly<{ codes?: readonly string[] }>;
type Pin = Readonly<{
backend: Readonly<{
repository: string;
commit: string;
document: string;
scaffoldSources?: readonly ScaffoldSource[];
codeSources?: readonly CodeSource[];
}>;
tables: Readonly<{ idempotencyAnswers: string; backendExcerpt: string }>;
notCopied: readonly NotCopiedRow[];
@@ -103,6 +109,7 @@ function main(): void {
const directory = backendDirectory(pin);
const { commit, document } = pin.backend;
const scaffoldSources = pin.backend.scaffoldSources ?? [];
const codeSources = pin.backend.codeSources ?? [];
if (!existsSync(path.join(directory, ".git"))) {
cannotCompare(
`No ${pin.backend.repository} checkout at ${directory}; pass --backend <dir>. test:unit holds the answer table to ${pin.tables.backendExcerpt}, and only this script holds that copy to the backend.`,
@@ -136,6 +143,13 @@ function main(): void {
}
const excerpt = readJson<Excerpt>(pin.tables.backendExcerpt);
const failures: string[] = [];
// A copied source the pinned commit does not have is a path the pin got
// wrong (a moved file), and a diff against HEAD would read it as deleted.
for (const source of [...scaffoldSources, ...codeSources]) {
if (git(directory, "cat-file", "-e", `${commit}:${source.path}`).status !== 0) {
failures.push(`${source.path} is not in the pinned ${commit.slice(0, 12)}: fix its path in ${PIN_PATH}`);
}
}
const source = excerpt.source;
if (source.repository !== pin.backend.repository || source.commit !== commit || source.document !== document) {
@@ -167,14 +181,19 @@ function main(): void {
}
}
// 1105/16-02. The generator's copies of backend scaffold facts.
for (const scaffold of scaffoldSources) {
const scaffoldDiff = git(directory, "diff", "--unified=0", `${commit}..HEAD`, "--", scaffold.path);
if (scaffoldDiff.stdout.trim() === "") continue;
// 1105/01-02. The frontend's copies of backend code tables.
const sources = [
...scaffoldSources.map((source) => ({ source, kind: "scaffold", reader: "the generator" })),
...codeSources.map((source) => ({ source, kind: "code", reader: "the frontend" })),
];
for (const { source, kind, reader } of sources) {
const sourceDiff = git(directory, "diff", "--unified=0", `${commit}..HEAD`, "--", source.path);
if (sourceDiff.stdout.trim() === "") continue;
failures.push(
`scaffold source ${scaffold.path} changed between the pin ${commit.slice(0, 12)} and HEAD ${headCommit.slice(0, 12)}`,
`${kind} source ${source.path} changed between the pin ${commit.slice(0, 12)} and HEAD ${headCommit.slice(0, 12)}`,
);
failures.push(
` the generator copies "${scaffold.fact}" from it: recheck ${scaffold.copiedTo.symbol} in ${scaffold.copiedTo.file}`,
` ${reader} copies "${source.fact}" from it: recheck ${source.copiedTo.symbol} in ${source.copiedTo.file}`,
);
}
}
@@ -183,14 +202,14 @@ function main(): void {
console.log(
headCommit === commit
? `Backend contract drift: ${directory} is at the pinned ${commit.slice(0, 12)}; the excerpt and the answer table match it`
: `Backend contract drift: HEAD ${headCommit.slice(0, 12)} is past the pin ${commit.slice(0, 12)}, ${document} and ${scaffoldSources.length} scaffold sources unchanged; the excerpt and the answer table match it`,
: `Backend contract drift: HEAD ${headCommit.slice(0, 12)} is past the pin ${commit.slice(0, 12)}, ${document}, ${scaffoldSources.length} scaffold sources and ${codeSources.length} code sources unchanged; the excerpt and the answer table match it`,
);
return;
}
console.error("Backend contract drift:");
for (const failure of failures) console.error(` ${failure}`);
console.error(
`Recheck docs/architecture/backend-api-and-server-state-contract.md 6.1, ${pin.tables.idempotencyAnswers}, ${pin.tables.backendExcerpt}, the generator copies of changed scaffold sources and ${PIN_PATH} together.`,
`Recheck docs/architecture/backend-api-and-server-state-contract.md 6.1, ${pin.tables.idempotencyAnswers}, ${pin.tables.backendExcerpt}, the copies of changed scaffold and code sources and ${PIN_PATH} together.`,
);
process.exitCode = 1;
}
@@ -94,6 +94,13 @@ export async function collectStaticAssets(
});
}
// 0925/06-08. Nothing under the directory means vite.config.ts moved the
// hashed files (`build.assetsDir`) away from the one the worker reads.
if (assets.length === 0) {
throw new Error(
`No hashed static asset under ${BUILD_ASSET_DIRECTORY} in the build: vite.config.ts build.assetsDir must name the directory BUILD_ASSET_DIRECTORY (src/contracts/service-worker.ts) names.`,
);
}
// 1112/06-02. The count and the bound, so the failure says how far over
// it is. Each generated feature adds its lazy chunks here: with the Service
// Worker on, the asset bound can come before the initial JavaScript budget.