Commit Graph

7 Commits

Author SHA1 Message Date
Hermes Agent
9d714e74ab feat(crowd_db): Phase A - 一分一段表接入(湖南+黑龙江,2026官方数据)
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
A 阶段:31省真实录取位次/一分一段表接入

实现内容:
1. SCHEMA.md 扩展:新增 §2.1 score_distribution 字段定义
2. 湖南接入 2026 官方一分一段锚点:
   - 来源: 湖南省高考工作第二次新闻发布会
   - 物理类600分以上: 18876人
   - 历史类600分以上: 2139人
3. 黑龙江接入 2026 官方一分一段完整锚点:
   - 来源: 省招生考试院一分段统计表
   - 物理类: 700分17人, 600分6580人, 本科线340分累计82444人
   - 历史类: 670分15人, 600分857人, 本科线385分累计21417人
4. 新增 test_score_distribution.py 锁住契约

数据结构:
- score_distribution: 顶层可选字段
  - subjects: 物理/历史分类
  - benchmarks: 分数->累计位次锚点
  - score_line_at_600: 600分以上总人数
  - bachelor_score_line: 本科分数线

验证: pytest crowd_db 158 passed, 3 skipped
2026-06-25 20:23:01 +08:00
Hermes Agent
ad67920f06 feat(crowd_db): Phase 0 - 新高考省份选科匹配度修复 (P0)
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
P0 级风险修复:7 个新高考 S 级省 100% 标注 subject_requirements

修复原因:
- recommendations 缺少选科要求,可能导致物理类考生收到历史类专业推荐
- 影响 7 个新高考 S 级省(湖南/广东/江苏/山东/河北/浙江/福建)
- 属 P0 级推荐准确性风险

实现内容:
1. SCHEMA.md recommendation 结构扩展:
   - subject_requirements: {preferred_subject, reselect_subject, note}
   - program_type: 为后续特殊专业标注预留占位
2. 7 省共 484 条 recs 100% 标注 subject_requirements
3. 基于专业关键词规则推断:
   - 理工类: 物理优先 (+化学/+生物)
   - 文史类: 历史优先
   - 医学类: 物理 + 化学/生物
   - 艺体类: 历史优先
4. 新增测试 test_subject_requirements.py
5. 新增 coverage 脚本 check_subject_requirements_coverage.py
6. 评审文档优化:P0 风险确认 + 优先级重排

验证:
- ruff: All checks passed
- mypy: Success, no issues in 17 source files
- pytest crowd_db: 151 passed, 3 skipped
- subject_requirements 覆盖率: 7省 484/484 (100.0%)

业务规则抽样验证:
- 社会工作 -> 历史优先
- 临床医学 -> 物理 + 化学/生物
- 物理学类/计算机/电气 -> 物理 + 化学
- 会计学 -> 历史优先
2026-06-25 11:43:23 +08:00
Hermes Agent
c43aa1d354 feat(crowd_db): Stage 4 - 补 4 自治区,全国 31 省口径完成
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
新增省份: 内蒙古/广西/西藏/宁夏

新增内容:
- 4 个新 JSON 文件 (neimenggu/guangxi/xizang/ningxia.json)
- 每省 8 段 score_ranges, 每段 5 recs × 2 alts
- 全部达 high (conf=0.82, recs=40, alts=80, 3 层分数带)
- trusted_sources 含国家级+省级官方入口

loader.py 扩展:
- PROVINCE_FILE_MAP 新增 4 自治区映射
- 全国 31 省口径正式建立

测试同步:
- test_crowd_db_data_quality.py: HIGH_TRUST_PROVINCES 扩展到 31 省
- test_provenance_query.py: 全部省份列表追加 4 自治区
- test_provenance.py: 总数期望 27 → 31
- test_quality_summary.py: total_provinces 27 → 31

SCHEMA.md §7: 当前代码兼容口径从 27 省 → 31 省

