feat: select the TechLog Studio adapter from runtime configuration

Adds TECH_LOG_STUDIO_SOURCE (MOCK | HTTP, default MOCK) to the V2 runtime
config schema so a build can switch createTechLogFeatureInstalledInput
between the mock and HTTP Studio gateways without a rebuild. V1 documents
predate the key and always normalize to MOCK. The HTTP gateway is
constructed with only { operations } per Task 4's actual signature -
no CSRF provider is wired here; that lands with attachCredentials at a
later composition-root task.

Updates every existing Studio test call site to the new required
createTechLogFeatureInstalledInput(context) signature via a shared
tests/helpers/studio-install-context.ts MOCK fixture, so the whole
existing Studio suite keeps exercising the mock adapter unchanged.
This commit is contained in:
DongHyeonka
2026-08-18 01:57:15 +09:00
parent 7424ed4594
commit 3b641906b8
31 changed files with 169 additions and 47 deletions
@@ -7,6 +7,7 @@ import { MemoryRouter } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createTechLogFeatureInstalledInput } from "../../../src/features/tech-log/adapters/create-tech-log-feature-input.ts";
import { MOCK_STUDIO_INSTALL_CONTEXT } from "../../helpers/studio-install-context.ts";
import { FIXTURE_IDS } from "../../../src/features/tech-log/adapters/mock/fixtures.ts";
import { StudioGatewayError } from "../../../src/features/tech-log/application/ports/studio-gateway-error.ts";
import type { StudioGateway } from "../../../src/features/tech-log/application/ports/studio-gateway.ts";
@@ -104,7 +105,7 @@ async function getSavedDocument(gateway: StudioGateway) {
describe("TechLog Studio save workflow", () => {
it("shows save pending and success states and creates a fresh idempotency key for each command", async () => {
const user = userEvent.setup();
const base = createTechLogFeatureInstalledInput().input.createStudioGateway();
const base = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
const first = deferred<void>();
const keys: string[] = [];
let calls = 0;
@@ -144,7 +145,7 @@ describe("TechLog Studio save workflow", () => {
it("keeps the local draft and disables overwrite after a revision conflict", async () => {
const user = userEvent.setup();
const gateway = createTechLogFeatureInstalledInput().input.createStudioGateway();
const gateway = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
renderEditor(FIXTURE_IDS.conflictCase, gateway);
await user.clear(await screen.findByLabelText("제목"));
@@ -161,7 +162,7 @@ describe("TechLog Studio save workflow", () => {
it("surfaces a save error and retries with a new user-command key without losing input", async () => {
const user = userEvent.setup();
const base = createTechLogFeatureInstalledInput().input.createStudioGateway();
const base = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
const keys: string[] = [];
const retryable = new StudioGatewayError({
type: "https://techlog.local/problems/studio-unavailable",
@@ -203,7 +204,7 @@ describe("TechLog Studio save workflow", () => {
describe("TechLog Studio dirty navigation", () => {
it("opens the source modal dialog, protects browser unload, and restores focus when staying", async () => {
const user = userEvent.setup();
const gateway = createTechLogFeatureInstalledInput().input.createStudioGateway();
const gateway = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
const destinations: string[] = [];
const saved = await getSavedDocument(gateway);
render(
@@ -240,7 +241,7 @@ describe("TechLog Studio dirty navigation", () => {
it("discards the draft and follows the pending internal destination", async () => {
const user = userEvent.setup();
const gateway = createTechLogFeatureInstalledInput().input.createStudioGateway();
const gateway = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
const destinations: string[] = [];
const saved = await getSavedDocument(gateway);
render(
@@ -263,7 +264,7 @@ describe("TechLog Studio dirty navigation", () => {
it("saves the draft before following the pending destination", async () => {
const user = userEvent.setup();
const base = createTechLogFeatureInstalledInput().input.createStudioGateway();
const base = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway();
const pending = deferred<WorkingCopyDetail>();
let key = "";
const gateway = {