Commit Graph
10 Commits
Author SHA1 Message Date
DongHyeonka 8e0ea60eac perf(tech-log): MOCK 소스와 Studio gateway를 첫 사용 때 받는다
문제
런타임 문서가 MOCK·HTTP를 고르므로 두 소스가 모든 빌드에 들어간다.
기능 입력 조립(create-tech-log-feature-input.ts)이 MOCK 공개 콘텐츠,
MOCK·HTTP Studio gateway를 정적으로 가져와, 운영(HTTP) 공개 화면을
여는 사람도 그 코드를 초기 JS로 받았다. MOCK이 쓰는 content-format은
마크다운 파서(micromark·mdast·unified)까지 끌고 왔다. 초기 JS는 main
에서 300,869 B(gzip)로 예산 204,800 B를 넘는다(FE-GATE-012).

고른 방법
- 포트는 이미 모두 Promise를 돌려준다. deferAsyncPort가 포트를 먼저
  만들고 첫 호출에서 구현 모듈을 동적 import해 넘긴다. 호출하는 쪽과
  feature input의 모양(publicContent, createStudioApplication)은 그대로다.
  - 포트 키 목록은 `Record<keyof Port, true>`로 적어, 포트에 메서드가
    늘거나 줄면 타입 검사가 실패한다.
  - 구현 받기에 실패하면 잊고 다음 호출에서 다시 받는다.
- MOCK 공개 콘텐츠는 첫 조회 때 받는다. HTTP 공개 gateway는 공개 첫
  화면의 데이터 요청에 쓰이므로 그대로 둔다.
- Studio gateway 셋(MOCK이면 Studio state 하나를 나눠 씀)은 묶음 하나로
  받는다(mock-studio-gateways.ts, http-studio-gateways.ts).
  createStudioApplication은 Studio가 마운트될 때 불리므로 그때 바로 받기
  시작한다(startNow). 첫 조회 때 받으면 화면 청크 → 조회 → gateway 청크
  → 요청으로 한 번 더 기다린다.

버린 대안
- createStudioApplication을 async로 바꾸기: StudioProvider와 시험 15곳이
  함께 바뀐다. 포트가 이미 비동기라 필요 없다.
- 공개 HTTP gateway도 지연 로드: 첫 화면 데이터 요청 앞에 청크 왕복이
  하나 생긴다.

위험·한계
- MOCK 빌드(로컬·e2e·visual)는 첫 공개 조회와 첫 Studio 조회 앞에 청크를
  한 번 받는다.
- 포트 메서드가 동기 값을 돌려주게 바뀌면 이 방식은 맞지 않는다. 타입
  제약(모든 멤버가 Promise를 돌려줌)이 그때 컴파일에서 막는다.

검증
- desktop CI env 빌드: 초기 JS 300,869 → 232,337 B(Studio 셸 지연을
  포함한 측정, 다음 커밋). 빠진 모듈 179개 중 npm(마크다운 파서) 약
  88 KB, mock 23 KB, static 11 KB(모듈 단독 gzip 합).
- tests/features/tech-log/deferred-async-port.test.ts: 한 번만 받기, 동시
  첫 호출, 실패 뒤 다시 받기, 키·freeze, gateway 셋의 state 공유, startNow.
2026-11-12 22:33:48 +09:00
DongHyeonka 03ac641a78 fix(studio): MOCK Studio의 주제·프로젝트·릴리즈 관리도 mock으로 돈다
create-tech-log-feature-input.ts는 Studio 문서와 Asset은
studioSource에 따라 mock과 HTTP를 고르는데, 관리 표면(주제·프로젝트·
릴리즈·홈 포커스·작업본 삭제)만 언제나 HTTP gateway를 썼다. 그래서
MOCK 빌드(로컬 개발, e2e·visual 빌드)에서 로그인한 Studio의 대시보드와
편집기가 주제·프로젝트를 읽으려고 API_BASE_URL의
/api/v1/studio/session으로 나가고, 연결이 거부된다. 브라우저 시험에서는
Studio 편집기 반응형 40건, Studio 접근성 7건, 경로별 axe의 Studio 두
경로 6건이 이것으로 떨어진다.

