refactor: 템플릿에서 기본적으로 제공하고 있는 워크 플로우에 디자인과 라우팅 흡수

This commit is contained in:
donghyeon-ka
2026-09-23 12:42:10 +09:00
parent afde2b1da1
commit aaa384c145
181 changed files with 12553 additions and 5280 deletions
+2
View File
@@ -5,6 +5,8 @@ import { BootErrorShell } from "../presentation/boundaries/boot-error-shell.tsx"
import "pretendard/dist/web/variable/pretendardvariable.css";
import "@fontsource/ibm-plex-mono/400.css";
import "@fontsource/ibm-plex-mono/500.css";
import "../presentation/styles/theme.css";
import "../features/tech-log/presentation/styles/tech-log-theme.css";
import "../features/tech-log/presentation/styles/globals.css";
import "../features/tech-log/presentation/styles/studio.css";
import "../features/tech-log/presentation/styles/studio-editor.css";
+16 -55
View File
@@ -33,7 +33,6 @@ import {
attachStudioSessionCredentials,
invalidateTechLogCsrfOnOutcome,
} from "../features/tech-log/adapters/http/studio-session-credentials.ts";
import type { StudioOperationExecutor as TechLogStudioOperationExecutor } from "../features/tech-log/adapters/http/http-studio-gateway.ts";
import type { AuthSessionPort } from "../application/ports/auth-session-port.ts";
import type { ReleaseInfo } from "../application/ports/release-info-port.ts";
import {
@@ -41,7 +40,6 @@ import {
INSTALLED_REST_AUTH_PROFILES,
} from "../contracts/rest-profiles.ts";
import type { ClockPort } from "../application/ports/clock-port.ts";
import type { MutationIntent } from "../contracts/mutation-intent.ts";
import { createInstalledFeatureInputs } from "../features/installed-feature-adapters.ts";
import {
INVALIDATION_REGISTRY,
@@ -64,6 +62,7 @@ import {
import type { RuntimeConfigLoadResult } from "./load-runtime-config.ts";
import { createServerStateGenerationStore } from "./server-state-generation-store.ts";
import { COMPOSED_CONTRACT_CONTRIBUTIONS } from "../features/installed-contract-contributions.ts";
import { TECH_LOG_STUDIO_SESSION_CONTRACT } from "../features/tech-log/contracts/tech-log-studio-contract-contribution.ts";
import {
indexInvalidationRegistry,
indexInvalidationTopicVersions,
@@ -452,10 +451,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 `techLogOperations`, which is
* `execute` calls `getStudioSession` through `contractOperations`, 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.
* needed to build `contractOperations`) 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
@@ -478,18 +477,18 @@ export async function createRuntimeAdapters(
* `await` between this declaration and the real assignment, where a stub
* fails loudly instead.
*/
let techLogOperations: TechLogStudioOperationExecutor = Object.freeze({
let contractOperations: InstalledHttpOperationExecutor = Object.freeze({
async execute() {
throw new Error(
"techLogOperations used before assignment in createRuntimeAdapters — " +
"contractOperations used before assignment in createRuntimeAdapters — " +
"construction order regressed.",
);
},
});
const techLogCsrf = createCsrfTokenProvider({
async execute(options) {
const outcome = await techLogOperations.execute(
"getStudioSession",
const outcome = await contractOperations.execute(
TECH_LOG_STUDIO_SESSION_CONTRACT,
{},
{
routeId: "TECH_LOG_STUDIO",
@@ -499,8 +498,14 @@ export async function createRuntimeAdapters(
if (outcome.kind !== "SUCCESS") {
throw new Error("studio session is unavailable");
}
const value = outcome.value as { csrfToken: string; csrfHeaderName: string };
return { csrfToken: value.csrfToken, csrfHeaderName: value.csrfHeaderName };
const value = outcome.value as {
csrfToken: string;
csrfHeaderName: string;
};
return {
csrfToken: value.csrfToken,
csrfHeaderName: value.csrfHeaderName,
};
},
});
const contractHttp = createContractHttpExecutor({
@@ -570,7 +575,7 @@ export async function createRuntimeAdapters(
},
observe: createHttpObservationProjector({ diagnostics, telemetry }),
});
const contractOperations: InstalledHttpOperationExecutor = Object.freeze({
contractOperations = Object.freeze({
async execute(operation, input, executionContext) {
const installed =
COMPOSED_CONTRACT_CONTRIBUTIONS.httpByOperationId.get(
@@ -622,52 +627,8 @@ 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({
http: contractOperations,
contractOperations: techLogOperations,
studioSource: config.TECH_LOG_STUDIO_SOURCE,
publicSource: config.TECH_LOG_PUBLIC_SOURCE,
apiBaseUrl: config.API_BASE_URL,