문제 기능 하나가 같은 HTTP API를 두 번 적는다. *-api-contract.ts의 V2 행 (defineRestOperation)은 check:registries(FE-REG-API)가 검사하는 선언이고, contract contribution의 V3 descriptor가 실제로 실행된다. 둘이 어긋나지 않게 http-operation-v2-v3-parity 테스트를 따로 둔다. 048f490으로 V2 클라이언트가 없어져 V2 행을 읽는 실행 코드는 없고, 검사만 남은 두 번째 사본이다. V2 행을 위한 기능별 runtimeSchemas·mappers 레지스트리와 V2 보안 프로필 해석 (resolveRestSecurityProfiles)도 같이 남아 있다. 사용자 지시: 최신 경로 하나만 남기고, 레지스트리 기준선 재승인을 승인했다. 고른 방법 - src/contracts/api-operations.ts를 projectApiOperationRows 하나로 바꿨다. 조립된 contribution의 descriptor마다 operationId, featureId, method, path, authProfileId, retrySemantics, requestBody, responseBody, responseEnvelope, request/response/problemSchema(검증기 schemaId) 행을 만든다. FE-REG-API는 같은 export(API_OPERATIONS)를 읽고, governance 정의를 이 필드로 바꿨다. requestSchema·responseSchema는 그대로 FE-REG-SCHEMA를 참조한다. - FeatureRuntime은 apiContract 대신 schemas(FE-REG-SCHEMA 행)만 받는다. installed-feature-runtime-registries는 schemas로 스키마 레지스트리를 만들고 FE-REG-API 행을 descriptor에서 뽑는다. RUNTIME_SCHEMA_CODECS, MAPPER_REGISTRY, REST_PROFILE_BINDINGS_VALID, API_RUNTIME_BINDINGS_VALID를 지웠다. - realtime snapshot 바인딩은 ApiOperationRow를 받고 method GET과 retrySemantics SAFE·IDEMPOTENT를 본다(V2의 contractVersion·semantics· replayPolicy 대신). - rest-profiles.ts에서 V2 행용 provider·CSRF 프로필 해석을 지웠다. V3는 조립 때 auth profile을 검사하고 자격증명 헤더를 프로필로 거른다. - 참조 기능: reference-api-contract.ts를 reference-schema-metadata.ts로 바꾸고(스키마 행만), V2 runtime codec·operation mapper·레지스트리 mapper를 지웠다. V3 descriptor가 쓰지 않는 NoRequest 스키마 행도 지웠다. - create:feature: <base>-api-contract.ts 대신 <base>-schema-metadata.ts를 만든다. codec·mapper 레지스트리 행과 그 테스트를 만들지 않는다. - 레지스트리 기준선을 update:registry-baseline으로 다시 만들고 승인했다 (digest 16f72742…, 승인자 DongHyeonka, 이유에 사용자 승인을 적음). - 매뉴얼 01·02·reference, starter-experience, 계약 문서의 V2 설명을 지웠다. 버린 대안 - V2 행을 남기고 V3에서 생성하기: 생성 단계와 생성물이 하나 더 생긴다. 행은 실행되지 않으므로 메모리에서 뽑아 검사하면 충분하다. - 스키마 메타데이터(FE-REG-SCHEMA 행)도 검증기에서 뽑기: boundary· unknownFieldPolicy·owner는 검증기에 없고, 라우트 스키마도 같은 레지스트리를 쓴다. 이 행은 V2가 아니라 스키마 레지스트리라 남겼다. 위험·한계 - BREAKING: FeatureRuntime 모양, contracts·rest-profiles·loaded-feature-runtimes 의 이름이 바뀌거나 없어졌다. memento-frontend의 memento-web이 V2 행을 쓴다. 옮기는 법은 CHANGELOG에 적는다. - V2 보안 프로필 일관성 검사(auth "none"과 ANONYMOUS, 쿠키 프로필의 CSRF 모드)가 사라졌다. V3 descriptor에는 그 칸이 없다. - BoundedPollOperationContract(realtime polling recipe)는 contractVersion: 2 필드를 갖지만 자체 계약이라 바꾸지 않았다. 검증 - check:types, lint, check:architecture, check:registries(11 registries PASS, compatibility=none), check:ci, check:diagnostics, check:adapter-inventory, verify:documentation 통과. - test:unit 2,566(새 tests/unit/api-operation-rows.test.ts 3건 포함), test:integration 114, test:component 245, test:contract 23, test:runtime-schema 56, tests/features 99 통과. - tests/unit/second-api-feature-registries.test.ts: V3 descriptor만 가진 두 번째 기능을 복사본에 넣으면 기준선을 고치지 않고 check:registries가 통과한다. - check:bundle 통과. 초기 JS 201,598 → 200,911 B. - test:feature-scaffold 16개, test:sample-removal 23개 검사 통과. BREAKING CHANGE: FeatureRuntime이 apiContract 대신 schemas를 받는다. defineRestOperation, ApiOperation, RestOperationV2, composeApiOperations, validateApiRuntimeBindings, getApiOperation, contracts의 API_OPERATIONS, createRestProviderProfile, RestProviderProfile, resolveRestSecurityProfiles, validateRestProfileBindings, REST_CSRF_PROFILES, RestCsrfProfile, loaded-feature-runtimes의 RUNTIME_SCHEMA_CODECS, MAPPER_REGISTRY, REST_PROFILE_BINDINGS_VALID, API_RUNTIME_BINDINGS_VALID가 없어졌다. 기능은 operation을 contract contribution에만 적고, schemas 행을 feature-runtime에 넘긴다.
65 lines
4.7 KiB
Markdown
65 lines
4.7 KiB
Markdown
# 전역 ID
|
|
|
|
전역 ID는 기능 하나가 아니라 설치된 기능 전체가 함께 쓰는 공간의 이름이다.
|
|
두 기능이 같은 값을 쓰면 조립·레지스트리 검사에서 충돌하거나, 아무 검사 없이 조용히 섞인다.
|
|
|
|
규칙은 하나다(원칙 5).
|
|
|
|
- 모든 전역 ID에 기능 접두어를 붙인다.
|
|
- 무작위 값(무효화 topic)은 복사하지 않고 새로 만든다.
|
|
|
|
`create:feature`는 이 규칙대로 값을 만든다. 아래 표의 "생성 값" 열은 `invoice-feature`로 만들었을 때다.
|
|
접두어 꼴: `<base>` = `invoice`, `<BASE>` = `INVOICE`, `<Base>` = `Invoice`.
|
|
|
|
## 표
|
|
|
|
"검사 없음"은 이 커밋에서 유일성 검사를 찾지 못했다는 뜻이다. 접두어만이 충돌을 막는다.
|
|
|
|
| ID | 어디에 있나 | 생성 값 | 겹치면 |
|
|
|---|---|---|---|
|
|
| 기능 ID | `feature-module.ts`, 계약 `featureId`, `ApplicationFeatureInputs` 키, `FEATURE_OVERRIDES` 키 | `invoice-feature` | 생성 명령·생성기가 거부 (`Duplicate generated feature ids`) |
|
|
| context ID | `context-module.ts`, `FEATURE_CONTEXT_ID` | `invoice-context` | 생성 명령·생성기가 거부 (`Duplicate context id`) |
|
|
| route ID | 계약 `routes`, `routeRuntimeContracts`, 문구 키 | `INVOICE_LIST` | 조립 (`Duplicate route registry key`) |
|
|
| 라우트 경로 | 계약 `routes.*.path` | `/invoice` (새 context), `/<루트>/invoice` (기존 context) | `check:registries` (`duplicates path=`) |
|
|
| `chunkId` | 계약 `routes` | `route-invoice-list` | `check:registries` (`duplicates chunkId=`) |
|
|
| `moduleId` | `routeRuntimeContracts`, 지연 페이지 표 | `invoice-list-page` | `check:registries` (FE-REG-ROUTE-RUNTIME) |
|
|
| `loadingSurface` | 계약 `routes` | `invoice-list` | 검사 없음 (형식만 본다) |
|
|
| operation ID | descriptor, gateway | `INVOICE_LIST_ITEMS` | 계약 조립 (`duplicate operation`) |
|
|
| API 경로 | descriptor `pathTemplate` | `/api/invoice-items` | 검사 없음. 백엔드 계약을 따른다 |
|
|
| 스키마 ID | 스키마 메타데이터, zod 검증기 | `InvoiceNoRequest`, `InvoiceItemListPayload`, `InvoiceProblem` | 모듈 로드 (`Invalid or duplicate schema definition`) |
|
|
| `contributionId` | 계약 기여 | `invoice-feature-http-v1` | 계약 조립 (`duplicate contributionId`) |
|
|
| `policyId` | descriptor `frontend` | `INVOICE_LIST_V1` | 검사 없음 |
|
|
| `diagnosticsOperation` | descriptor `frontend` | `invoice.list` | 검사 없음 |
|
|
| 쿼리 namespace | 계약 `invalidation.namespaces`, 쿼리 바인딩 | `invoice-item` (버전 1) | 조립 (`Duplicate invalidation namespace`) |
|
|
| 무효화 topic | 계약 `invalidation.topics`, 뮤테이션 `invalidate` | `qinv.` + 무작위 26자 | 생성 명령이 설치된 topic과 비교, 조립 (`Duplicate invalidation topic`) |
|
|
| 쿼리·뮤테이션 `definitionId` | 쿼리 바인딩 | `invoice-item-list-v1` | 검사 없음 |
|
|
| 문구 키 | 기능 문구 catalog | `route.INVOICE_LIST.title`, `invoice.list.title` 등 | 생성 명령, 조립 (`Duplicate ko-KR message key`) |
|
|
| telemetry `kind` | application input | `invoice.list.failed` | 검사 없음 |
|
|
| `owner` | 스키마 메타데이터 | `feature-frontend-invoice-feature` | 검사 없음 |
|
|
| 인증 프로필 ID | descriptor `frontend.authProfileId` | `EXTERNAL_BEARER` (템플릿 것을 씀) | 제품 프로필이 템플릿 ID를 쓰면 모듈 로드 (`reuses a template profile id`) |
|
|
| `navigationOrder` | 계약 `routes` | 설치된 최댓값 + 10 | 검사 없음. 같은 숫자가 둘이어도 통과 |
|
|
|
|
메시지 전체와 고칠 파일은 [errors.md](errors.md)에 있다.
|
|
|
|
## 손으로 ID를 더할 때
|
|
|
|
뼈대에 operation·라우트·topic을 더하면 생성 명령이 다시 돌지 않는다. 아래를 직접 지킨다.
|
|
|
|
- 접두어를 붙인다. `NoRequest`, `ItemList` 같은 일반 이름을 쓰지 않는다.
|
|
- 무효화 topic은 새로 만든다.
|
|
- 형식: `qinv.` + 소문자·숫자 26자.
|
|
- `scripts/create-feature.ts`의 `randomTopicSuffix`가 같은 형식으로 만든다.
|
|
- 다른 기능이나 참조 기능의 값을 복사하지 않는다.
|
|
- route ID는 `<BASE>_<화면>` 꼴로 짓는다(`INVOICE_DETAIL`). 라우트를 더하면 a11y 기록 파일도 더한다(`artifacts/tests/a11y-manual/<ROUTE_ID>.md`).
|
|
- 문구 키는 ko-KR과 en-US에 같은 키를 넣는다. `check:i18n`이 비교한다.
|
|
|
|
## 정본 위치
|
|
|
|
설치된 값의 목록은 이 문서에 두지 않는다. 코드에서 본다.
|
|
|
|
- 라우트: `src/features/installed-feature-contracts.ts`의 `ROUTE_REGISTRY`
|
|
- 무효화 topic·namespace: 같은 파일의 `INVALIDATION_REGISTRY`
|
|
- 문구 키: `src/presentation/i18n/catalog.ts`의 `KO_MESSAGES`
|
|
- 템플릿 인증 프로필: `src/contracts/rest-profiles.ts`의 `REST_AUTH_PROFILES`
|
|
- 레지스트리 스냅샷: `config/contracts/registry-baseline.json`
|