mock 문서 gateway와 같은 방식으로 mock 관리 gateway를 둔다.
- 메모리 안에만 있고, Studio 애플리케이션 하나가 사는 동안 유지된다.
- 주제는 MOCK_CATALOG, 프로젝트와 릴리즈는 공개 화면의 정적 콘텐츠
  (public-content.ts)에서 시작한다. 같은 이름과 slug를 쓴다.
- 실패는 백엔드와 같은 코드로 낸다(VERSION_CONFLICT, *_NOT_FOUND,
  게시된 것을 지울 때 CONFLICT).
- 같은 idempotency 키는 첫 결과를 돌려준다.
- 문서 gateway와 Studio state 하나를 나눠 써서, 관리 쪽에서 작업본을
  지우면 문서 목록에서도 빠진다. 그래서 createMockStudioGateway가
  state를 받을 수 있게 했다(주지 않으면 지금처럼 새로 만든다).

버린 대안: e2e에서 /api/v1/studio/**를 page.route로 가로채기. 로컬
개발 빌드는 그대로 깨진 채 남고, 시험만 초록이 된다.

한계: 결정(decision)과 프로젝트 활동은 빈 목록으로 시작한다. 공개
화면의 결정·활동 fixture는 관리 계약의 모양과 달라, 옮겨 담지 않았다.

검증:
- 새 단위 시험 mock-management-gateway.test.ts. 연결 전에는 첫 시험이
  「HTTP executor에 닿았다」로 실패했고, 연결 뒤 5건 모두 통과한다.
  mock-studio-gateway·Studio 화면 smoke·게시 흐름 시험(27건)도 통과한다.
- check:types, lint rc=0.
- chromium에서 Studio 편집기 반응형 10건, Studio 작업 흐름, 경로별 axe의
  Studio 경로가 통과한다(전에는 연결 거부로 실패).
2026-11-12 18:38:29 +09:00
donghyeon-ka aaa384c145 refactor: 템플릿에서 기본적으로 제공하고 있는 워크 플로우에 디자인과 라우팅 흡수 2026-09-23 12:42:10 +09:00
DongHyeonka 11c2713139 feat: let Studio create the topics and projects publishing requires
Publishing needs a topic and nothing could create one. The backend now owns
that surface; this is its consumer — the management contract vendored, a
gateway over its nine operations, and one Studio screen that lists, creates,
and deletes topics and projects.

The screen adds no CSS. It reuses the classes the working-copy list already
uses, so it inherits Studio's spacing, type, and colour rather than growing a
second visual vocabulary beside them. Scope stops at list/create/delete:
renaming, phase changes, and visibility are implemented in the backend and
declared in the contract, but their screens are a separate design.

Two real defects surfaced while making the public port async, and both would
have shipped:

The search page and the header search dialog shared a query key. With an empty
query, `["tech-log","search",""]` was identical for both, so react-query
handed one surface the other's cache — different shapes — and the page died
reading a field that was not there. Keys now name the surface.

The explore filter's selects are uncontrolled and read `defaultValue`, which
React applies once. Their options arrive later now, so the first render had
nothing to match and the value stayed empty: a topic in the URL no longer
showed as selected. The form key includes whether the catalog has arrived, so
it remounts with the options present. Controlled inputs would be the other
answer, but this form submits to build a URL — the URL owns the value.

The route brought its own bookkeeping: a build chunk, a manual accessibility
evidence file, and the CI artifact baseline that counts them. The gate pins a
digest of its own shape precisely so a new route cannot slip in without that
count being reviewed.

Test harnesses that render public screens now assemble the query providers and
await the settled paint, because the screens they render became async.
2026-08-20 23:40:15 +09:00
DongHyeonka 24c01aedf2 feat: give the public surface an HTTP adapter, and a switch to reach it
The public read port had one implementation and no way to add another. This is
the second one: the 18 operations of the public contract, mapped to the nine
methods the screens call.

The contract and the screens disagree about shape, and translating here is what
keeps the presentation components untouched. The server speaks in what it
stores — timestamps, one markdown body, relations grouped by why they relate.
The screens were built against a catalog that spoke in what a page renders —
formatted labels, titled sections, one flat relation list whose group name is
the reason. Neither is wrong. Where the contract has no counterpart the value is
left empty and the gap is named where it happens rather than guessed at: a
Case's verification line, a decision's consequences, a question's options.

Sections are split from markdown here rather than through the Studio parser.
That parser produces the canonical render-block union the editor needs — inline
marks, evidence directives, tables — which is a richer tree than RecordSection
can hold, so reusing it would mean flattening away exactly the blocks that made
it worth using.

A 404 is unwrapped, not thrown. A slug that is not published is an answer the
port already has a shape for, and throwing would put a terminal-error surface on
a page whose real state is "this does not exist".

`listRecords` is one method over two endpoints, because the contract pages and
filters knowledge separately from questions. Only the unfiltered call fans out:
asking for one kind must not pay for the other.

The operations declare the ANONYMOUS auth profile, which forbids credentials
outright. That is the point — a later change that starts sending the session
cookie on a public read fails the profile check instead of quietly making a
cache-friendly surface user-specific.
2026-08-20 17:36:18 +09:00
DongHyeonka c362ec6100 feat: vendor the public read contract, and give it its own source switch
The public surface — 17 of the 28 registered routes — reads from a 29KB
TypeScript fixture and never touches the backend. `TECH_LOG_STUDIO_SOURCE`
only ever switched the Studio gateways; `publicContent` was wired to the
static adapter unconditionally, so no configuration could make the public
site show published content. This is the first half of closing that: the
contract and the switch, with the adapter still to come.

The generator now vendors both canonical contracts instead of one. They are
independent — different services on different schedules — so each carries
its own digest and operation list, and updating one leaves the other's drift
gate quiet.

`TECH_LOG_PUBLIC_SOURCE` is deliberately a second flag rather than a rename
of the Studio one. The combination that matters right now is exactly the one
a single flag cannot express: the authoring backend is live while the public
read API does not exist yet. production stays on MOCK for that reason —
pointing it at HTTP today would empty the live site — and moves when the
backend serves /api/v1/public.

Also records the compatibility evidence the registry gate wanted for the
Studio access change in fff5e6f. That gate has been failing since, which is
on me: the change was real and breaking, and it shipped without the note
explaining that route ids and schemas are untouched and only the access
classification moves.
2026-08-20 16:19:53 +09:00
DongHyeonkaandClaude Opus 5 98649585e6 fix: generate fresh upload idempotency keys and reconcile mock preview/validation on evidence keys
Fix round 1 (review of 54d9bf9):

I1: AssetUploadDialog reused one idempotency key across every upload
attempt in a session, generated once when the dialog opened. Every
terminal state re-enables the file input, so retrying with a different
file after a failure sent two distinct payloads under the same key.
The key is now generated fresh inside submit() on each call, matching
every other mutation call site in the repo, and dropped from the
dialog's public props entirely (it was never in the task's own
"Produces" interface).

I2: the mock's validateDocument gate only recognized the one legacy
hardcoded evidence key, completely disconnected from the Asset system
Instant Preview now consults -- so a directive the Picker or upload
dialog inserted always previewed live and then failed validation with
EVIDENCE_UNSUPPORTED for every other key. Extracted the Asset-to-
CatalogEntry mapping (evidenceCatalogEntriesFromAssets) and the
domain's one EVIDENCE-catalog matching rule (evidenceCatalogEntryFor)
into shared domain modules that both the preview path
(instant-preview.tsx) and the validation path (validate-working-copy.ts,
the mock's own createPreview) now call. Reconciled the underlying MOCK
studioSource gap that caused this: built a mock asset gateway
(mock-studio-asset-gateway.ts) sharing one in-memory Asset store with
the mock document gateway, wired per composition-root instance in
create-tech-log-feature-input.ts, so an Asset the editor actually
loaded is visible to validation too, while a key backed by nothing
still fails both paths.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 05:31:01 +09:00
DongHyeonkaandClaude Opus 5 c9c832c365 feat: add the TechLog asset multipart upload transport
Wires the whole Asset capability into the running application: the
multipart upload transport (the contract runtime can only express JSON
bodies), a single composition-root-owned CSRF provider shared between
the platform's credential collaborator (18 JSON operations) and the
upload transport (1 multipart operation), and Studio/StudioShell
exposure of the Asset gateway alongside the existing document gateway.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 02:39:51 +09:00
DongHyeonka 3b641906b8 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.
2026-08-18 01:57:15 +09:00
DongHyeonka 27dda3e0e3 feat: compose TechLog static and mock adapters 2026-08-15 19:36:46 +09:00