contract-freeze
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecontract-freeze — Boundary Partitioning & Interface Contract Locking
contract-freeze — 边界划分与接口契约锁定
Domain Rubric
领域评估准则
1. Bounded Context Isolation
1. Bounded Context 隔离
Isolate domain boundaries so each context exclusively owns its datastore and internal state. Forbid direct cross-database queries or foreign entity mutations; require all cross-boundary interactions to traverse explicit Public Interfaces, Domain Events, or Anti-Corruption Layers (ACL).
隔离领域边界,使每个上下文独占其数据存储和内部状态。禁止直接跨数据库查询或修改外部实体;所有跨边界交互必须通过显式的 Public Interfaces、Domain Events 或 Anti-Corruption Layers(ACL)进行。
2. Contract Specifications & Consumer Fixtures
2. 契约规范与消费者夹具
Define cross-module contracts using strict typed declarations (TypeScript types, Protocol Buffers, JSONSchema, OpenAPI, or Go interfaces). Every contract must declare protocol, direction, typed command/event payloads, error models, and mock provider fixtures so downstream consumers can build independently without upstream readiness.
使用严格的类型声明(TypeScript 类型、Protocol Buffers、JSONSchema、OpenAPI 或 Go 接口)定义跨模块契约。每个契约必须声明协议、方向、强类型的 command/event 载荷、错误模型和 mock provider fixtures,使下游消费者无需等待上游就绪即可独立构建。
3. State
3. 状态
- : Bounded contexts mapped, public interfaces frozen, and mock fixtures reviewable.
STAGED - : Domain boundary ambiguity or conflicting data ownership prevents clean separation.
UNRESOLVED
- :已完成 Bounded Contexts 映射、Public Interfaces 冻结,且 mock fixtures 可供审查。
STAGED - :领域边界存在歧义或数据所有权冲突,无法实现清晰分离。
UNRESOLVED
Canonical Output Contract
规范输出契约
markdown
undefinedmarkdown
undefinedContract Freeze: <System / Domain Slug> · <STAGED | UNRESOLVED>
Contract Freeze: <System / Domain Slug> · <STAGED | UNRESOLVED>
Basis: <Architectural direction or domain specifications reference>
Basis: <Architectural direction or domain specifications reference>
1. Bounded Context Topology
1. Bounded Context Topology
- Context: | Data Ownership:
<ContextName>| Public Port:<Tables / Entities><InterfaceName> - Boundary Rules: <Encapsulation constraints and ACL mapping>
- Context: | Data Ownership:
<ContextName>| Public Port:<Tables / Entities><InterfaceName> - Boundary Rules: <Encapsulation constraints and ACL mapping>
2. Frozen Interface Specifications
2. Frozen Interface Specifications
text
[CONTRACT: <UpstreamContext> -> <DownstreamContext>]
Protocol: <In-process Interface | REST | gRPC | Domain Event>
Direction: <Sync Call | Async Event>
Payload:
- Input / Command: <Typed structure or schema reference>
- Output / Event: <Typed structure or schema reference>
Invariants:
- Idempotency: <Required / Optional / N/A>
- Error Model: <Deterministic error codes and retry semantics>text
[CONTRACT: <UpstreamContext> -> <DownstreamContext>]
Protocol: <In-process Interface | REST | gRPC | Domain Event>
Direction: <Sync Call | Async Event>
Payload:
- Input / Command: <Typed structure or schema reference>
- Output / Event: <Typed structure or schema reference>
Invariants:
- Idempotency: <Required / Optional | N/A>
- Error Model: <Deterministic error codes and retry semantics>3. Harness Stubs & Consumer Fixtures
3. Harness Stubs & Consumer Fixtures
- Mock Provider: <Repo-relative path for mock stubs or contract fixtures>
- Verification Target: <Consumer test criteria validating against this contract>
Summary: <N> contexts defined, <M> cross-boundary contracts frozen.
(omit if clean) Gap: <Conflicting domain ownership or ambiguous contract boundary.>
undefined- Mock Provider: <Repo-relative path for mock stubs or contract fixtures>
- Verification Target: <Consumer test criteria validating against this contract>
Summary: <N> contexts defined, <M> cross-boundary contracts frozen.
(omit if clean) Gap: <Conflicting domain ownership or ambiguous contract boundary.>
undefinedRouting
路由
- Greenfield plumbing verification across frozen contracts → (via /skeleton-spike).
- Large-scale refactor with frozen contracts → (via /seam-plan).
- Single-module feature with frozen contracts ready for file impact planning → (via /changeset).
- Domain boundary or schema ambiguities unresolved → (via /clarify).
- 基于冻结契约的 Greenfield 管道验证 →(通过 /skeleton-spike)。
- 已冻结契约的大规模重构 →(通过 /seam-plan)。
- 已准备好冻结契约的单模块功能,可进入文件影响规划 →(通过 /changeset)。
- 领域边界或 schema 存在未解决的歧义 →(通过 /clarify)。
Execution Protocol
执行协议
- Partition domain boundaries into isolated Bounded Contexts with single data ownership.
- Define typed interface specifications, error models, and mock stubs for all cross-boundary traffic.
- Output the staged contract specification as (or report
STAGEDon conflicting ownership).UNRESOLVED
- 将领域边界划分为相互隔离的 Bounded Contexts,并确保每个上下文具有单一数据所有权。
- 为所有跨边界流量定义强类型接口规范、错误模型和 mock stubs。
- 输出状态为 的契约规范;如果存在数据所有权冲突,则报告
STAGED。UNRESOLVED