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 at8210d48. 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 at8210d48first 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:
@@ -5,11 +5,7 @@ import { sha256Hex } from "../../src/adapters/browser-transfer/presigned/increme
|
||||
import {
|
||||
CHECKSUM_HEADER,
|
||||
CONTROL_ENDPOINT,
|
||||
DATA_ORIGIN,
|
||||
DIGEST_HEADER,
|
||||
DOWNLOAD_HREF,
|
||||
DOWNLOAD_PATH,
|
||||
NOW,
|
||||
POLICY_HEADER,
|
||||
REQUEST_BINDING_SHA256,
|
||||
UPLOAD_SESSION_ID,
|
||||
@@ -526,8 +522,10 @@ describe("presigned upload part execution", () => {
|
||||
outcome: "SUCCEEDED",
|
||||
byteBucket: "LT1MIB",
|
||||
},
|
||||
// 01-10. A PUT attempt is PRESIGNED_TRANSFER; UPLOAD_PART is the
|
||||
// resumable runtime's one record per part.
|
||||
{
|
||||
operation: "UPLOAD_PART",
|
||||
operation: "PRESIGNED_TRANSFER",
|
||||
outcome: "SUCCEEDED",
|
||||
byteBucket: "LT1MIB",
|
||||
},
|
||||
@@ -547,3 +545,334 @@ describe("presigned upload part execution", () => {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* R-1.2. The control plane accepts base64url IDs (`[A-Za-z0-9_-]{8,512}`), but
|
||||
* the presigned layer re-checked them with its own grammar and refused IDs that
|
||||
* start with `-`/`_` or exceed 256 characters, so every part issue for such a
|
||||
* session failed as INVALID_INPUT.
|
||||
*/
|
||||
describe("presigned layer accepts every control-plane opaque ID", () => {
|
||||
const controlPlaneIds = [
|
||||
["a leading '-'", `-${"aZ09_-".repeat(7)}`],
|
||||
["a leading '_'", `_${"aZ09_-".repeat(7)}`],
|
||||
["512 characters", "Q".repeat(512)],
|
||||
] as const;
|
||||
|
||||
it.each(controlPlaneIds)(
|
||||
"issues and PUTs an upload part for a session ID with %s",
|
||||
async (_label, sessionId) => {
|
||||
const bytes = new Uint8Array([4, 5, 6]);
|
||||
const checksum = sha256Hex(bytes);
|
||||
const idempotencyKey = `_${sessionId.slice(1, 43)}`;
|
||||
const payload = uploadCapabilityPayload(
|
||||
{ bytes, checksum },
|
||||
{
|
||||
binding: {
|
||||
...uploadCapabilityPayload({ bytes, checksum }).binding,
|
||||
sessionId,
|
||||
idempotencyKey,
|
||||
},
|
||||
},
|
||||
);
|
||||
const fetcher = vi.fn(async (input: RequestInfo | URL) => {
|
||||
if (String(input) === CONTROL_ENDPOINT) return jsonResponse(payload);
|
||||
return responseWithUrl(
|
||||
new Response(null, {
|
||||
status: 200,
|
||||
headers: {
|
||||
[POLICY_HEADER]: "v1",
|
||||
"Content-Length": "0",
|
||||
ETag: "\"part-etag-1\"",
|
||||
},
|
||||
}),
|
||||
String(payload.href),
|
||||
);
|
||||
}) as unknown as typeof fetch;
|
||||
const { provider, executor } = createHarness({ fetcher });
|
||||
const binding = {
|
||||
sessionId,
|
||||
requestBindingSha256: REQUEST_BINDING_SHA256,
|
||||
uploadBindingSha256: "b".repeat(64),
|
||||
partNumber: 1,
|
||||
offset: 0,
|
||||
byteLength: bytes.byteLength,
|
||||
checksumSha256: checksum,
|
||||
idempotencyKey,
|
||||
};
|
||||
const issued = await provider.issueUploadPart({
|
||||
...binding,
|
||||
mediaType: "application/octet-stream",
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
expect(issued).toMatchObject({ ok: true });
|
||||
if (!issued.ok) return;
|
||||
await expect(
|
||||
executor.uploadParts.put({
|
||||
...binding,
|
||||
capability: issued.value,
|
||||
bytes,
|
||||
signal: new AbortController().signal,
|
||||
}),
|
||||
).resolves.toMatchObject({ ok: true });
|
||||
},
|
||||
);
|
||||
|
||||
it.each(controlPlaneIds)(
|
||||
"issues a download capability for a resource ID with %s",
|
||||
async (_label, resourceId) => {
|
||||
const payload = downloadCapabilityPayload(new Uint8Array([1, 2]), {
|
||||
binding: { kind: "DOWNLOAD", resourceId },
|
||||
});
|
||||
const fetcher = vi.fn(async () =>
|
||||
jsonResponse(payload),
|
||||
) as unknown as typeof fetch;
|
||||
const { provider } = createHarness({ fetcher });
|
||||
await expect(
|
||||
provider.issueDownload({
|
||||
resourceId,
|
||||
signal: new AbortController().signal,
|
||||
}),
|
||||
).resolves.toMatchObject({ ok: true });
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe("presigned vault slot release (01-07)", () => {
|
||||
const scenarios = {
|
||||
"the digest does not match": {
|
||||
digest: async () => "f".repeat(64),
|
||||
abortDuringDigest: false,
|
||||
sessionId: UPLOAD_SESSION_ID,
|
||||
code: "INTEGRITY_FAILED",
|
||||
},
|
||||
"the caller aborts during the digest": {
|
||||
digest: async (bytes: Uint8Array) => sha256Hex(bytes),
|
||||
abortDuringDigest: true,
|
||||
sessionId: UPLOAD_SESSION_ID,
|
||||
code: "ABORTED",
|
||||
},
|
||||
"the PUT binding check refuses it": {
|
||||
digest: async (bytes: Uint8Array) => sha256Hex(bytes),
|
||||
abortDuringDigest: false,
|
||||
sessionId: "another-session",
|
||||
code: "POLICY_REJECTED",
|
||||
},
|
||||
} as const;
|
||||
|
||||
it.each(Object.keys(scenarios) as (keyof typeof scenarios)[])(
|
||||
"frees the only vault slot when %s",
|
||||
async (name) => {
|
||||
const scenario = scenarios[name];
|
||||
const bytes = new Uint8Array([9, 8, 7]);
|
||||
const checksum = sha256Hex(bytes);
|
||||
let issued = 0;
|
||||
const fetcher = vi.fn(async (input: RequestInfo | URL) => {
|
||||
if (String(input) !== CONTROL_ENDPOINT) {
|
||||
throw new Error("no PUT is expected");
|
||||
}
|
||||
issued += 1;
|
||||
return jsonResponse(
|
||||
uploadCapabilityPayload(
|
||||
{ bytes, checksum },
|
||||
{ capabilityReceipt: `capability-upload-${issued}` },
|
||||
),
|
||||
);
|
||||
}) as unknown as typeof fetch;
|
||||
const controller = new AbortController();
|
||||
const { provider, executor } = createHarness({
|
||||
fetcher,
|
||||
maxActiveCapabilities: 1,
|
||||
digestBytes: async (value) => {
|
||||
if (scenario.abortDuringDigest) controller.abort();
|
||||
return await scenario.digest(value);
|
||||
},
|
||||
});
|
||||
const issue = async () =>
|
||||
await provider.issueUploadPart({
|
||||
sessionId: UPLOAD_SESSION_ID,
|
||||
requestBindingSha256: REQUEST_BINDING_SHA256,
|
||||
uploadBindingSha256: "b".repeat(64),
|
||||
partNumber: 1,
|
||||
offset: 0,
|
||||
byteLength: bytes.byteLength,
|
||||
checksumSha256: checksum,
|
||||
mediaType: "application/octet-stream",
|
||||
idempotencyKey: "part-attempt-1",
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
const first = await issue();
|
||||
if (!first.ok) throw new Error("issue failed");
|
||||
|
||||
const put = await executor.uploadParts.put({
|
||||
capability: first.value,
|
||||
sessionId: scenario.sessionId,
|
||||
requestBindingSha256: REQUEST_BINDING_SHA256,
|
||||
uploadBindingSha256: "b".repeat(64),
|
||||
partNumber: 1,
|
||||
offset: 0,
|
||||
byteLength: bytes.byteLength,
|
||||
checksumSha256: checksum,
|
||||
idempotencyKey: "part-attempt-1",
|
||||
bytes,
|
||||
signal: controller.signal,
|
||||
});
|
||||
expect(put).toMatchObject({ ok: false, error: { code: scenario.code } });
|
||||
|
||||
expect((await issue()).ok).toBe(true);
|
||||
},
|
||||
);
|
||||
|
||||
const earlyExits = {
|
||||
"the caller signal is already aborted": {
|
||||
override: { signal: AbortSignal.abort() },
|
||||
code: "ABORTED",
|
||||
},
|
||||
"the byte length does not match the bytes": {
|
||||
override: { byteLength: 4 },
|
||||
code: "INTEGRITY_FAILED",
|
||||
},
|
||||
"the input is invalid": {
|
||||
override: { idempotencyKey: "" },
|
||||
code: "INVALID_INPUT",
|
||||
},
|
||||
"the signal is not an AbortSignal": {
|
||||
override: { signal: {} as AbortSignal },
|
||||
code: "INVALID_INPUT",
|
||||
},
|
||||
} as const;
|
||||
|
||||
it.each(Object.keys(earlyExits) as (keyof typeof earlyExits)[])(
|
||||
"frees the only vault slot when put() returns early because %s",
|
||||
async (name) => {
|
||||
const bytes = new Uint8Array([9, 8, 7]);
|
||||
const checksum = sha256Hex(bytes);
|
||||
let issued = 0;
|
||||
const fetcher = vi.fn(async (input: RequestInfo | URL) => {
|
||||
if (String(input) !== CONTROL_ENDPOINT) {
|
||||
throw new Error("no PUT is expected");
|
||||
}
|
||||
issued += 1;
|
||||
return jsonResponse(
|
||||
uploadCapabilityPayload(
|
||||
{ bytes, checksum },
|
||||
{ capabilityReceipt: `capability-upload-${issued}` },
|
||||
),
|
||||
);
|
||||
}) as unknown as typeof fetch;
|
||||
const { provider, executor } = createHarness({
|
||||
fetcher,
|
||||
maxActiveCapabilities: 1,
|
||||
});
|
||||
const issue = async () =>
|
||||
await provider.issueUploadPart({
|
||||
sessionId: UPLOAD_SESSION_ID,
|
||||
requestBindingSha256: REQUEST_BINDING_SHA256,
|
||||
uploadBindingSha256: "b".repeat(64),
|
||||
partNumber: 1,
|
||||
offset: 0,
|
||||
byteLength: bytes.byteLength,
|
||||
checksumSha256: checksum,
|
||||
mediaType: "application/octet-stream",
|
||||
idempotencyKey: "part-attempt-1",
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
const first = await issue();
|
||||
if (!first.ok) throw new Error("issue failed");
|
||||
|
||||
const { override, code } = earlyExits[name];
|
||||
const put = await executor.uploadParts.put({
|
||||
capability: first.value,
|
||||
sessionId: UPLOAD_SESSION_ID,
|
||||
requestBindingSha256: REQUEST_BINDING_SHA256,
|
||||
uploadBindingSha256: "b".repeat(64),
|
||||
partNumber: 1,
|
||||
offset: 0,
|
||||
byteLength: bytes.byteLength,
|
||||
checksumSha256: checksum,
|
||||
idempotencyKey: "part-attempt-1",
|
||||
bytes,
|
||||
signal: new AbortController().signal,
|
||||
...override,
|
||||
});
|
||||
expect(put).toMatchObject({ ok: false, error: { code } });
|
||||
|
||||
expect((await issue()).ok).toBe(true);
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
["the caller signal is already aborted", AbortSignal.abort(), "ABORTED"],
|
||||
["the signal is not an AbortSignal", {} as AbortSignal, "INVALID_INPUT"],
|
||||
] as const)(
|
||||
"frees the only vault slot when open() returns early because %s",
|
||||
async (_name, signal, code) => {
|
||||
const bytes = new Uint8Array([1, 2, 3]);
|
||||
let issued = 0;
|
||||
const fetcher = vi.fn(async () => {
|
||||
issued += 1;
|
||||
return jsonResponse(
|
||||
downloadCapabilityPayload(bytes, {
|
||||
capabilityReceipt: `capability-download-${issued}`,
|
||||
}),
|
||||
);
|
||||
}) as unknown as typeof fetch;
|
||||
const { provider, executor } = createHarness({
|
||||
fetcher,
|
||||
maxActiveCapabilities: 1,
|
||||
});
|
||||
const issue = async () =>
|
||||
await provider.issueDownload({
|
||||
resourceId: "resource-1",
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
const first = await issue();
|
||||
if (!first.ok) throw new Error("issue failed");
|
||||
|
||||
const opened = await executor.downloadSources.open({
|
||||
resourceId: "resource-1",
|
||||
capability: first.value,
|
||||
signal,
|
||||
});
|
||||
expect(opened).toMatchObject({ ok: false, error: { code } });
|
||||
|
||||
expect((await issue()).ok).toBe(true);
|
||||
},
|
||||
);
|
||||
|
||||
it("frees the only vault slot when a download open is refused", async () => {
|
||||
const bytes = new Uint8Array([1, 2, 3]);
|
||||
let issued = 0;
|
||||
const fetcher = vi.fn(async () => {
|
||||
issued += 1;
|
||||
return jsonResponse(
|
||||
downloadCapabilityPayload(bytes, {
|
||||
capabilityReceipt: `capability-download-${issued}`,
|
||||
}),
|
||||
);
|
||||
}) as unknown as typeof fetch;
|
||||
const { provider, executor } = createHarness({
|
||||
fetcher,
|
||||
maxActiveCapabilities: 1,
|
||||
});
|
||||
const issue = async () =>
|
||||
await provider.issueDownload({
|
||||
resourceId: "resource-1",
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
const first = await issue();
|
||||
if (!first.ok) throw new Error("issue failed");
|
||||
|
||||
const opened = await executor.downloadSources.open({
|
||||
resourceId: "resource-2",
|
||||
capability: first.value,
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
expect(opened).toMatchObject({
|
||||
ok: false,
|
||||
error: { code: "POLICY_REJECTED" },
|
||||
});
|
||||
|
||||
expect((await issue()).ok).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user