- core:配置(prod 拒绝默认密钥 / dev 短信 / 假模型)、租户事务 + 行级安全策略、 problem+json 错误码、信封加密与签名下载、对象存储、事务内入队、Valkey stream 事件流、权限点 - identity:手机号 HMAC 存储、注册、登录(挤下线需确认,API3)、服务端会话 - billing:额度流水只追加,预扣 / 结算 / 退回,一笔预扣只有一个结局 - document:分片上传、按文件头识别格式、Gotenberg 转换、文字层与稳定句子编号 - checklist:标注规则识别、模型抽取、三道校验、标注类条款规则兜底、重跑对齐 - ai:提示词注册表(extract.substantive v1 来自 S4 v2)、假模型、OpenAI 兼容供应商、ai_call 流水 - 迁移:data-model 基线、套餐、Procrastinate、会话状态函数 - 测试 30 个:租户隔离、额度、失败退回、对象加密、契约一致性 - Compose(含 migrate)、镜像、CI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
976 B
Python
28 lines
976 B
Python
"""实现不能跑出契约之外(API1):后端暴露的每个接口,openapi.yaml 里都要有同样的路径和方法。
|
||
|
||
骨架阶段契约里的接口还没全部实现;没实现的列在 api-design §10 的进度里,这里不要求。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from pathlib import Path
|
||
|
||
import yaml
|
||
|
||
CONTRACT = Path(__file__).resolve().parents[2] / "docs" / "architecture" / "openapi.yaml"
|
||
PREFIX = "/api/v1"
|
||
|
||
|
||
def test_implemented_endpoints_are_in_contract() -> None:
|
||
from bid_doctor.app import create_app
|
||
|
||
contract = yaml.safe_load(CONTRACT.read_text(encoding="utf-8"))["paths"]
|
||
generated = create_app().openapi()["paths"]
|
||
missing = []
|
||
for path, ops in generated.items():
|
||
rel = path.removeprefix(PREFIX)
|
||
for method in ops:
|
||
if method not in contract.get(rel, {}):
|
||
missing.append(f"{method.upper()} {rel}")
|
||
assert not missing, f"这些接口不在 openapi.yaml 里:{missing}"
|