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:
@@ -4,12 +4,14 @@ import {
|
||||
CACHE_INVALIDATION_PROTOCOL_VERSION,
|
||||
CACHE_INVALIDATION_WIRE_LIMITS,
|
||||
decodeCacheInvalidationWireEvent,
|
||||
isCacheInvalidationOpaqueIdentifier,
|
||||
parseCacheInvalidationWireEvent,
|
||||
type CacheInvalidationWireEvent,
|
||||
} from "../../src/contracts/cache-invalidation.ts";
|
||||
import {
|
||||
createBrowserCrossContextInvalidation,
|
||||
createBrowserCrossContextInvalidationFromHost,
|
||||
crossContextCacheEpochForRelease,
|
||||
type BroadcastChannelFacade,
|
||||
type BroadcastMessageListener,
|
||||
type BrowserCrossContextInvalidationDependencies,
|
||||
@@ -346,6 +348,66 @@ describe("browser cross-context host", () => {
|
||||
).toBeUndefined();
|
||||
expect(reads).toEqual([]);
|
||||
});
|
||||
|
||||
it("reports an inactive host through observe instead of failing silently (Q-6.2-9)", () => {
|
||||
const observations: CrossContextInvalidationObservation[] = [];
|
||||
const topics = [{ topic: TOPIC, topicVersion: 1 }];
|
||||
|
||||
expect(
|
||||
createBrowserCrossContextInvalidationFromHost({
|
||||
host: {},
|
||||
cacheEpoch: CACHE_EPOCH,
|
||||
topics,
|
||||
observe: (observation) => observations.push(observation),
|
||||
}),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
createBrowserCrossContextInvalidationFromHost({
|
||||
host: { crypto: globalThis.crypto },
|
||||
cacheEpoch: "release.1.2.3+sha.abc",
|
||||
topics,
|
||||
observe: (observation) => observations.push(observation),
|
||||
}),
|
||||
).toBeUndefined();
|
||||
expect(observations).toEqual([
|
||||
{
|
||||
operation: "OPEN",
|
||||
outcome: "FAILED",
|
||||
transport: "NONE",
|
||||
reason: "SECURE_RANDOM_UNAVAILABLE",
|
||||
},
|
||||
{
|
||||
operation: "OPEN",
|
||||
outcome: "FAILED",
|
||||
transport: "NONE",
|
||||
reason: "INVALID_CACHE_EPOCH",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("derives a valid, stable cache epoch from any release id (Q-6.2-9)", () => {
|
||||
const releaseIds = [
|
||||
"1.2.3+sha.abc",
|
||||
"feature/x",
|
||||
"app@1.2.3",
|
||||
"x".repeat(500),
|
||||
"1.2.3",
|
||||
];
|
||||
const epochs = releaseIds.map(crossContextCacheEpochForRelease);
|
||||
for (const epoch of epochs) {
|
||||
expect(isCacheInvalidationOpaqueIdentifier(epoch)).toBe(true);
|
||||
}
|
||||
expect(new Set(epochs).size).toBe(releaseIds.length);
|
||||
expect(crossContextCacheEpochForRelease("feature/x")).toBe(epochs[1]);
|
||||
|
||||
const runtime = createBrowserCrossContextInvalidationFromHost({
|
||||
host: { crypto: globalThis.crypto },
|
||||
cacheEpoch: crossContextCacheEpochForRelease("app@1.2.3"),
|
||||
topics: [{ topic: TOPIC, topicVersion: 1 }],
|
||||
});
|
||||
expect(runtime).toBeDefined();
|
||||
runtime?.close();
|
||||
});
|
||||
});
|
||||
|
||||
describe("browser cross-context invalidation transport", () => {
|
||||
@@ -440,6 +502,15 @@ describe("browser cross-context invalidation transport", () => {
|
||||
sequence: 1,
|
||||
}),
|
||||
);
|
||||
// 02-08. A source first seen mid-stream has already sent events this tab
|
||||
// missed, so its first event is a gap on its own.
|
||||
network.emit(
|
||||
wireEvent({
|
||||
eventId: "joined-event-00000004",
|
||||
sourceId: "joined-source-0000001",
|
||||
sequence: 4,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(
|
||||
delivered.map(({ event, ordering }) => [
|
||||
@@ -450,6 +521,7 @@ describe("browser cross-context invalidation transport", () => {
|
||||
[1, "NEXT"],
|
||||
[3, "GAP"],
|
||||
[1, "NEXT"],
|
||||
[4, "GAP"],
|
||||
]);
|
||||
expect(observations).toContainEqual({
|
||||
operation: "RECEIVE",
|
||||
@@ -460,6 +532,42 @@ describe("browser cross-context invalidation transport", () => {
|
||||
runtime.close();
|
||||
});
|
||||
|
||||
it("keeps the per-source sequence watermark past the event TTL", () => {
|
||||
const network = new FakeBroadcastNetwork();
|
||||
let currentTime = NOW;
|
||||
const runtime = createBrowserCrossContextInvalidation(
|
||||
dependencies("tab-b", {
|
||||
createBroadcastChannel: network.createChannel,
|
||||
nowEpochMilliseconds: () => currentTime,
|
||||
}),
|
||||
);
|
||||
const delivered: CrossContextInvalidationDelivery[] = [];
|
||||
runtime.subscribe((delivery) => delivered.push(delivery));
|
||||
|
||||
network.emit(wireEvent({ eventId: "remote-event-00000001", sequence: 1 }));
|
||||
// The source stays quiet longer than the 60 s event TTL.
|
||||
currentTime += 61_000;
|
||||
network.emit(
|
||||
wireEvent({
|
||||
eventId: "remote-event-00000002",
|
||||
sequence: 2,
|
||||
emittedAt: currentTime,
|
||||
expiresAt: currentTime + 60_000,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(
|
||||
delivered.map(({ event, ordering }) => [
|
||||
event.sequence,
|
||||
ordering,
|
||||
]),
|
||||
).toEqual([
|
||||
[1, "NEXT"],
|
||||
[2, "NEXT"],
|
||||
]);
|
||||
runtime.close();
|
||||
});
|
||||
|
||||
it("falls back when BroadcastChannel open or publish fails", () => {
|
||||
const storageBus = new FakeStorageBus();
|
||||
const firstStorage = storageBus.createEndpoint();
|
||||
@@ -487,7 +595,9 @@ describe("browser cross-context invalidation transport", () => {
|
||||
const received = vi.fn();
|
||||
second.subscribe(received);
|
||||
|
||||
expect(second.getStatus()).toBe("ACTIVE_STORAGE_FALLBACK");
|
||||
// R-2.3. Other tabs publish on BroadcastChannel only, so a tab whose
|
||||
// channel failed to open misses their events and must not look healthy.
|
||||
expect(second.getStatus()).toBe("DEGRADED_STORAGE_FALLBACK");
|
||||
expect(first.publish({ topic: TOPIC, topicVersion: 1 })).toEqual({
|
||||
ok: true,
|
||||
transport: "STORAGE",
|
||||
@@ -498,11 +608,54 @@ describe("browser cross-context invalidation transport", () => {
|
||||
expect(firstStorage.storage.removeCount).toBe(1);
|
||||
expect(storageBus.values.has(STORAGE_PULSE_KEY)).toBe(false);
|
||||
expect(secondNetwork.channels).toHaveLength(0);
|
||||
expect(second.publish({ topic: TOPIC, topicVersion: 1 })).toEqual({
|
||||
ok: true,
|
||||
transport: "STORAGE",
|
||||
});
|
||||
expect(second.getStatus()).toBe("DEGRADED_STORAGE_FALLBACK");
|
||||
|
||||
first.close();
|
||||
second.close();
|
||||
});
|
||||
|
||||
it("keeps receiving broadcasts after its own broadcast publish fails", () => {
|
||||
const network = new FakeBroadcastNetwork();
|
||||
const storageBus = new FakeStorageBus();
|
||||
const senderStorage = storageBus.createEndpoint();
|
||||
const receiverStorage = storageBus.createEndpoint();
|
||||
const sender = createBrowserCrossContextInvalidation(
|
||||
dependencies("tab-a", {
|
||||
createBroadcastChannel: network.createChannel,
|
||||
storage: senderStorage.storage,
|
||||
storageEvents: senderStorage.target,
|
||||
}),
|
||||
);
|
||||
const receiver = createBrowserCrossContextInvalidation(
|
||||
dependencies("tab-b", {
|
||||
createBroadcastChannel: network.createChannel,
|
||||
storage: receiverStorage.storage,
|
||||
storageEvents: receiverStorage.target,
|
||||
}),
|
||||
);
|
||||
network.channels[1]!.failPost = true;
|
||||
expect(
|
||||
receiver.publish({ topic: TOPIC, topicVersion: 1 }),
|
||||
).toEqual({ ok: true, transport: "STORAGE" });
|
||||
const delivered: CrossContextInvalidationDelivery[] = [];
|
||||
receiver.subscribe((delivery) => delivered.push(delivery));
|
||||
|
||||
expect(
|
||||
sender.publish({ topic: TOPIC, topicVersion: 1 }),
|
||||
).toEqual({ ok: true, transport: "BROADCAST" });
|
||||
|
||||
expect(delivered.map(({ transport }) => transport)).toEqual([
|
||||
"BROADCAST",
|
||||
]);
|
||||
expect(receiver.getStatus()).toBe("ACTIVE_STORAGE_FALLBACK");
|
||||
sender.close();
|
||||
receiver.close();
|
||||
});
|
||||
|
||||
it("rejects storage pulses from another or unknown storage area", () => {
|
||||
const storageBus = new FakeStorageBus();
|
||||
const publisherStorage = storageBus.createEndpoint();
|
||||
@@ -563,7 +716,7 @@ describe("browser cross-context invalidation transport", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
expect(runtime.getStatus()).toBe("ACTIVE_STORAGE_FALLBACK");
|
||||
expect(runtime.getStatus()).toBe("DEGRADED_STORAGE_FALLBACK");
|
||||
expect(runtime.publish({ topic: TOPIC, topicVersion: 1 })).toEqual({
|
||||
ok: false,
|
||||
reason: "TRANSPORT_UNAVAILABLE",
|
||||
@@ -618,12 +771,14 @@ describe("browser cross-context invalidation transport", () => {
|
||||
it("bounds TTL and LRU tracking instead of growing with remote sources", () => {
|
||||
const network = new FakeBroadcastNetwork();
|
||||
let currentTime = NOW;
|
||||
const observations: CrossContextInvalidationObservation[] = [];
|
||||
const runtime = createBrowserCrossContextInvalidation(
|
||||
dependencies("tab-b", {
|
||||
createBroadcastChannel: network.createChannel,
|
||||
nowEpochMilliseconds: () => currentTime,
|
||||
dedupeCapacity: 2,
|
||||
sourceCapacity: 2,
|
||||
observe: (observation) => observations.push(observation),
|
||||
}),
|
||||
);
|
||||
const received = vi.fn();
|
||||
@@ -651,7 +806,13 @@ describe("browser cross-context invalidation transport", () => {
|
||||
network.emit(
|
||||
distinctSource(3, "bounded-event-3", currentTime),
|
||||
);
|
||||
expect(received).toHaveBeenCalledTimes(5);
|
||||
// The dedupe entry expired with the event TTL, but the sequence watermark
|
||||
// does not expire, so the replay is dropped as stale, not redelivered.
|
||||
expect(received).toHaveBeenCalledTimes(4);
|
||||
expect(observations.at(-1)).toMatchObject({
|
||||
outcome: "DROPPED",
|
||||
reason: "STALE",
|
||||
});
|
||||
runtime.close();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user