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:
@@ -8,7 +8,6 @@ import type {
|
||||
OpfsStorageScope,
|
||||
} from "../../src/application/ports/browser-file-storage/opfs-ports.ts";
|
||||
import type {
|
||||
BrowserDataResult,
|
||||
BrowserStoragePolicy,
|
||||
ByteSource,
|
||||
} from "../../src/application/ports/browser-file-storage/shared.ts";
|
||||
@@ -630,7 +629,7 @@ describe("OPFS byte-store coordinator", () => {
|
||||
},
|
||||
{
|
||||
async abortPreparedPut() {
|
||||
return browserDataSuccess({ kind: "EFFECT_UNKNOWN" as const });
|
||||
return browserDataFailure("UNAVAILABLE", "OBJECT_RECONCILE");
|
||||
},
|
||||
},
|
||||
]) {
|
||||
@@ -666,11 +665,120 @@ describe("OPFS byte-store coordinator", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("does not roll back journal after an unknown worker mutation effect", async () => {
|
||||
it("05-01 decides a reconciled row from what the journal holds once its lock is taken", async () => {
|
||||
// Listed while its owner still ran, the row was PREPARING. By the time
|
||||
// the owner let go it had committed and only finalization failed, so the
|
||||
// staging receipt names the committed generation. Cleaning it up from the
|
||||
// stale snapshot would delete a committed object.
|
||||
const journal = createJournal();
|
||||
const row: OpfsJournalTransaction = {
|
||||
transactionId: "transaction_12345678",
|
||||
fencingToken: "fencing_12345678",
|
||||
mutation: "PUT",
|
||||
scope,
|
||||
phase: "PREPARING",
|
||||
objectId: "object_12345678",
|
||||
expectedGeneration: null,
|
||||
targetGeneration: 1,
|
||||
targetByteLength: 1,
|
||||
targetStoragePolicy: storagePolicy,
|
||||
budgetReservation: {
|
||||
namespace: scope.namespace,
|
||||
reservedBytes: 1,
|
||||
hardBudgetBytes: storagePolicy.hardBudgetBytes,
|
||||
},
|
||||
startedAtEpochMs: 100,
|
||||
};
|
||||
journal.transactions.set(row.transactionId, {
|
||||
...row,
|
||||
phase: "COMMITTED",
|
||||
preparedObject: committedObject("object_12345678", storagePolicy, 100),
|
||||
});
|
||||
vi.spyOn(journal, "listIncomplete").mockResolvedValueOnce(
|
||||
browserDataSuccess({ transactions: [row], moreAvailable: false }),
|
||||
);
|
||||
const worker = createWorker();
|
||||
const cleanupTransaction = vi.spyOn(worker, "cleanupTransaction");
|
||||
const finalizePut = vi.spyOn(worker, "finalizePut");
|
||||
const adapter = createOpfsByteStoreAdapter({
|
||||
journal,
|
||||
worker,
|
||||
scope,
|
||||
storagePolicy,
|
||||
now: () => 100,
|
||||
});
|
||||
|
||||
expect(await adapter.maintenance.reconcile()).toMatchObject({
|
||||
ok: true,
|
||||
value: { inspectedTransactions: 1, rolledBackTransactions: 0 },
|
||||
});
|
||||
expect(cleanupTransaction).not.toHaveBeenCalled();
|
||||
expect(finalizePut).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("05-02 skips a row it cannot reconcile, settles the rest and still runs orphan GC", async () => {
|
||||
const journal = createJournal();
|
||||
const row = (transactionId: string): OpfsJournalTransaction => ({
|
||||
transactionId,
|
||||
fencingToken: "fencing_12345678",
|
||||
mutation: "PUT",
|
||||
scope,
|
||||
phase: "PREPARING",
|
||||
objectId: `object_${transactionId.slice(-8)}`,
|
||||
expectedGeneration: null,
|
||||
targetGeneration: 1,
|
||||
targetByteLength: 1,
|
||||
targetStoragePolicy: storagePolicy,
|
||||
budgetReservation: {
|
||||
namespace: scope.namespace,
|
||||
reservedBytes: 1,
|
||||
hardBudgetBytes: storagePolicy.hardBudgetBytes,
|
||||
},
|
||||
startedAtEpochMs: 100,
|
||||
});
|
||||
journal.transactions.set("transaction_broken_1", row("transaction_broken_1"));
|
||||
journal.transactions.set("transaction_healthy_1", row("transaction_healthy_1"));
|
||||
const worker = createWorker({
|
||||
async cleanupTransaction(_scope, transactionId) {
|
||||
return transactionId === "transaction_broken_1"
|
||||
? browserDataFailure("CORRUPT_DATA", "OBJECT_RECONCILE")
|
||||
: browserDataSuccess({ kind: "CLEANED" as const });
|
||||
},
|
||||
});
|
||||
const listOrphanCandidates = vi.spyOn(worker, "listOrphanCandidates");
|
||||
const observations: unknown[] = [];
|
||||
const adapter = createOpfsByteStoreAdapter({
|
||||
journal,
|
||||
worker,
|
||||
scope,
|
||||
storagePolicy,
|
||||
now: () => 100,
|
||||
observer: (event) => observations.push(event),
|
||||
});
|
||||
|
||||
expect(await adapter.maintenance.reconcile()).toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
inspectedTransactions: 2,
|
||||
failedTransactions: 1,
|
||||
rolledBackTransactions: 1,
|
||||
orphanGcStatus: "COMPLETED",
|
||||
},
|
||||
});
|
||||
expect([...journal.transactions.keys()]).toEqual(["transaction_broken_1"]);
|
||||
expect(listOrphanCandidates).toHaveBeenCalledTimes(1);
|
||||
expect(observations).toContainEqual({
|
||||
operation: "OBJECT_RECONCILE",
|
||||
outcome: "FAILED",
|
||||
failureCode: "CORRUPT_DATA",
|
||||
});
|
||||
});
|
||||
|
||||
it("does not roll back journal after an unconfirmed worker cleanup", async () => {
|
||||
const journal = createJournal();
|
||||
const worker = createWorker({
|
||||
async abortPreparedPut() {
|
||||
return browserDataSuccess({ kind: "EFFECT_UNKNOWN" as const });
|
||||
return browserDataFailure("UNAVAILABLE", "OBJECT_RECONCILE");
|
||||
},
|
||||
});
|
||||
const rollback = vi.spyOn(journal, "rollback");
|
||||
@@ -697,6 +805,130 @@ describe("OPFS byte-store coordinator", () => {
|
||||
expect(rollback).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
/**
|
||||
* Q-6.5-9. A failed compensation leaves the journal row for reconciliation,
|
||||
* but the caller still needs to know why the put failed: a cancel or a full
|
||||
* disk must not turn into a bare CONFLICT.
|
||||
*/
|
||||
describe("Q-6.5-9 keeps the put's own failure when compensation fails", () => {
|
||||
const quota = browserDataFailure("QUOTA_EXCEEDED", "OBJECT_WRITE", {
|
||||
retryable: true,
|
||||
recovery: "READ_ONLY",
|
||||
});
|
||||
|
||||
async function putWith(
|
||||
worker: Partial<OpfsWorkerGateway>,
|
||||
journal = createJournal(),
|
||||
) {
|
||||
const adapter = createOpfsByteStoreAdapter({
|
||||
journal,
|
||||
worker: createWorker(worker),
|
||||
scope,
|
||||
storagePolicy,
|
||||
createTransactionId: () => "transaction_12345678",
|
||||
now: () => 100,
|
||||
});
|
||||
return await adapter.objects.put({
|
||||
objectId: "object_12345678",
|
||||
expectedGeneration: null,
|
||||
mediaType: "application/octet-stream",
|
||||
source: sourceFrom(new Uint8Array([1])),
|
||||
});
|
||||
}
|
||||
|
||||
it.each([
|
||||
[
|
||||
"a failed cleanup",
|
||||
async () => browserDataFailure("UNAVAILABLE", "OBJECT_RECONCILE"),
|
||||
],
|
||||
[
|
||||
"an aborted cleanup",
|
||||
async () => browserDataFailure("ABORTED", "OBJECT_RECONCILE"),
|
||||
],
|
||||
])("after %s", async (_label, abortPreparedPut) => {
|
||||
const journal = createJournal();
|
||||
expect(
|
||||
await putWith(
|
||||
{ preparePut: async () => quota, abortPreparedPut },
|
||||
journal,
|
||||
),
|
||||
).toEqual({
|
||||
ok: false,
|
||||
error: {
|
||||
code: "QUOTA_EXCEEDED",
|
||||
operation: "OBJECT_WRITE",
|
||||
retryable: true,
|
||||
recovery: "RECONCILE",
|
||||
},
|
||||
});
|
||||
expect(
|
||||
journal.transactions.get("transaction_12345678")?.phase,
|
||||
).toBe("PREPARING");
|
||||
});
|
||||
|
||||
it("keeps a caller cancel as ABORTED", async () => {
|
||||
expect(
|
||||
await putWith({
|
||||
preparePut: async () =>
|
||||
browserDataFailure("ABORTED", "OBJECT_WRITE"),
|
||||
abortPreparedPut: async () =>
|
||||
browserDataFailure("UNAVAILABLE", "OBJECT_RECONCILE"),
|
||||
}),
|
||||
).toMatchObject({
|
||||
ok: false,
|
||||
error: { code: "ABORTED", recovery: "RECONCILE" },
|
||||
});
|
||||
});
|
||||
|
||||
it("after a failed journal rollback", async () => {
|
||||
const journal = createJournal();
|
||||
vi.spyOn(journal, "rollback").mockResolvedValueOnce(
|
||||
browserDataFailure("UNAVAILABLE", "OBJECT_RECONCILE"),
|
||||
);
|
||||
expect(
|
||||
await putWith({ preparePut: async () => quota }, journal),
|
||||
).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
code: "QUOTA_EXCEEDED",
|
||||
operation: "OBJECT_WRITE",
|
||||
recovery: "RECONCILE",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("after FILES_READY could not be recorded", async () => {
|
||||
const journal = createJournal();
|
||||
vi.spyOn(journal, "markFilesReady").mockResolvedValueOnce(
|
||||
browserDataFailure("UNAVAILABLE", "OBJECT_RECONCILE", {
|
||||
retryable: true,
|
||||
recovery: "REOPEN",
|
||||
}),
|
||||
);
|
||||
expect(
|
||||
await putWith(
|
||||
{
|
||||
abortPreparedPut: async () =>
|
||||
browserDataFailure("UNAVAILABLE", "OBJECT_RECONCILE"),
|
||||
},
|
||||
journal,
|
||||
),
|
||||
).toEqual({
|
||||
ok: false,
|
||||
error: {
|
||||
code: "UNAVAILABLE",
|
||||
operation: "OBJECT_WRITE",
|
||||
retryable: true,
|
||||
recovery: "RECONCILE",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("returns the put's failure unchanged when compensation succeeds", async () => {
|
||||
expect(await putWith({ preparePut: async () => quota })).toEqual(quota);
|
||||
});
|
||||
});
|
||||
|
||||
it("holds the OPFS mutation lease until exact physical cleanup completes", async () => {
|
||||
const journal = createJournal();
|
||||
const observed: Array<Readonly<Record<string, unknown>>> = [];
|
||||
@@ -1100,11 +1332,13 @@ describe("OPFS byte-store coordinator", () => {
|
||||
orphanGcStatus: "COMPLETED",
|
||||
},
|
||||
});
|
||||
// The first page carries no cursor.
|
||||
expect(listOrphans).toHaveBeenCalledWith(
|
||||
scope,
|
||||
expect.any(Number),
|
||||
expect.any(Number),
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
expect(deleteOrphan).toHaveBeenCalledWith(
|
||||
scope,
|
||||
|
||||
Reference in New Issue
Block a user