{ "meta": { "project": "REPLACE_PROJECT", "version": "v0.1.0", "effective_date": "REPLACE_DATE", "owner": "REPLACE_OWNER" }, "model_contract": [ { "entity": "users", "owner": "backend", "purpose": "用户主数据", "fields": [ {"name": "id", "type": "bigint", "nullable": false, "constraints": ["pk"]}, {"name": "tenant_id", "type": "bigint", "nullable": false, "constraints": ["fk:tenants.id", "idx"], "index": "idx"}, {"name": "status", "type": "varchar(20)", "nullable": false, "constraints": ["enum:DRAFT|ACTIVE|DISABLED"]} ] } ], "view_contract": [ { "view_id": "v_user_list", "route": "/users", "fields": [ {"name": "keyword", "visible_when": "all", "validation": ["maxLen:128"], "required": false} ], "events": [ {"event": "click_search", "target_controller_id": "c_users_search", "payload": {"filters": ["keyword"]}} ] } ], "controller_contract": [ { "operation_id": "c_users_search", "method": "GET", "path": "/api/users", "auth": "rbac:user:read", "input": {"query": {"keyword": "string(optional)", "page": "int>=1"}}, "output": {"status": "ok", "items": "array", "total": "int"}, "idempotent": true, "errors": [ {"code": "AUTH_DENIED", "retryable": false, "description": "未登录或权限不足"}, {"code": "INVALID_PARAM", "retryable": false, "description": "参数校验失败"} ] } ], "process_contract": [ { "flow_id": "p_user_onboarding", "start_state": "draft", "end_state": "active", "transitions": [ {"from": "draft", "to": "active", "trigger": "submit", "action": "c_user_create", "guard": "required_fields_ok", "error_state": "blocked", "retry_max": 1} ] } ], "acceptance_matrix": [ { "requirement_id": "PRD-REQ-01", "coverage": { "model": ["users"], "view": ["v_user_list"], "controller": ["c_users_search"], "process": ["p_user_onboarding"] }, "acceptance_cases": [ {"type": "happy", "description": "列表可搜索并返回分页", "expected": "返回符合条件的用户"}, {"type": "boundary", "description": "keyword 超长", "expected": "返回 INVALID_PARAM"}, {"type": "failure", "description": "无权限", "expected": "返回 AUTH_DENIED"} ] } ], "non_goals": ["不处理企业微信绑定流程"], "assumptions": [ {"id": "A-1", "statement": "用户表已有 tenant_id", "owner": "PO", "verification_plan": "对照历史仓库 schema", "status": "pending"} ], "risks": [ {"id": "R-1", "description": "高并发查询导致超时", "impact": "high", "mitigation": "索引优化 + 异步分页缓存", "status": "pending"} ] }