chore: sync the frontend template from ebea300 to af3d8e6

Carries 359 template commits, tag v0.2.0 plus one documentation commit: the
generator-built feature index with its app, bounded-context and feature
declarations, the src/platform kernel and scale tooling, the 2026-09-24 src
review fixes, and the 2026-09-25 maturity review round with its CHANGELOG
[보안]/[계약] rows. 691 of the 824 template paths are applied, 85 of them
merged with product changes; 127 are not carried.

Product identity is unchanged: name, version 0.1.0, routes, design and the
TechLog domain.

Three decisions worth naming. TechLog stays composed directly, as the last
two syncs recorded; its directory carries a NOT_INSTALLED marker that says so,
and every installed-* composer takes the template's projection with TechLog
added on top. The reference sample is no longer installed: the template now
installs a feature only through feature-module.ts and context-routes.ts,
which load the screens this product deleted, so its three operations, six
schemas and one topic leave the registries, recorded as registry change
evidence. And AppRouter mounts the platform and TechLog routes only; the
template's bounded-context route gateway waits for a generator-installed
feature.

Required fixes: readSubject on the BFF session owner (without it every HTTP
Studio session would close as integration-failed), zod through the facade in
nine TechLog files, noUnusedLocals, and public/config.json written out to
match the local profile. Derived baselines were recomputed after reproducing
both sides' values: CI contract 101 commands / 106 references / 141
artifacts, gate shape c9adcf85; registry approval 2dc6c3a3; the runtime
config schema baseline equals the schema at 8210d48.

Verified here: types, lint, architecture, adapter inventory, CI contract,
i18n, design system, diagnostics, browser security, dev release manifest,
TechLog contract and build pass; 220 component, 155 integration, 15
contract, 418 TechLog, 43 reference-feature, 18 recipe and 46
release-coherence tests pass, and 2381 of 2383 unit tests. Reproduced at
8210d48 first and unchanged: check:registries (byte-identical),
test:runtime-schema, verify:documentation. Brought by the template and
escalated rather than suppressed: check:request-fanout on TechLog's cursor
pagination, check:remediation-ledger (fails upstream too), the shared-chunk
hash test, and the registry-dependent sample removal and second-feature
tests. Playwright suites were not run.

Full record, the five open questions and the follow-ups in
docs/operations/template-sync-2026-09-29.md.

