chore: sync the frontend template from 5434760 to ebea300
Carries 21 template commits: the shared IndexedDB connection/transaction
kernel and the four runtimes moved onto it, the adapter barrel boundary and
the architecture rule that enforces it, the feature adapter contribution
model, `feature-http-binding`, the split of several oversized test files,
and the release identity now derived from the package name.
Product identity is unchanged. The three hard-coded `tech-log-frontend/…`
verifier ids are gone because the template derives them from the package
name and this package is `tech-log-frontend`.
Two decisions worth naming. The platform HTTP executor is the template's
verbatim — it now takes the installed contract so a feature's types flow
through the binding — and TechLog's four gateways, which address operations
by id, reach it through one adapter at the composition root instead of being
rewritten here. And the three derived CI baselines were recomputed from the
merged `config/ci/gates.json` rather than taken from either side: 94 command
definitions, 106 references, 141 artifacts, gate shape `629e5898…`. The
method was checked by first reproducing the pre-merge values from the
pre-merge file.
Verified here: types, lint, architecture, adapter inventory, CI contract,
design system, diagnostics, remediation ledger, browser security and build
all pass; 1789 unit, 152 component, 415 TechLog, 102 integration, 19
reference-feature, 17 recipe and 7 contract tests pass. Five gates stay
red and every one was reproduced at b297d65 first: `check:i18n`,
`check:registries`, `test:runtime-schema`, `verify:documentation` and
`test:sample-removal`.
Full decision record, including what was deliberately not carried and the
five open follow-ups, in `docs/operations/template-sync-2026-09-21.md`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
b297d659f5
commit
afde2b1da1
@@ -1,6 +1,6 @@
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
||||
import { recordBootFailure } from "../adapters/diagnostics/bounded-diagnostics.ts";
|
||||
import { recordBootFailure } from "../adapters/diagnostics/index.ts";
|
||||
import { BootErrorShell } from "../presentation/boundaries/boot-error-shell.tsx";
|
||||
import "pretendard/dist/web/variable/pretendardvariable.css";
|
||||
import "@fontsource/ibm-plex-mono/400.css";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
createBrowserLifecycleRuntime,
|
||||
type BrowserLifecycleRuntime,
|
||||
} from "../adapters/platform/browser-lifecycle.ts";
|
||||
} from "../adapters/platform/index.ts";
|
||||
import type {
|
||||
ResolvedRuntimeCapabilities,
|
||||
RuntimeHealth,
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
ResolvedRuntimeCapabilities,
|
||||
} from "../contracts/runtime-capabilities.ts";
|
||||
import type { ServiceWorkerRuntimeHost } from "../contracts/service-worker.ts";
|
||||
import { createServiceWorkerPageController } from "../adapters/service-worker/service-worker-page-controller.ts";
|
||||
import { createServiceWorkerPageController } from "../adapters/service-worker/index.ts";
|
||||
|
||||
/**
|
||||
* §17.5. Composition-side factory. The host object is created without any
|
||||
|
||||
@@ -3,13 +3,14 @@ import {
|
||||
createExternalAuthSessionAdapter,
|
||||
createUnavailableSessionAdapter,
|
||||
type ExternalSessionOwner,
|
||||
} from "../adapters/auth/external-session-adapter.ts";
|
||||
import { createDiagnosticsAdapter } from "../adapters/diagnostics/bounded-diagnostics.ts";
|
||||
import { createHttpClient } from "../adapters/http/client.ts";
|
||||
} from "../adapters/auth/index.ts";
|
||||
import { createDiagnosticsAdapter } from "../adapters/diagnostics/index.ts";
|
||||
import {
|
||||
createContractHttpExecutor,
|
||||
createHttpClient,
|
||||
type HttpExecutionObservation,
|
||||
} from "../adapters/http/http-execution-v3.ts";
|
||||
type InstalledHttpOperationExecutor,
|
||||
} from "../adapters/http/index.ts";
|
||||
import {
|
||||
attemptBucket,
|
||||
durationBucket,
|
||||
@@ -19,14 +20,14 @@ import {
|
||||
import type { TelemetryEventName } from "../contracts/telemetry.ts";
|
||||
import { createBrowserCrossContextInvalidationFromHost } from "../adapters/cross-context-invalidation/index.ts";
|
||||
import {
|
||||
createConditionalValidatorStore,
|
||||
createQueryClient,
|
||||
createServerStateScopeRuntime,
|
||||
createTanStackCacheCoordinator,
|
||||
} from "../adapters/query-cache/tanstack-cache-coordinator.ts";
|
||||
import { createQueryClient } from "../adapters/query-cache/tanstack-query-cache.ts";
|
||||
import { createServerStateScopeRuntime } from "../adapters/query-cache/server-state-scope-runtime.ts";
|
||||
import { createConditionalValidatorStore } from "../adapters/query-cache/conditional-validator-store.ts";
|
||||
import { createBrowserStorageAdapter } from "../adapters/storage/browser-storage-adapter.ts";
|
||||
import { createBrowserMutationIntentFactory } from "../adapters/platform/browser-mutation-intent-factory.ts";
|
||||
import { createTelemetryAdapter } from "../adapters/telemetry/best-effort-telemetry.ts";
|
||||
} from "../adapters/query-cache/index.ts";
|
||||
import { createBrowserStorageAdapter } from "../adapters/storage/index.ts";
|
||||
import { createBrowserMutationIntentFactory } from "../adapters/platform/index.ts";
|
||||
import { createTelemetryAdapter } from "../adapters/telemetry/index.ts";
|
||||
import { createCsrfTokenProvider } from "../features/tech-log/adapters/http/studio-session-csrf.ts";
|
||||
import {
|
||||
attachStudioSessionCredentials,
|
||||
@@ -69,6 +70,21 @@ import {
|
||||
} from "../contracts/query-invalidation.ts";
|
||||
|
||||
type HttpClientDependencies = Parameters<typeof createHttpClient>[0];
|
||||
/**
|
||||
* 제품이 V2 전송을 쓰려면 채워야 하는 슬롯 네 개.
|
||||
*
|
||||
* 이 템플릿은 넷 다 비워서 출하한다. 기본값인
|
||||
* `contracts/api-operations.ts`의 `API_OPERATIONS`는 빈 객체이고
|
||||
* `adapters/http/resource-mapper.ts`의 `mapOperationPayload`는 항상
|
||||
* `MAPPING_INVARIANT_REJECTED`를 반환한다. 그래서 **이 레포 상태 그대로는
|
||||
* V2로 어떤 오퍼레이션도 실행되지 않는다** — 그건 결함이 아니라 제품이
|
||||
* 채우는 자리다.
|
||||
*
|
||||
* V2를 rollback/compatibility 경로로 쓰려는 제품은 이 네 슬롯을 주입해야
|
||||
* 한다. 주입하지 않은 채 V3에서 되돌리면 모든 요청이 실패한다.
|
||||
* V3(`createContractHttpExecutor`)는 설치된 feature 계약에서 오퍼레이션을
|
||||
* 받으므로 이 슬롯과 무관하게 동작한다.
|
||||
*/
|
||||
export type RuntimeHttpContract = Pick<
|
||||
HttpClientDependencies,
|
||||
"getOperation" | "validatePayload" | "validateRequest" | "mapPayload"
|
||||
@@ -436,10 +452,10 @@ export async function createRuntimeAdapters(
|
||||
* entirely and must set the header itself. If each built its own provider,
|
||||
* one Studio session would hold two different tokens.
|
||||
*
|
||||
* `execute` calls `getStudioSession` through `contractOperations`, which is
|
||||
* declared further below — a real ordering hazard, since `attachCredentials`
|
||||
* (needed to build `contractHttp`, needed to build `contractOperations`)
|
||||
* needs this provider first.
|
||||
* `execute` calls `getStudioSession` through `techLogOperations`, which is
|
||||
* assigned further below — a real ordering hazard, since `attachCredentials`
|
||||
* (needed to build `contractHttp`, needed to build `contractOperations`,
|
||||
* needed to build `techLogOperations`) needs this provider first.
|
||||
*
|
||||
* Fix round 1 (C1). The original comment here claimed "`getStudioSession`
|
||||
* is a SAFE operation and needs no CSRF, so there is no true cycle" — that
|
||||
@@ -462,17 +478,17 @@ export async function createRuntimeAdapters(
|
||||
* `await` between this declaration and the real assignment, where a stub
|
||||
* fails loudly instead.
|
||||
*/
|
||||
let contractOperations: TechLogStudioOperationExecutor = Object.freeze({
|
||||
let techLogOperations: TechLogStudioOperationExecutor = Object.freeze({
|
||||
async execute() {
|
||||
throw new Error(
|
||||
"contractOperations used before assignment in createRuntimeAdapters — " +
|
||||
"techLogOperations used before assignment in createRuntimeAdapters — " +
|
||||
"construction order regressed.",
|
||||
);
|
||||
},
|
||||
});
|
||||
const techLogCsrf = createCsrfTokenProvider({
|
||||
async execute(options) {
|
||||
const outcome = await contractOperations.execute(
|
||||
const outcome = await techLogOperations.execute(
|
||||
"getStudioSession",
|
||||
{},
|
||||
{
|
||||
@@ -554,19 +570,13 @@ export async function createRuntimeAdapters(
|
||||
},
|
||||
observe: createHttpObservationProjector({ diagnostics, telemetry }),
|
||||
});
|
||||
contractOperations = Object.freeze({
|
||||
async execute(
|
||||
operationId: string,
|
||||
input: unknown,
|
||||
executionContext: Readonly<{
|
||||
routeId: string;
|
||||
signal?: AbortSignal;
|
||||
intent?: MutationIntent;
|
||||
}>,
|
||||
) {
|
||||
const operation =
|
||||
COMPOSED_CONTRACT_CONTRIBUTIONS.httpByOperationId.get(operationId);
|
||||
if (!operation) {
|
||||
const contractOperations: InstalledHttpOperationExecutor = Object.freeze({
|
||||
async execute(operation, input, executionContext) {
|
||||
const installed =
|
||||
COMPOSED_CONTRACT_CONTRIBUTIONS.httpByOperationId.get(
|
||||
operation.contract.operationId,
|
||||
);
|
||||
if (!installed) {
|
||||
return Object.freeze({
|
||||
kind: "CONTRACT_VIOLATION" as const,
|
||||
effect: "NOT_STARTED" as const,
|
||||
@@ -576,7 +586,11 @@ export async function createRuntimeAdapters(
|
||||
}),
|
||||
});
|
||||
}
|
||||
const outcome = await contractHttp.execute(operation, input, {
|
||||
// composeContractContributions deliberately snapshots every installed
|
||||
// contract. Runtime authority is therefore the validated registry entry,
|
||||
// not object identity with the feature-owned source declaration.
|
||||
const executableContract = installed as typeof operation;
|
||||
const outcome = await contractHttp.execute(executableContract, input, {
|
||||
routeId: executionContext.routeId,
|
||||
scope: serverStateScope.getSnapshot(),
|
||||
...(executionContext.signal === undefined
|
||||
@@ -608,8 +622,52 @@ export async function createRuntimeAdapters(
|
||||
return outcome;
|
||||
},
|
||||
});
|
||||
/**
|
||||
* Template sync (ebea300). The platform executor above now takes the
|
||||
* installed contract itself, so a feature's Input/WireOutput/Problem types
|
||||
* flow through `createFeatureHttpBinding`. TechLog's four HTTP gateways
|
||||
* still address operations by id through its own `StudioOperationExecutor`,
|
||||
* so the id is resolved to the installed contract here — at the one place
|
||||
* that already owns the registry — instead of being resolved inside the
|
||||
* platform executor for every caller. Porting those gateways onto the typed
|
||||
* binding is its own change; nothing about it is decided here.
|
||||
*
|
||||
* `!installed` returns the same `FINAL_REQUEST_INVARIANT_FAILED` violation
|
||||
* the platform executor returns for an operation that is not installed, so
|
||||
* an unregistered id fails identically on both paths.
|
||||
*/
|
||||
techLogOperations = Object.freeze({
|
||||
async execute(
|
||||
operationId: string,
|
||||
input: unknown,
|
||||
executionContext: Readonly<{
|
||||
routeId: string;
|
||||
signal?: AbortSignal;
|
||||
intent?: MutationIntent;
|
||||
}>,
|
||||
) {
|
||||
const installed =
|
||||
COMPOSED_CONTRACT_CONTRIBUTIONS.httpByOperationId.get(operationId);
|
||||
if (!installed) {
|
||||
return Object.freeze({
|
||||
kind: "CONTRACT_VIOLATION" as const,
|
||||
effect: "NOT_STARTED" as const,
|
||||
violation: Object.freeze({
|
||||
kind: "FINAL_REQUEST_INVARIANT_FAILED" as const,
|
||||
operation: "REQUEST" as const,
|
||||
}),
|
||||
});
|
||||
}
|
||||
return contractOperations.execute(
|
||||
installed as Parameters<typeof contractOperations.execute>[0],
|
||||
input,
|
||||
executionContext,
|
||||
);
|
||||
},
|
||||
});
|
||||
const featureInputs = createInstalledFeatureInputs({
|
||||
contractOperations,
|
||||
http: contractOperations,
|
||||
contractOperations: techLogOperations,
|
||||
studioSource: config.TECH_LOG_STUDIO_SOURCE,
|
||||
publicSource: config.TECH_LOG_PUBLIC_SOURCE,
|
||||
apiBaseUrl: config.API_BASE_URL,
|
||||
|
||||
Reference in New Issue
Block a user