Files
tech-log-frontend/docs/architecture/capability-consumer-experience.md
DongHyeonka c80320dfc7 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 at 8210d48.

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 at
8210d48 first 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)
2026-11-12 08:28:54 +09:00

6.3 KiB

Capability consumer experience baseline

Correctness inside a reusable capability is not sufficient. The platform is also evaluated by how much of that correctness a normal feature developer must understand.

These measurements are baselines, not score targets. A lower line count is not automatically better if it hides business semantics or creates a universal repository abstraction.

Scenario A — reference REST feature

The existing reference feature is the executable REST consumer.

It covers list/detail/create behavior, mapping, typed operation inputs, application ports and an optimistic mutation path.

The feature-owned boundary and application source is these four files:

  • application/reference-feature-api.ts
  • contracts/reference-mapper.ts
  • adapters/reference-http-gateway.ts
  • adapters/create-reference-feature-input.ts

This document does not keep their line counts; a hand-typed count drifted from the code (review 14-07). Measure them with wc -l src/features/reference-feature/{application/reference-feature-api.ts,contracts/reference-mapper.ts,adapters/reference-http-gateway.ts,adapters/create-reference-feature-input.ts}.

The important boundary metric is not the raw total. It is what those files need to know about the platform.

Current result:

  • HTTP platform imports in the feature adapter layer: 2 files,
  • canonical import path used by both: src/adapters/http/index.ts,
  • direct imports of http-execution-v3.ts, retry scheduler, response reader, auth admission or effect-certainty internals: 0,
  • feature gateway owns transport failure projection: 0,
  • feature gateway chooses operation ID, route ID, exact input/value type and mapper: yes,
  • central installed files own feature-specific adapter/runtime wiring: no; feature-owned contributions are aggregated centrally.

The reusable HTTP capability now owns execution-outcome normalization through createFeatureHttpBinding. A feature may still implement a custom outbound adapter behind its application port when the reusable contract does not match its business requirement.

Scenario B — IndexedDB local draft

The executable consumer probe is:

tests/contract/consumer-experience/indexeddb-local-draft.test.ts

It runs and reads the one Local Draft implementation under src/features/local-draft-feature; the isolated fixture copy it used to probe had drifted from src and was removed (09-12).

The feature owns the Local Draft domain/application API and declares the slice of the repository it calls (LocalDraftRepository in src/features/local-draft-feature/adapters/local-draft-indexeddb-store.ts). The host hands in an IndexedDbRepositoryPort<LocalDraft, never> through the indexedDb capability; the port satisfies that slice structurally. The cross-capability composition contract lives at:

tests/contract/reusable-capability/feature-adapter-composition.test.ts

That test composes one HTTP-only contribution and the IndexedDB-only Local Draft contribution through the same generic catalog path.

The browser-level composition proof lives at:

tests/browser-capabilities/local-draft-composition.spec.ts

It runs against native browser IndexedDB. The test creates the platform createIndexedDbRuntime, exposes that runtime through the typed createIndexedDbRepositoryProvider, composes LOCAL_DRAFT_FEATURE_ADAPTER_CONTRIBUTION, then executes Local Draft save/find/remove through the feature API. The Local Draft feature still does not import the IndexedDB runtime or native browser API.

Measured on src/features/local-draft-feature (09-12):

Metric Result
feature LOC (all .ts files) 295
import statements leaving the feature (contracts/errors, contracts/result, application-api, feature-adapter-contribution) 7
native IndexedDB API references 0
src/adapters/storage/indexeddb/** imports 0
src/application/ports/browser-file-storage/** imports 0

The feature does not import the storage runtime or its port, so removing the browser file/storage runtime (test:browser-file-storage-removal) leaves it compiling.

The contract test rejects feature source that reaches for globalThis.indexedDB, IDBFactory, IDBDatabase, IDBTransaction, IDBObjectStore, the concrete IndexedDB adapter directory or the browser-file-storage port.

What this does and does not prove

The contract probe confirms that feature business code does not need native IndexedDB knowledge once an IndexedDbRepositoryPort has been composed. The browser-capability proof additionally confirms that the same feature contribution works when that port is backed by the repository's real createIndexedDbRuntime and native IndexedDB implementation.

It does not prove that composition of createIndexedDbRuntime is cheap. That constructor still owns substantial infrastructure policy:

  • dataset scope and storage policy,
  • physical store governance,
  • retention/idempotency stores,
  • schema migrations,
  • codec and query policy,
  • lifecycle authority,
  • durability, scheduling and observation.

That complexity belongs at the composition/platform boundary, not in the feature. The Local Draft vertical slice is now the second concrete consumer, and it confirms that the stable seam is the typed repository provider plus a feature-owned repository identity. It does not show that dataset scope, retention, migration, codec or lifecycle-authority configuration can be safely collapsed into one universal create...Repository<T> factory.

A convenience profile should therefore be introduced only after another IndexedDB-backed product feature repeats the same infrastructure policy, not merely because two features consume the same repository port.

Consumer-quality review checklist

For each new product feature, record:

  • feature-owned adapter LOC,
  • platform glue LOC,
  • files changed,
  • central catalog edits,
  • direct imports from capability-internal modules,
  • native browser/network API references,
  • duplicated failure/retry/lifecycle policy.

A healthy feature path should look like:

  1. domain type and invariant,
  2. use case,
  3. business port,
  4. feature-owned mapper/codec and policy,
  5. capability-specific binding,
  6. presentation controller/page.

The feature should not need the retry scheduler, abort ownership, effect-certainty machinery, IndexedDB transaction lifecycle, OPFS journal, reconnect coordinator or provider process model.