(cherry picked from commit b2170cf265dea45dc9cc05d3c61e627e97f31cdb)
This commit is contained in:
DongHyeonka
2026-11-12 08:28:54 +09:00
parent 585c62431a
commit c80320dfc7
738 changed files with 55027 additions and 13567 deletions
+125 -3
View File
@@ -1,3 +1,5 @@
import { createHash } from "node:crypto";
import { describe, expect, it, vi } from "vitest";
import {
@@ -5,16 +7,17 @@ import {
type PresignedDownloadCapability,
} from "../../src/application/ports/browser-transfer/presigned-transfer.ts";
import { createPresignedCapabilityVault } from "../../src/adapters/browser-transfer/presigned/presigned-capability-vault.ts";
import { sha256Hex } from "../../src/adapters/browser-transfer/presigned/incremental-sha256.ts";
import {
CHECKSUM_HEADER,
createStreamingSha256Verifier,
sha256Hex,
} from "../../src/adapters/browser-transfer/presigned/incremental-sha256.ts";
import {
CONTROL_ENDPOINT,
DATA_ORIGIN,
DIGEST_HEADER,
DOWNLOAD_HREF,
DOWNLOAD_PATH,
NOW,
POLICY_HEADER,
REQUEST_BINDING_SHA256,
UPLOAD_SESSION_ID,
collect,
@@ -32,8 +35,66 @@ describe("presigned transfer capability issuance and admission", () => {
expect(sha256Hex(new TextEncoder().encode("abc"))).toBe(
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
);
// FIPS 180-2 two-block vector: the padding spills into a second block.
expect(
sha256Hex(
new TextEncoder().encode(
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
),
),
).toBe(
"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1",
);
});
it("agrees with node:crypto across block boundaries and chunk splits", () => {
for (const size of [
...Array.from({ length: 130 }, (_, index) => index),
1023,
1024,
4097,
]) {
const bytes = Uint8Array.from({ length: size }, (_, index) =>
(index * 31 + size) % 256,
);
const expected = createHash("sha256").update(bytes).digest("hex");
expect(sha256Hex(bytes)).toBe(expected);
const verifier = createStreamingSha256Verifier(expected);
for (let offset = 0, step = 1; offset < size; offset += step, step += 7) {
verifier.update(bytes.subarray(offset, offset + step));
}
expect(verifier.verify()).toBe(true);
}
});
it.each([
[500, true],
[501, false],
] as const)(
"accepts a max-TTL capability from a server %i ms ahead: %s (01-06)",
async (skewMs, accepted) => {
const bytes = new Uint8Array([1, 2, 3]);
const payload = downloadCapabilityPayload(bytes, {
// The harness allows 60 s; the server clock runs `skewMs` ahead.
expiresAtEpochMs: NOW + skewMs + 60_000,
});
const fetcher = vi.fn(async () =>
jsonResponse(payload),
) as unknown as typeof fetch;
const { provider } = createHarness({ fetcher, maxClockSkewMs: 500 });
const issued = await provider.issueDownload({
resourceId: "resource-1",
signal: new AbortController().signal,
});
expect(issued.ok).toBe(accepted);
if (!accepted) {
expect(issued).toMatchObject({ error: { code: "POLICY_REJECTED" } });
}
},
);
it("answers a refused capability envelope with a re-issuable recovery", async () => {
// BT-PRE-04. A capability document the adapter will not accept is closed as
// `POLICY_REJECTED`, and the caller's only way forward is a new capability.
@@ -565,6 +626,67 @@ describe("presigned transfer capability issuance and admission", () => {
});
});
// Q-6.1-9. `Number(declaredLength)` accepted "5e0", "0x5" and "+5" as 5.
it("rejects a download Content-Length that is not a plain decimal", async () => {
const bytes = new Uint8Array([1, 2, 3, 4, 5]);
const payload = downloadCapabilityPayload(bytes);
for (const declared of ["5e0", "0x5", "+5", "5.0"]) {
const fetcher = vi.fn(async (input: RequestInfo | URL) =>
String(input) === CONTROL_ENDPOINT
? jsonResponse(payload)
: downloadResponse(bytes.slice().buffer, payload, {
"Content-Length": declared,
}),
) as unknown as typeof fetch;
const harness = createHarness({ fetcher });
const issued = await harness.provider.issueDownload({
resourceId: "resource-1",
signal: new AbortController().signal,
});
expect(issued.ok).toBe(true);
if (!issued.ok) return;
await expect(
firstStreamResult(
await harness.executor.downloadSources.open({
resourceId: "resource-1",
capability: issued.value,
signal: new AbortController().signal,
}),
),
declared,
).resolves.toMatchObject({
ok: false,
error: { code: "INTEGRITY_FAILED" },
});
}
});
// Q-6.1-9. The provider and the executor share one status table: a refused
// or failed capability HTTP exchange is recovered by a new capability.
it("maps capability endpoint statuses with the executor's recovery table", async () => {
for (const [status, code, retryable] of [
[401, "PERMISSION_DENIED", false],
[403, "PERMISSION_DENIED", false],
[503, "UNAVAILABLE", true],
[429, "UNAVAILABLE", true],
] as const) {
const fetcher = vi.fn(async () =>
responseWithUrl(new Response(null, { status }), CONTROL_ENDPOINT),
) as unknown as typeof fetch;
const { provider } = createHarness({ fetcher });
expect(
await provider.issueDownload({
resourceId: "resource-1",
signal: new AbortController().signal,
}),
String(status),
).toMatchObject({
ok: false,
error: { code, retryable, recovery: "REISSUE_CAPABILITY" },
});
}
});
it("accepts a valid opaque UTF-8 path segment", async () => {
const bytes = new Uint8Array([1, 2, 3]);
// BT-PRE-05. Canonical uppercase percent-hex for a real UTF-8 segment.