---
id: design-enforced
kind: enforced
gate: design-gate
title: design 阶段确定性底线
sync_policy: engine_only
status: active
extra:
  owner_mechanism: mc-stage-gate-engine
checks:
  - id: REQ-STRUCT
    executor: document_structure
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 需求分析模版
    rule: "需求分析须满足当前 artifact schema；事实未知时保留待确认，合法不适用项必须说明原因"
    target: self
  - id: REQ-DELIB
    executor: requirement_deliberation_gate
    check_type: deterministic
    severity: error
    non_waivable: true
    gate: design-gate
    required_artifact: 需求分析模版
    rule: "根本目标、范围、关键规则和阻塞问题须有真实研讨与用户确认记录"
    target: self
  - id: FUNDAMENTAL-NEED-CONFIRMED
    executor: fundamental_need_confirmed_check
    check_type: deterministic
    severity: error
    non_waivable: true
    gate: design-gate
    required_artifact: 需求分析模版
    rule: "根本目标须写清并保留用户确认来源；未确认不得把方案当成需求事实"
    target: self
  - id: BLOCKING-ITEM-CLEAR
    executor: blocking_item_check
    check_type: deterministic
    severity: error
    non_waivable: true
    gate: design-gate
    required_artifact: 需求分析模版
    rule: "阻塞级未确认项必须解决或由用户明确改变处理结论后才能推进"
    target: self

  - id: PROTO-STRUCT
    executor: document_structure
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 原型说明模版
    existence_delegated: true
    rule: "每份适用的原型说明须满足当前 artifact schema；不从通用 UI 惯例补造页面事实"
    target: self
  - id: PROTO-DELIB
    executor: artifact_deliberation_gate
    check_type: deterministic
    severity: error
    non_waivable: true
    gate: design-gate
    required_artifact: 原型说明模版
    rule: "涉及前端时须与用户确认端约束、原型保真度、可交互范围与设计落点"
    target: self
  - id: PROTO-EXISTS
    executor: prototype_existence_check
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 架构设计模版
    rule: "task.scope.frontend=true 时，架构设计前须有按 project map 定位的页面原型说明；无前端范围时跳过"
    target: self

  - id: ARCH-STRUCT
    executor: document_structure
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 架构设计模版
    rule: "架构设计须满足当前 artifact schema，目录、模块、指标和技术选择只能来自项目事实或已确认决策"
    target: self
  - id: MODULE-DEP-ACYCLIC
    executor: module_dependency_acyclic_check
    check_type: deterministic
    severity: error
    non_waivable: true
    gate: design-gate
    required_artifact: 架构设计模版
    rule: "架构文档中明确声明的模块依赖不得形成环；未声明关系的语义正确性由独立审查判断"
    target: self
  - id: XVAL-ARCH-REQ
    executor: cross_validation
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 架构设计模版
    rule: "REQ-* 一致性+覆盖率"
    evidence_required: ["需求分析模版"]
    target: self
  - id: ARCH-ENDPOINT-CONSISTENCY
    executor: endpoint_declaration_check
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 架构设计模版
    rule: "涉及前端时，需求端清单、架构端模块、发布拓扑和用户确认的 intent.projects 必须一致"
    evidence_required: ["需求分析模版"]
    target: self
  - id: ADR-EXISTS
    executor: required_artifact_check
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 架构设计模版
    rule: "架构设计的 reference 决策记录须存在并可定位"
    evidence_required: ["架构设计模版", "reference:design_doc:00-架构决策记录.md"]
    target: self
  - id: ADR-STRUCT
    executor: document_structure
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 架构设计模版
    audit_evidence: true
    rule: "架构决策记录须含「背景」「选项」「结论」「原因」"
    evidence_required: ["reference:design_doc:00-架构决策记录.md"]
    target: self

  - id: DB-STRUCT
    executor: document_structure
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 数据库设计文档模版
    existence_delegated: true
    rule: "涉及持久化时，数据设计须满足当前 artifact schema；不得把 SQL 假设强加给非关系型存储"
    target: self
  - id: DB-DELIB
    executor: artifact_deliberation_gate
    check_type: deterministic
    severity: error
    non_waivable: true
    gate: design-gate
    required_artifact: 数据库设计文档模版
    rule: "涉及持久化时须与用户确认数据边界、权威资产、不变量、迁移兼容和恢复方案"
    target: self
  - id: DB-COVERAGE
    executor: req_coverage_check
    requirement_dimension: persistence
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 数据库设计文档模版
    rule: "数据设计须承载需求中明确影响 persistence 的 REQ-*；不要求无持久化影响的需求伪造数据对象"
    evidence_required: ["数据库设计文档模版"]
    target: self

  - id: API-STRUCT
    executor: document_structure
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: API接口规格文档模版
    rule: "API 规格须满足当前 artifact schema，每个 endpoint 的请求、响应、错误、副作用和验收证据须完整"
    target: self
  - id: API-BLOCK
    executor: document_structure
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: API接口规格文档模版
    rule: "每个 endpoint 块须含基本信息、响应体、错误与副作用、验收场景"
    block_check:
      item_pattern: '^##\s+Endpoint'
      required_marks: ['基本信息', '响应体', '错误与副作用', '验收场景']
      require_table: true
      min_table_rows: 4
      reference_pattern: '^同\s*DD-A\d'
    target: self
  - id: API-DELIB
    executor: artifact_deliberation_gate
    check_type: deterministic
    severity: error
    non_waivable: true
    gate: design-gate
    required_artifact: API接口规格文档模版
    rule: "涉及 API 时须与用户确认风格、消费方、认证、幂等、错误语义和契约权威源"
    target: self
  - id: API-CODE-UNIQUENESS
    executor: business_code_uniqueness_check
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: API接口规格文档模版
    rule: "同一业务码跨 endpoint 不得表达相互冲突的 HTTP 或错误语义"
    target: self
  - id: CRUD-COMPLETE
    executor: crud_completeness
    check_type: deterministic
    severity: error
    non_waivable: true
    gate: design-gate
    required_artifact: API接口规格文档模版
    rule: "资源型接口在文档中声明的行为策略须与 OpenAPI 操作一致；工具不得猜测删除或更新语义"
    target: self
  - id: COMPANION-CONSIST
    executor: companion_consistency
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: API接口规格文档模版
    rule: "OpenAPI 须可解析并具备规范必需结构，且与 API 文档通过稳定 endpoint 标识对应"
    target: self
  - id: API-COVERAGE
    executor: req_coverage_check
    requirement_dimension: api
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: API接口规格文档模版
    rule: "API 规格须承载需求中明确影响 api 的 REQ-*；不要求领域内部或纯 UI 需求伪造接口"
    evidence_required: ["API接口规格文档模版"]
    target: self

  - id: SLICE-PLAN-STRUCT
    executor: document_structure
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 切片计划模版
    rule: "切片计划须满足当前 artifact schema，每个切片均有边界、依赖、验收和恢复说明"
    target: self
  - id: SLICE-REQ-COVERAGE
    executor: req_coverage_check
    requirement_dimension: all
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 切片计划模版
    rule: "每个本期 REQ-* 至少由一个切片承接"
    evidence_required: ["切片计划模版"]
    target: self
  - id: SLICE-DIMENSION
    executor: slice_verifiability_check
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 切片计划模版
    rule: "每个切片须可独立验证，依赖无环且顺序可执行；只要求 task.scope 中适用的维度"
    target: self
  - id: XVAL-SLC-PAGE
    executor: slice_prototype_binding_check
    prototype_binding_direction: forward
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 切片计划模版
    rule: "前端切片引用的原型页须按 project map 可定位；无前端范围时跳过"
    target: self
  - id: SLC-PAGE-COVERAGE
    executor: slice_prototype_binding_check
    prototype_binding_direction: reverse
    check_type: deterministic
    severity: warning
    gate: design-gate
    required_artifact: 切片计划模版
    rule: "已产出的原型页应被至少一个切片承接；未承接时保留可见警告，避免遗漏实现"
    target: self

  - id: COMPAT-STRUCT
    executor: document_structure
    check_type: deterministic
    severity: error
    gate: design-gate
    required_artifact: 兼容性与迁移评估模版
    existence_delegated: true
    rule: "brownfield 兼容性评估须满足当前 artifact schema，影响面、兼容窗口和恢复证据不得为空"
    target: self
  - id: COMPAT-DELIB
    executor: artifact_deliberation_gate
    check_type: deterministic
    severity: error
    non_waivable: true
    gate: design-gate
    required_artifact: 兼容性与迁移评估模版
    rule: "brownfield 迁移须与用户确认调用方、数据路径、迁移窗口、回滚与兼容策略"
    target: self
  - id: SCOPE-CONSISTENCY
    executor: scope_consistency_check
    check_type: deterministic
    severity: error
    gate: design-gate
    rule: "任务归因制双层判定：本任务验证记录中出现 scope 外产物即矛盾（error）；磁盘存在产物且有其他任务归属（含已 cancel）=历史事实不判矛盾；磁盘存在但无任何任务归属=warning 提示不阻断。范围事实只能由显式任务上下文决定"
    target: self
---

# design-gate 确定性底线

本文件只声明能由项目文件、任务范围和真实执行确定判定的规则。技术选型是否合理、业务语义是否正确、视觉是否忠于素材等问题由独立审查和用户验收判断；不得用固定路径、SQL、框架、字数或通用阈值冒充确定性事实。
