from pathlib import Path


def test_current_release_surface_freezes_current_capabilities():
    docs = Path("docs/CURRENT-RELEASE-SURFACE.md").read_text(encoding="utf-8")

    assert "生产基线：`v0.1.50`" in docs
    assert "public_auth_flow=ok" in docs
    assert "public_upload_flow=ok" in docs
    assert "public_generation_flow=ok" in docs
    assert "public_boundary_flow=ok" in docs
    assert "version: v0.1.50" in docs
    assert "/var/lib/xiaoxia-ci/duty_report.json" in docs
    assert "Gitea 已拆离生产业务机" in docs


def test_current_release_surface_keeps_unimplemented_features_closed():
    docs = Path("docs/CURRENT-RELEASE-SURFACE.md").read_text(encoding="utf-8")

    for feature in [
        "订阅升级",
        "Admin 后台",
        "统一任务中心",
        "ASR 字幕",
        "TTS 配音",
    ]:
        assert feature in docs
    assert "模板与剪辑计划" in docs
    assert "任务中心" in docs
    assert "成片中心" in docs
    assert "标题库" in docs
    assert "素材智能视图/缺口诊断已开放基础版" in docs
    assert "不得假成功" in docs


def test_production_uat_checklist_covers_main_user_flow():
    docs = Path("docs/PRODUCTION-UAT-CHECKLIST.md").read_text(encoding="utf-8")

    for step in [
        "登录",
        "工作空间",
        "项目",
        "素材上传",
        "视频生成",
        "成片下载",
        "权限边界",
        "生产监控验收",
    ]:
        assert step in docs
    for flow_step in ["登录", "工作空间", "项目", "批量上传", "生成", "下载"]:
        assert flow_step in docs
    assert "version` 等于当前生产 tag" in docs


def test_production_uat_checklist_records_v018_smoke_results():
    docs = Path("docs/PRODUCTION-UAT-CHECKLIST.md").read_text(encoding="utf-8")

    assert "当前 v0.1.18 验证结果" in docs
    assert "public_auth_flow=ok" in docs
    assert "public_upload_flow=ok" in docs
    assert "public_generation_flow=ok" in docs
    assert "public_boundary_flow=ok" in docs
    assert "老大真实账号完整 UAT" in docs
