chore: sync the frontend template from 4dc033c to 8157ad4
The product was materialized from the template at `4dc033c` and has stayed on it through 43 template commits, so it was missing all three rounds of adapter remediation — including files it never had, such as the shared `abortable-operation` primitive and the `exact-snapshot` decoder that later fixes are written against. Taking only the newest round was not possible for that reason: the delta is coherent only as a whole. The product had not touched `src/adapters` at all since materialization, so the 140-file delta applied with a three-way merge and no conflicts. `package.json` was the single overlap and merged cleanly: the product owns `name`, the template contributed `check:adapter-inventory`, `check:remediation-ledger` and the image-resolve-signal type fixture. All 24 product-owned files — README, index.html, CI workflow, i18n catalog, home page, generated schemas, evidence scripts, component and visual snapshots — are byte-identical to `main`. `template.lock.json` now pins the synced revision and tree. Verified in this repository, not inherited from the template: six type projects, lint, nine gates (adapter inventory, remediation ledger, registries, diagnostics, realtime boundaries, architecture, browser file/storage boundaries, optional recipes, documentation), the production build, and 2,054 of 2,073 tests. The 19 failures are all in `tests/unit/ci-artifact-contract.test.ts` and are the same pre-existing sandbox RLIMIT, EMFILE, umask and `/tmp` permission behaviour the template records; four suites that failed once under parallel load pass in isolation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
002ba3624e
commit
4bff9ca151
@@ -214,6 +214,47 @@ describe("live/poll authoritative writer handoff", () => {
|
||||
void second;
|
||||
});
|
||||
|
||||
it("tracks a retired active writer after handoff queue overflow", async () => {
|
||||
let release: ((result: RealtimeResult<void>) => void) | undefined;
|
||||
const harness = createHarness({
|
||||
limits: {
|
||||
...limits,
|
||||
maxActiveQueueCount: 2,
|
||||
maxActiveQueueBytes: 10,
|
||||
},
|
||||
apply: vi.fn(async ({ value }) => {
|
||||
if (value === "first") {
|
||||
return await new Promise<RealtimeResult<void>>((resolve) => {
|
||||
release = resolve;
|
||||
});
|
||||
}
|
||||
return realtimeSuccess(undefined);
|
||||
}),
|
||||
});
|
||||
const writer = harness.coordinator.currentWriter()!;
|
||||
const first = writer.write("first", 5);
|
||||
const second = writer.write("second", 5);
|
||||
await flush();
|
||||
await expect(writer.write("overflow", 1)).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: { kind: "QUEUE_OVERFLOW" },
|
||||
});
|
||||
|
||||
// R-03. The fail-close dropped the active reference, but the writer is
|
||||
// still running, so close() must not claim quiescence.
|
||||
const closing = harness.coordinator.close();
|
||||
await flush();
|
||||
harness.clock.advance(100);
|
||||
await expect(closing).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: { kind: "IDLE_TIMEOUT", operation: "CLOSE" },
|
||||
});
|
||||
|
||||
release?.(realtimeSuccess(undefined));
|
||||
void first;
|
||||
void second;
|
||||
});
|
||||
|
||||
it("fences and aborts live, waits for quiescence, then recovers before activating poll", async () => {
|
||||
const liveEffect = deferred<RealtimeResult<void>>();
|
||||
const checkpoint = deferred<RealtimeResult<void>>();
|
||||
@@ -486,12 +527,87 @@ describe("live/poll authoritative writer handoff", () => {
|
||||
ok: false,
|
||||
error: { kind: "IDLE_TIMEOUT", operation: "CLOSE" },
|
||||
});
|
||||
await expect(harness.coordinator.close()).resolves.toMatchObject({
|
||||
// RT-RR-03. A second close re-runs rather than replaying a cached verdict.
|
||||
// The writer is still hung, so it still reports a timeout.
|
||||
const second = harness.coordinator.close();
|
||||
await flush();
|
||||
harness.clock.advance(100);
|
||||
await expect(second).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: { kind: "IDLE_TIMEOUT", operation: "CLOSE" },
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* RT-RR-03. Caching the first timeout forever meant a writer that later
|
||||
* settled could never be proved quiescent: every subsequent close replayed
|
||||
* the stale failure and the retained registry could never be pruned.
|
||||
*/
|
||||
it("converges to success once a retired writer finally settles", async () => {
|
||||
let release: ((value: RealtimeResult<void>) => void) | undefined;
|
||||
const harness = createHarness({
|
||||
apply: vi.fn(
|
||||
async () =>
|
||||
await new Promise<RealtimeResult<void>>((resolve) => {
|
||||
release = resolve;
|
||||
}),
|
||||
),
|
||||
});
|
||||
const live = harness.coordinator.currentWriter()!;
|
||||
void live.write("late-settle", 8);
|
||||
await flush();
|
||||
|
||||
const first = harness.coordinator.close();
|
||||
await flush();
|
||||
harness.clock.advance(100);
|
||||
await expect(first).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: { kind: "IDLE_TIMEOUT", operation: "CLOSE" },
|
||||
});
|
||||
|
||||
// The writer finishes after the first close gave up.
|
||||
release?.(realtimeSuccess(undefined));
|
||||
await flush();
|
||||
await flush();
|
||||
|
||||
const second = harness.coordinator.close();
|
||||
await flush();
|
||||
harness.clock.advance(100);
|
||||
await expect(second).resolves.toMatchObject({ ok: true });
|
||||
});
|
||||
|
||||
/**
|
||||
* RT-RR-04. Checkpoint work is an external authority call like a writer
|
||||
* tail. Racing it against a timeout bounded the public wait but left it out
|
||||
* of the retained registry, so `close()` could report quiescence while the
|
||||
* checkpoint was still running.
|
||||
*/
|
||||
it("does not report quiescence while a checkpoint is still running", async () => {
|
||||
let checkpointSignal: AbortSignal | undefined;
|
||||
const harness = createHarness({
|
||||
recover: vi.fn(async ({ signal }) => {
|
||||
checkpointSignal = signal;
|
||||
return await new Promise<RealtimeResult<void>>(() => {});
|
||||
}),
|
||||
});
|
||||
|
||||
const transition = harness.coordinator.switchToPoll();
|
||||
await flush();
|
||||
expect(checkpointSignal).toBeDefined();
|
||||
|
||||
const closing = harness.coordinator.close();
|
||||
await flush();
|
||||
harness.clock.advance(100);
|
||||
await expect(closing).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: { kind: "IDLE_TIMEOUT", operation: "CLOSE" },
|
||||
});
|
||||
|
||||
harness.clock.advance(100);
|
||||
await flush();
|
||||
await transition;
|
||||
});
|
||||
|
||||
it("rejects invalid initial authority and resource ceilings", () => {
|
||||
expect(() =>
|
||||
createLivePollHandoffCoordinator({
|
||||
|
||||
Reference in New Issue
Block a user