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:
@@ -397,6 +397,40 @@ describe("production image CDN runtime", () => {
|
||||
expect(resolved.value.sources[0]?.type).toBe("image/avif");
|
||||
});
|
||||
|
||||
// Q-6.1-7 / D-12. The probe demands the exact primary pixel size, which a
|
||||
// ratio-preserving fit (inside/outside) does not produce for an asset whose
|
||||
// ratio differs, so that preset could only ever fail at probe time.
|
||||
it("allows a PRIMARY_REQUIRED probe only with an exact-size fit", () => {
|
||||
for (const fit of ["inside", "outside"] as const) {
|
||||
expect(() =>
|
||||
createPolicies([
|
||||
createPreset(imageCdnPresetReference("probe", `fit-${fit}`), {
|
||||
fit,
|
||||
probeMode: "PRIMARY_REQUIRED",
|
||||
}),
|
||||
]),
|
||||
).toThrow(/preset policy is invalid/u);
|
||||
// Without the probe a ratio-preserving fit stays allowed.
|
||||
expect(() =>
|
||||
createPolicies([
|
||||
createPreset(imageCdnPresetReference("probe", `none-${fit}`), {
|
||||
fit,
|
||||
}),
|
||||
]),
|
||||
).not.toThrow();
|
||||
}
|
||||
for (const fit of ["cover", "contain", "fill"] as const) {
|
||||
expect(() =>
|
||||
createPolicies([
|
||||
createPreset(imageCdnPresetReference("probe", `exact-${fit}`), {
|
||||
fit,
|
||||
probeMode: "PRIMARY_REQUIRED",
|
||||
}),
|
||||
]),
|
||||
).not.toThrow();
|
||||
}
|
||||
});
|
||||
|
||||
it("rejects unsafe origins and preset budgets at composition time", () => {
|
||||
const preset = imageCdnPresetReference(
|
||||
"unsafe",
|
||||
@@ -1406,3 +1440,139 @@ describe("production image CDN runtime", () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("image probe cost (01-11)", () => {
|
||||
const preset = imageCdnPresetReference("probe-cost", "render-probed");
|
||||
const policies = () =>
|
||||
createPolicies([
|
||||
createPreset(preset, {
|
||||
bindingId: "probe-cost-v1",
|
||||
probeMode: "PRIMARY_REQUIRED",
|
||||
}),
|
||||
]);
|
||||
const receipt = (request: ImageProbeRequest) => ({
|
||||
ok: true as const,
|
||||
value: {
|
||||
absoluteUrl: request.absoluteUrl,
|
||||
mediaType: request.expectedMediaType,
|
||||
encodedBytes: 1_024,
|
||||
decodedWidth: request.expectedWidth,
|
||||
decodedHeight: request.expectedHeight,
|
||||
},
|
||||
});
|
||||
|
||||
it("reuses a passed probe for the same asset and preset", async () => {
|
||||
let fail = true;
|
||||
const probe = vi.fn(async (request: ImageProbeRequest) => {
|
||||
if (fail) {
|
||||
fail = false;
|
||||
return {
|
||||
ok: false as const,
|
||||
error: {
|
||||
code: "UNAVAILABLE" as const,
|
||||
operation: "IMAGE_RESOLVE" as const,
|
||||
retryable: true,
|
||||
recovery: "RETRY" as const,
|
||||
},
|
||||
};
|
||||
}
|
||||
return receipt(request);
|
||||
});
|
||||
const runtime = createImageCdnRuntime({
|
||||
policies: policies(),
|
||||
probe: { probe },
|
||||
});
|
||||
const accepted = runtime.assets.acceptPublicImmutable(publicAsset());
|
||||
if (!accepted.ok) throw new Error("accept failed");
|
||||
const resolve = async () =>
|
||||
await runtime.presentation.resolve({
|
||||
asset: accepted.value,
|
||||
preset,
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
|
||||
// A failed probe is not remembered; the first pass is.
|
||||
expect((await resolve()).ok).toBe(false);
|
||||
const first = await resolve();
|
||||
const second = await resolve();
|
||||
|
||||
expect(first.ok && second.ok).toBe(true);
|
||||
expect(second).toEqual(first);
|
||||
expect(probe).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("never runs more probes at once than maxConcurrentProbes", async () => {
|
||||
let active = 0;
|
||||
let peak = 0;
|
||||
const releases: (() => void)[] = [];
|
||||
const probe = vi.fn(async (request: ImageProbeRequest) => {
|
||||
active += 1;
|
||||
peak = Math.max(peak, active);
|
||||
await new Promise<void>((resolve) => releases.push(resolve));
|
||||
active -= 1;
|
||||
return receipt(request);
|
||||
});
|
||||
const runtime = createImageCdnRuntime({
|
||||
policies: policies(),
|
||||
probe: { probe },
|
||||
maxConcurrentProbes: 2,
|
||||
});
|
||||
const pending = Array.from({ length: 5 }, () => {
|
||||
const accepted = runtime.assets.acceptPublicImmutable(publicAsset());
|
||||
if (!accepted.ok) throw new Error("accept failed");
|
||||
return runtime.presentation.resolve({
|
||||
asset: accepted.value,
|
||||
preset,
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
});
|
||||
for (let released = 0; released < 5; released += 1) {
|
||||
await vi.waitFor(() => expect(releases.length).toBeGreaterThan(0));
|
||||
releases.shift()?.();
|
||||
}
|
||||
const results = await Promise.all(pending);
|
||||
|
||||
expect(results.every((result) => result.ok)).toBe(true);
|
||||
expect(probe).toHaveBeenCalledTimes(5);
|
||||
expect(peak).toBe(2);
|
||||
});
|
||||
|
||||
it("gives a waiting caller's slot back when it aborts before its turn", async () => {
|
||||
const releases: (() => void)[] = [];
|
||||
const probe = vi.fn(async (request: ImageProbeRequest) => {
|
||||
await new Promise<void>((resolve) => releases.push(resolve));
|
||||
return receipt(request);
|
||||
});
|
||||
const runtime = createImageCdnRuntime({
|
||||
policies: policies(),
|
||||
probe: { probe },
|
||||
maxConcurrentProbes: 1,
|
||||
});
|
||||
const resolveNew = (signal: AbortSignal) => {
|
||||
const accepted = runtime.assets.acceptPublicImmutable(publicAsset());
|
||||
if (!accepted.ok) throw new Error("accept failed");
|
||||
return runtime.presentation.resolve({
|
||||
asset: accepted.value,
|
||||
preset,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
const holder = resolveNew(new AbortController().signal);
|
||||
await vi.waitFor(() => expect(releases).toHaveLength(1));
|
||||
const waiting = new AbortController();
|
||||
const abandoned = resolveNew(waiting.signal);
|
||||
waiting.abort();
|
||||
expect(await abandoned).toMatchObject({
|
||||
ok: false,
|
||||
error: { code: "ABORTED" },
|
||||
});
|
||||
releases.shift()?.();
|
||||
expect((await holder).ok).toBe(true);
|
||||
|
||||
const next = resolveNew(new AbortController().signal);
|
||||
await vi.waitFor(() => expect(releases).toHaveLength(1));
|
||||
releases.shift()?.();
|
||||
expect((await next).ok).toBe(true);
|
||||
expect(probe).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user