문제
- starter-experience.md "Adding a feature"의 폴더 밖 수정 표가 실제와 다르다.
라우트마다 필요한 수동 a11y 기록이 없고, 어느 검사가 실패하는지도 적지
않는다.
- 이 주장을 지키는 second-api-feature-registries 테스트는 무효화 topic이
없는 기능만 넣는다. 그래서 topic 추가가 기준선 재승인을 요구하던 결함을
보지 못했다.
- http-operation-v2-v3-parity 테스트는 스키마 ID "NoRequest"를 "입력 없음"
표시로 고정해 쓴다. 스키마 ID는 전역이라 두 번째 기능은 다른 이름(예:
OrderNoRequest)을 써야 한다. 그러면 이 테스트가 그 기능의 path·request
스키마를 둘 다 입력으로 세어 실패한다(16-02 작업자 발견).
고른 방법
- 표를 지금 코드 기준으로 다시 썼다. 열은 파일 / 언제 / 없으면 무엇이
실패하나. 리뷰 실험 E의 ①~⑨ 중 이번 라운드 앞 커밋이 없앤 것은 뺐다:
governance allowlist(0929/07-03), 기준선 재승인(앞 커밋, 결정 1), README·
체크리스트 route ID 목록(14-05), 인증 프로필 이름(16-03, EXTERNAL_BEARER
재사용), MSW 카탈로그와 무관한 테스트 3개(16-02). runtime-adapters.ts는
product-composition.ts로 바뀌었다(09-02).
- 남은 것: context 선언, 라우트별 a11y 기록, 경로 파라미터가
:resourceId가 아니거나 빈 배열 응답으로 그려지지 않는 페이지의 e2e a11y
spec, 제품 capability·인증 프로필·설정 키(제품 소유 파일 2개), 선택인
FEATURE_OVERRIDES, 계약 패키지를 npm 의존성으로 들일 때의 의존성 검토
증거. 계약 출처(EXTERNAL_PACKAGE)는 기능 계약의 contractPackages에
선언하므로 폴더 밖 수정이 아니다.
- 표 아래에 레지스트리 추가는 기준선을 바꾸지 않는다는 것, 전역 ID에 기능
접두어를 붙인다는 것, 기능의 MSW 시나리오는 createHttpScenarioHandler로
만든다는 것을 적었다.
- second-api 기능에 무효화 topic·namespace·edge·topicVersion을 더하고,
무효화 그래프 변경 3건이 additive인지 단언한다. 라우트는 0929/07-03이
이미 넣었으므로(SECOND_ITEM_LIST) 더하지 않았다.
- second-api의 통과 codec은 검증을 생략하므로 1101/07-03의
unvalidatedPayload로 만든다.
- parity 테스트는 V2 행에서 입력이 있는 쪽을 읽는다. path 스키마는
pathParameterNames가 있을 때, request 스키마는 requestSource가 "none"이
아닐 때 입력이다. 둘 다 없으면 행의 requestSchema(그 기능의 빈 입력
스키마)를 기대한다.
버린 대안
- 표만 고치기(리뷰 대안 a): 테스트가 계속 좁은 모양만 증명한다.
- 참조 기능의 NoRequest를 ReferenceNoRequest로 바꾸기: FE-REG-API 행의
requestSchema·pathSchema가 바뀌어 기준선 재승인이 필요하고 범위 밖이다.
- parity 테스트에서 이름 끝이 NoRequest인 스키마를 빈 입력으로 보기: 이름
관례에 기대는 규칙이라 다른 이름을 쓰면 다시 깨진다.
- second-api 기능에 V3 기여를 넣어 parity를 그 사본에서 돌리기:
1101/07-02(3c31576)가 같은 이유로 버렸다(사본에서는 check:registries만
돈다).
위험·한계
- e2e a11y spec 행은 코드(:resourceId만 치환, 모든 API에 [] 응답)를 읽고
적었다. 다른 파라미터를 가진 라우트로 test:a11y를 실제로 돌려 보지는
않았다.
- 의존성 행은 직접 production 의존성을 더하면 generate:supply-chain이
"high-risk dependency missing review"로 실패한다는 코드를 읽고 적었다.
실행하지 않았다.
- 초기 JS 예산은 표에 넣지 않았다. 기능 하나가 초기 JS를 늘리지만 예산은
기능이 고칠 파일이 아니다. 이번에 측정하지 않았다.
- 표의 완전성은 테스트가 지키지 않는다. 생성 명령(U7)의 게이트 실행이
이 표를 실행으로 확인할 자리다.
검증
- RED: 넓힌 second-api 테스트를 결정 1 전 분류기(HEAD~1의
registry-compatibility.ts)로 돌리면 실패한다. check-registries stderr
"breaking change missing evidence:
FE-REG-QUERY-INVALIDATION:invalidation-graph:{edges,namespaces,topics}:field-changed".
parity 테스트는 참조 기능의 NoRequest를 ReferenceNoRequest로 바꾼
변이(커밋 안 함)에서 "LIST_REFERENCE_RESOURCES: V2 declares both a path
and a request schema" 실패.
- GREEN: second-api 1/1, 같은 변이에서 parity 2/2, 변이 없이 2/2 통과.
V3 inputValidator schemaId를 바꾼 변이는 여전히 inputSchema 차이로
실패한다.
- 회귀: tests/unit 178파일 중 177 통과. 실패 1건 feature-shape-growth(초기
JS 증가 1 KiB 초과)는 기준 커밋에서도 실패한다. tsc app·test rc=0, 바꾼
테스트 eslint rc=0, verify-documentation-readiness PASS_SCOPED,
check-registries PASS(compatibility=none).
- 미실행: check:architecture(pnpm 필요), test:a11y, test:sample-removal.
Refs: docs/reviews/2026-11-01-maturity-review/16-structure-patterns.md 16-01, 8.1, 8.2
13 KiB
Starter experience contract
The repository provides a runnable, domain-neutral application rather than only infrastructure contracts. The starter experience is intentionally replaceable at the page level while the shell, providers, boundaries, primitives, and state surfaces remain reusable.
Runtime composition
validated config + coherent release manifest
-> concrete adapters
-> QueryClientProvider
-> ApplicationProvider
-> RouterProvider
-> ThemeProvider
-> SessionProvider
-> AppShell
-> lazy route boundary
Boot stops before product mount when configuration or release coherence fails. Each lazy page renders inside Suspense and a telemetry-aware route boundary. Route changes move focus to the new page heading; the skip link and landmarks remain stable in the shell.
Registered routes
The route list is ROUTE_REGISTRY (src/features/installed-feature-contracts.ts):
the platform routes of src/contracts/routes.ts plus the routes of every
installed feature. The platform overview page (/examples/platform) shows the
composed list at runtime, so this document does not keep a copy of it.
Navigation labels and order come from ROUTE_REGISTRY; the sidebar does not
maintain a second route list. The client access decision never claims to be
authorization.
Authentication seam
The session port exposes state subscription, sign-in start, sign-out, credential attachment, recovery, and unauthenticated notification. Credentials remain opaque to the application and presentation layers.
demo: local/development-only state transition with no credentialsexternal: delegates toglobalThis.__CA_FRONTEND_AUTH_OWNER__- missing/invalid external owner: fails closed as
integration-failed
An external owner implements readState, readSubject, subscribe,
beginSignIn, signOut, attachCredential, recoverSession, and
notifyUnauthenticated. It owns token acquisition and storage. An owner that
lacks any of these methods is rejected, and the session fails closed as
integration-failed.
readSubject() is required. The server-state cache is cleared only when the
session state or the subject changes, so a token refresh for the same user
keeps cached data. readSubject() must return:
- an opaque, non-empty string that stays the same for one user across token
refreshes and differs between users: the OIDC
subclaim, Supabasesession.user.id, or Firebaseuser.uid nullwhen nobody is signed in- never an access token, refresh token, or any other credential
If readSubject() returns null or "" while the owner reports
authenticated, the runtime cannot tell a refresh from an account switch. It
fails closed: every such notification clears server state, and each one records
the cache.operation.failed diagnostic with operation: SCOPE_FENCE and
reason: SUBJECT_MISSING. Seeing that diagnostic means the owner is not
reporting its subject. The demo adapter reports one fixed demo user as its
subject.
Migration: readSubject() used to be optional. An owner written for an earlier
release must add it; without it the owner is rejected at startup (the session
becomes integration-failed) and a TypeScript owner no longer compiles
against ExternalSessionOwner. A code path that implements AuthSessionPort
or SessionGateway directly must add getSubject() the same way.
Extending the starter
New platform work should follow routing, page templates, and reusable patterns and the TypeScript, state, and data-flow target rather than adding another independent route or data-loading convention.
Replacing the starter screens
/ (src/presentation/pages/home-page.tsx) and /examples/*
(src/presentation/examples/) are template content. Their own tests are the
tests/component/starter-*.test.tsx files; delete them together with the
screens. The platform's component tests (router, boundaries, shell, runtime
tree) run on the pages of the test-only feature in
tests/helpers/fixture-feature.tsx and keep passing when the starter screens
change. Browser-level checks of the starter screens stay in tests/e2e and
tests/visual.
Ownership declarations
Features, contexts and apps are discovered by
scripts/generate-product-feature-index.ts. Each boundary declares only its
parent, as exported string or integer literals the generator reads:
| File | Exports |
|---|---|
src/apps/<app>/app-module.ts |
APP_MODULE_ID, APP_MAX_CONTEXTS |
src/contexts/<context>/context-module.ts |
CONTEXT_MODULE_ID, CONTEXT_APP_ID, CONTEXT_ROUTE_PATH, CONTEXT_MAX_FEATURES |
src/features/<feature>/feature-module.ts |
FEATURE_MODULE_ID, FEATURE_CONTEXT_ID, FEATURE_MODULE |
src/features/<feature>/feature-runtime.ts |
FEATURE_RUNTIME (imported only by feature-module.ts, dynamically) |
src/features/<feature>/context-routes.ts |
FEATURE_CONTEXT_ROUTES |
The generator writes src/.generated/ (git-ignored): the feature index the
installed catalogs import, the context index the router loads lazily, and the
selected app. Every build and check script runs it first; run it yourself with
corepack pnpm generate:feature-index. It fails, naming the file, when:
- a directory under
src/features/has nofeature-module.tsand noNOT_INSTALLEDmarker file (src/features/local-draft-feature/NOT_INSTALLEDis the one intentional example); - a feature names an undeclared context, or a context an undeclared app;
- a context or app exceeds its declared budget;
VITE_PRODUCT_FEATURESnames a feature the app does not declare. The variable narrows the installed set here, before anything is compiled.
Adding a feature
- Create
src/features/<feature>/feature-module.ts. BuildFEATURE_MODULEwithdefineFeatureModule(src/features/feature-module.ts). This is the feature's declaration, and it is in the initial chunk, so it holds data only: the declaration contract (routes, route runtime contracts, invalidation, topic versions and the externalcontractPackagesthe release manifest is checked against at boot), its message catalogs, andloadRuntime, which importsfeature-runtime.tsdynamically.src/features/reference-feature/feature-module.tsis the complete example. - Create
src/features/<feature>/feature-runtime.tswithdefineFeatureRuntime: the API contract (operations, schema metadata, runtime schemas, mappers), the adapter contributions (defineFeatureAdapterContribution, withneedsnaming the platform capabilities it receives) and the contract contributions. The router loads it (application.features.load) when one of the feature's routes is entered. Do not import it statically from anywhere: each feature would add its whole executable code to the initial chunk again, about 3.9 KB gzip (tests/unit/feature-shape-growth.test.tsbounds one feature at 1 KiB). An HTTP API is written twice: its API contract operation (V2) is whatcheck:registriesgoverns, and its contract contribution descriptor (V3) is what executes.tests/unit/http-operation-v2-v3-parity.test.tsfails when one exists without the other or when they disagree. A product feature's contract contribution uses anEXTERNAL_PACKAGEsource.TEMPLATE_FIXTUREbelongs toreference-featureonly and never joins the release contract set; the composer rejects it anywhere else. - Create
src/features/<feature>/context-routes.tsexportingFEATURE_CONTEXT_ROUTES. Page components are imported lazily here, and each route handle carries the route's params/searchcodecs; the owning context loads this file only when its route root is visited (src/features/reference-feature/context-routes.ts). Each handle'srouteIdmust be a route of a feature contract in the same context; the context refuses the routes when they load, naming the route, context and features (src/contexts/bounded-context-module.ts). - Name the owning context in
FEATURE_CONTEXT_ID. Use an existing context or addsrc/contexts/<context>/context-module.tsowned by the app. Every route path in the feature contract must sit at or under that context'sCONTEXT_ROUTE_PATHand must not fall under another context's identical or more specific root: the router renders feature routes only inside the owning context. The app module refuses anything else when it loads, naming the route, feature and context (src/apps/deployable-app-module.ts). - If the feature has application input, augment
ApplicationFeatureInputsfrom the feature (src/features/local-draft-feature/application/local-draft-api.ts). - Run
corepack pnpm check:architecture,corepack pnpm check:types,corepack pnpm check:registriesand the tests.tests/unit/two-feature-install-typecheck.test.tskeeps the installed catalogs compiling with more than one feature. - Run
corepack pnpm test:sample-removal -- --feature=<feature id>to prove the product still builds and passes its gates without the feature.
Files outside the feature directory. Everything else a feature needs is in
src/features/<feature>/ and tests/features/<feature>/.
| File | When | What fails without it |
|---|---|---|
src/.generated/* |
never by hand: every build and check script regenerates it | — |
src/contexts/<context>/context-module.ts |
the feature needs a new context | generate:feature-index: Feature <id> belongs to undeclared context <context> |
artifacts/tests/a11y-manual/<ROUTE_ID>.md |
every route the feature adds. Copy a record and reset it to Status: pending-manual-review |
test:unit (tests/unit/manual-a11y-evidence.test.ts), verify:documentation (names the route IDs) and FE-GATE-009 (review:a11y-manual -- --format-only). FE-GATE-028 requires the signed review at release |
tests/e2e/accessibility.spec.ts |
a route path has a parameter other than :resourceId, or a protected page cannot render while every API answers [] |
test:a11y (FE-GATE-009): the spec fills in only :resourceId and answers every API with [] |
src/bootstrap/product-composition.ts (product-owned) |
needs names a capability the template does not build: augment FeaturePlatformCapabilities and return the capability here. indexedDb is built as in recipes/frontend-capabilities/indexeddb-feature-capability.ts. Credentials for a product auth profile are returned here too |
check:types; at runtime feature <id> needs <capability>, which the host did not provide |
src/contracts/product-contracts.ts (product-owned) |
a product auth profile or a product runtime-config key | auth profile: every gate that loads the operation, with REST security profiles are incoherent for <operationId>: unknown authProfileId …. Config key: check:types where it is read |
config/runtime/<profile>.json |
optional: a FEATURE_OVERRIDES entry switches the feature off |
nothing |
package.json, the lockfile, config/security/dependency-change-evidence.json |
the contract contribution imports a generated @org-contracts/* package as a production dependency |
generate:supply-chain (in check:bundle): high-risk dependency missing review: add:<package> |
The central catalogs (src/features/installed-*.ts) and the registry
governance file do not change: consumer directories there are globs over every
feature (src/features/*/adapters, config/contracts/registry-governance.json).
A route's params/search schema ids are checked against the schemas the feature
registers, and its loadingSurface only has to be a kebab-case name, so a
route with its own schema and loading surface needs no governance edit either.
The registry baseline does not change either. New routes, API operations,
schemas and invalidation topics, namespaces and edges are additive registry
changes; update:registry-baseline or breaking evidence is needed only to
remove or change a row or graph item.
tests/unit/second-api-feature-registries.test.ts adds such a feature (an API
operation, a route with its own search schema and loading surface, and an
invalidation topic) to a copy of the repository and runs check:registries on
it.
Schema, operation, mapper, route and chunk ids and invalidation topics are
global. Prefix them with the feature; NoRequest already belongs to the
sample. MSW scenarios for the feature's own operations come from
createHttpScenarioHandler (tests/mocks/handlers/http-scenarios.ts) with
the feature's installed contract; the shared scenario catalog does not change.
Before shipping
- Use the semantic tokens, UI primitives, and state surfaces before adding a project-specific variant.
- Add component behavior, all-engine E2E, automated axe, and signed manual route evidence.
Theme preference is the public COLOR_SCHEME storage contract. Authentication
tokens and other secrets remain forbidden storage keys.