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:
@@ -795,3 +795,229 @@ describe("RPC-03 registries are snapshotted before they are validated", () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Q-6.3-9. A command the transport already received may have been applied, a
|
||||
* retry must not outlive the scope generation that started it, and a stream the
|
||||
* consumer aborted without calling `return()` must not hold the operation in
|
||||
* DRAINING forever.
|
||||
*/
|
||||
describe("Q-6.3-9 command effect, retry scope and abandoned streams", () => {
|
||||
const COMMAND_KEY = "command-key-0001";
|
||||
const commandOperation = (
|
||||
overrides: Parameters<typeof unaryOperation>[0] = {},
|
||||
) =>
|
||||
unaryOperation({
|
||||
semantics: "COMMAND",
|
||||
replayPolicy: "KEYED_COMMAND",
|
||||
idempotencyKeyPolicy: "REQUIRED",
|
||||
idempotencyLevel: "IDEMPOTENT",
|
||||
serverStateProfileId: null,
|
||||
...overrides,
|
||||
});
|
||||
|
||||
function commandRuntime(
|
||||
invokeUnary: BrowserRpcTransport["invokeUnary"],
|
||||
extra: Readonly<{
|
||||
operation?: ReturnType<typeof unaryOperation>;
|
||||
profile?: ReturnType<typeof unaryProfile>;
|
||||
generationFence?: Readonly<{
|
||||
capture(): unknown;
|
||||
isCurrent(token: unknown): boolean;
|
||||
}>;
|
||||
}> = {},
|
||||
) {
|
||||
return createBrowserRpcRuntime({
|
||||
operations: { GET_RPC_RESOURCE: extra.operation ?? commandOperation() },
|
||||
profiles: { CONNECT_REFERENCE_UNARY: extra.profile ?? unaryProfile() },
|
||||
schemaCodecs: SCHEMA_CODECS,
|
||||
mappers: MAPPERS,
|
||||
requestEncoders: { RpcResourceRequestEncoder: UNARY_ENCODER },
|
||||
transports: { CONNECT_REFERENCE_UNARY: unaryTransport(invokeUnary) },
|
||||
...(extra.generationFence === undefined
|
||||
? {}
|
||||
: { generationFence: extra.generationFence }),
|
||||
}).bindUnary("GET_RPC_RESOURCE", isResourceView);
|
||||
}
|
||||
|
||||
const afterSend: ReadonlyArray<
|
||||
Readonly<{
|
||||
label: string;
|
||||
invokeUnary: BrowserRpcTransport["invokeUnary"];
|
||||
operation?: ReturnType<typeof unaryOperation>;
|
||||
}>
|
||||
> = [
|
||||
{
|
||||
label: "answers UNAVAILABLE",
|
||||
invokeUnary: async () => ({
|
||||
ok: false,
|
||||
failure: { code: "UNAVAILABLE" },
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: "throws",
|
||||
invokeUnary: async () => {
|
||||
throw new TypeError("connection reset");
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "never answers",
|
||||
invokeUnary: () => new Promise<never>(() => {}),
|
||||
operation: commandOperation({ totalDeadlineMs: 25 }),
|
||||
},
|
||||
];
|
||||
|
||||
for (const { label, invokeUnary, operation } of afterSend) {
|
||||
it(`reports MAYBE_APPLIED when a sent command's transport ${label}`, async () => {
|
||||
const port = commandRuntime(invokeUnary, {
|
||||
...(operation === undefined ? {} : { operation }),
|
||||
});
|
||||
|
||||
await expect(
|
||||
port.execute({ resourceId: "r-1" }, { idempotencyKey: COMMAND_KEY }),
|
||||
).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
effect: "MAYBE_APPLIED",
|
||||
retryable: false,
|
||||
action: "contact-support",
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
it("keeps a command rejected before send and a failed query effect-free", async () => {
|
||||
const unsent = await commandRuntime(async () => {
|
||||
throw new Error("must not be called");
|
||||
}).execute({ resourceId: "r-1" });
|
||||
expect(unsent).toMatchObject({
|
||||
ok: false,
|
||||
error: { kind: "VALIDATION_REJECTED" },
|
||||
});
|
||||
expect(unsent.ok ? null : unsent.error).not.toHaveProperty("effect");
|
||||
|
||||
const query = await unaryRuntime(
|
||||
unaryTransport(async () => ({
|
||||
ok: false,
|
||||
failure: { code: "UNAVAILABLE" },
|
||||
})),
|
||||
)
|
||||
.bindUnary("GET_RPC_RESOURCE", isResourceView)
|
||||
.execute({ resourceId: "r-1" });
|
||||
expect(query).toMatchObject({
|
||||
ok: false,
|
||||
error: { kind: "SERVER_FAILURE", retryable: true },
|
||||
});
|
||||
expect(query.ok ? null : query.error).not.toHaveProperty("effect");
|
||||
});
|
||||
|
||||
it("does not retry a command after its scope generation changed", async () => {
|
||||
let calls = 0;
|
||||
let generation = 1;
|
||||
const port = commandRuntime(
|
||||
async () => {
|
||||
calls += 1;
|
||||
// The session changes while the first attempt is in flight.
|
||||
generation = 2;
|
||||
return { ok: false, failure: { code: "UNAVAILABLE" } };
|
||||
},
|
||||
{
|
||||
profile: unaryProfile({
|
||||
retryProfileId: "RPC_RETRY_TWO",
|
||||
retryOwner: "FRONTEND_ADAPTER",
|
||||
maxAttempts: 2,
|
||||
backoffMs: [0],
|
||||
retryableFailures: ["UNAVAILABLE"],
|
||||
maxRetryAfterMs: 100,
|
||||
}),
|
||||
operation: commandOperation({ retryProfileId: "RPC_RETRY_TWO" }),
|
||||
generationFence: {
|
||||
capture: () => generation,
|
||||
isCurrent: (token) => token === generation,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const result = await port.execute(
|
||||
{ resourceId: "r-1" },
|
||||
{ idempotencyKey: COMMAND_KEY },
|
||||
);
|
||||
|
||||
expect(calls).toBe(1);
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
kind: "SCOPE_GENERATION_CHANGED",
|
||||
effect: "MAYBE_APPLIED",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("releases a stream the consumer aborted without calling return()", async () => {
|
||||
const cancels: string[] = [];
|
||||
let opened = 0;
|
||||
const transport = defineBrowserRpcTransport({
|
||||
runtimeProfileId: "CONNECT_REFERENCE_STREAM",
|
||||
providerId: "REFERENCE_RPC",
|
||||
protocol: "CONNECT_HTTP",
|
||||
rpcKind: "SERVER_STREAM",
|
||||
openServerStream: () => {
|
||||
opened += 1;
|
||||
let closed: () => void = () => {};
|
||||
const closure = new Promise<void>((resolve) => {
|
||||
closed = resolve;
|
||||
});
|
||||
let sent = false;
|
||||
return {
|
||||
streamId: `physical-${opened}`,
|
||||
frames: {
|
||||
[Symbol.asyncIterator]: () =>
|
||||
({
|
||||
next: () => {
|
||||
if (sent) return new Promise<never>(() => {});
|
||||
sent = true;
|
||||
return Promise.resolve({
|
||||
done: false,
|
||||
value: {
|
||||
kind: "MESSAGE",
|
||||
message: { id: "r-1", name: "Resource" },
|
||||
encodedBytes: 16,
|
||||
},
|
||||
});
|
||||
},
|
||||
}) as AsyncIterator<BrowserRpcStreamFrame>,
|
||||
},
|
||||
cancel(reason: string) {
|
||||
cancels.push(reason);
|
||||
closed();
|
||||
},
|
||||
waitClosed: () => closure,
|
||||
};
|
||||
},
|
||||
});
|
||||
const stream = streamingRuntime(transport).bindServerStream(
|
||||
"WATCH_RPC_RESOURCES",
|
||||
isResourceView,
|
||||
);
|
||||
const consumer = new AbortController();
|
||||
|
||||
const opening = stream.open(
|
||||
{ resourceId: "r-1" },
|
||||
{ signal: consumer.signal },
|
||||
);
|
||||
const first = opening[Symbol.asyncIterator]();
|
||||
await expect(first.next()).resolves.toMatchObject({
|
||||
value: { ok: true },
|
||||
});
|
||||
// The consumer walks away: it aborts but never calls next() or return().
|
||||
consumer.abort();
|
||||
await new Promise((resolve) => setTimeout(resolve, 5));
|
||||
|
||||
expect(cancels).toHaveLength(1);
|
||||
const second = stream.open({ resourceId: "r-1" })[Symbol.asyncIterator]();
|
||||
await expect(second.next()).resolves.toMatchObject({
|
||||
value: { ok: true },
|
||||
});
|
||||
expect(opened).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
streamProfile,
|
||||
unaryOperation,
|
||||
unaryProfile,
|
||||
type ResourceView,
|
||||
} from "./fixture.ts";
|
||||
|
||||
describe("Browser RPC provider-neutral runtime", () => {
|
||||
|
||||
Reference in New Issue
Block a user