文档真相源同步:
- CURRENT_STATE.md: 31 high / 0 usable / 0 skeleton
- NATIONALIZATION: Stage 4 历史轨迹 + 口径边界更新

验证:
- ruff: All checks passed
- mypy: Success, no issues in 16 source files
- pytest crowd_db: 147 passed
- consistency:  high=31 usable=0 low=0 skeleton=0

当前分布: 31 high / 0 usable / 0 skeleton (全国 31 省全部达 high)
2026-06-25 09:17:03 +08:00
Hermes Agent
4c732eb836 fix(crowd_db): 高信任数据系统性修复 — 契约硬化+真相单一化+防漂移
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
review 发现数据本身真实达标(7 high / 20 usable / 0 skeleton),
但代码/文档/测试/元数据 4 层出现严重脱节,存在静默升级风险与
合规假象回归漏洞。

Phase 1: 契约硬化(P0)
- risk_report.py 新增 _classify_score_bands + _compute_quality_level
- 质量等级判定从"仅看 confidence"升级为综合门槛
  (conf + sr + recs + alts + 三层分数带),对齐 plan §4
- 新增 low 等级区分"已脱离骨架但未达可用"
- _load_provenance_metadata 改为优先 load_province 取完整数据
- finding_to_risk_dict 不再二次规范化已规范化数据
- quality_summary.py 增加 low 等级统计
- SCHEMA.md §6 同步完整门槛定义

Phase 2: 测试加固(P0)
- 新增 test_high_trust_thresholds.py 锁死 high/usable 完整门槛
  (plan §9.2 要求的"防静默升级"测试)
- 修复 test_crowd_db_data_quality.py 等级枚举支持 low
- 修复 test_risk_report.py 硬编码日期脆弱性

Phase 3: 真相源单一化(P0)
- CURRENT_STATE.md §0.5 清除 6/20 旧文案"4 high + 3 usable + 20 skeleton"
- 改为引用顶部状态词 + 历史轨迹仅供审计
- NATIONALIZATION §4 清除"当前 high 已扩展为 5 省"矛盾文案
- 顶部状态词从"Phase 0 收口中"升级为"已完成"

Phase 4: 元数据状态对齐(P1)
- hunan.json / sichuan.json trusted_sources.kind
  province_official_pending_review -> province_official
- 同步更新 quality_note 说明已完成 2025 年度复核
- 消除"状态 high/usable 但 kind=pending_review"的矛盾

Phase 5: 防漂移机制(P1)
- 新增 scripts/check_crowd_db_consistency.py
  跨文档+数据+测试白名单一致性检查(5 项检查)
- dev-verify.sh 接入 crowd_db quality summary 打印

验证:
- ruff: All checks passed
- mypy: Success, no issues in 16 source files
- pytest crowd_db/: 148 passed, 2 skipped
- pytest 全量: 1283 passed, 2 skipped (无回归)
- consistency check: high=7 usable=20 low=0 skeleton=0

Refs: docs/plans/2026-06-23-national-high-trust-crowd-db-plan.md §4/§9
2026-06-25 07:41:11 +08:00
Hermes Agent
0bc1306a1f feat(crowd_db): 27省全部升级到 usable+ 数据基线
- 27 省全部达到 usable 及以上(HIGH=7 / USABLE=20 / LOW=0)
- README.md / SCHEMA.md 同步更新质量等级说明
- test_crowd_db_data_quality.py 锁定 27 省数量与质量基线
- test_provenance_query.py 更新 filter_provinces 动态断言

数据来源: 2025 官方分数线锚点 + 省内重点高校常见报考池 + 国家专业目录 MVP 子集
2026-06-24 22:31:07 +08:00
Hermes Agent
09caa3309f feat(legal+data): harden legal drafts and crowd_db provenance
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-21 11:54:16 +08:00
Hermes Agent
00e596ab10 feat(crowd-db): add provenance query and validation 2026-06-12 16:25:05 +08:00