Skip to content

Commit 8941de7

Browse files
committed
fix: close bazi hardening audit gaps
1 parent 1b86f2c commit 8941de7

16 files changed

Lines changed: 388 additions & 536 deletions

File tree

scripts/project/assets/data/calendar/solar_terms/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
- 当前运行期节气计算仍以既有成熟历法库为主。
1616
- raw 表格先作为交叉校验资料,不直接替换生产算法。
1717
- `golden/solar_terms_1900_2030.json` 已进入测试门禁,用来校验成熟历法库输出不发生无声漂移。
18+
- 重新生成 golden 需要本地 raw 文件;raw 文件不进入 Git 与导出包,第三方复核需按 `source_manifest.tsv` 获取同哈希文件。
1819
- 若后续要作为生产数据源,必须建立字段 schema、年份覆盖测试、节气边界回归和来源说明。

scripts/project/assets/data/calendar/solar_terms/golden/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
- fixture 是测试资产,不是生产历法算法替换源。
1414
- 运行期节气计算仍复用 `lunar-python`
1515
- raw 表保留在 `../raw/`,不进入 Git 和导出包;本目录只保存清洗后的轻量 JSON。
16+
- `scripts/build_solar_terms_golden.py` 需要本地 raw CSV 才能重新生成 fixture;第三方审计需要按 `../source_manifest.tsv` 复核 raw 文件哈希。
1617
- 误差容差记录在 JSON 的 `toleranceSeconds`。当前 raw 表与 `lunar-python` 在 1940 年代等历史区间存在约 1 小时时区/DST 口径差异;测试失败必须先判断是来源表差异、上游库差异还是项目逻辑回归。

scripts/project/assets/docs/reference/核心功能完整性审查.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
| 综合八字证据字段 | 已落地 | `analysisEvidence``assets/fate/evidence_schema.json``test_comprehensive_bazi_result_contains_hidden_analysis_evidence` |
2020
| 权重与典籍规则索引 | 已落地 | `assets/fate/weight_policy.json``assets/fate/classics_rule_index.json` |
2121
| 隐私展示 | 已落地 | `test_markdown_report_hides_non_beijing_birth_place``scripts/check-privacy-fixtures.sh` |
22-
| 交付门禁 | 已落地 | `scripts/acceptance.sh --with-dev`GitHub Actions run `25454202418` |
22+
| 交付门禁 | 已落地 | 本地 `scripts/acceptance.sh --with-dev`;远端 CI 以当前提交 push 后的最新 GitHub Actions run 为准 |
2323

2424
## 本轮修正
2525

scripts/project/assets/docs/reference/综合八字陈述服务加固.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
| 门禁 | 路径 | 说明 |
1616
| --- | --- | --- |
17-
| 节气 golden | `tests/test_solar_terms_golden.py` | 对照 `assets/data/calendar/solar_terms/golden/solar_terms_1900_2030.json`,锁定 1900-2030 节气、月令、立春年界和起运样本|
17+
| 节气 golden | `tests/test_solar_terms_golden.py` | 全量对照 `assets/data/calendar/solar_terms/golden/solar_terms_1900_2030.json``lunar-python` 的节气时间容差;抽样硬锁月令、立春年界、真太阳时入参边界和起运样本|
1818
| 报告结构 | `tests/test_branding_support.py` | 锁定默认 Markdown 块,不含紫微、建除、黄历、六爻等非综合八字体系。 |
1919
| Evidence 权重 | `tests/test_fate_policy_assets.py` | 校验 `evidence_schema.json``weight_policy.json``classics_rule_index.json` 的边界。 |
2020
| 隐私示例 | `scripts/check-privacy-fixtures.sh` | 扫描一线代码、文档和测试中真实感姓名/地区示例。 |
@@ -35,3 +35,8 @@
3535
- 真实生产 API 域名、CORS allowlist、API token。
3636
- 真实 Telegram Bot token 和 Bot API live smoke。
3737
- 典籍规则索引仍是种子层,后续需继续扩大规则覆盖。
38+
39+
## 复现边界
40+
41+
- `golden/solar_terms_1900_2030.json` 是已提交的轻量测试 fixture。
42+
- `scripts/build_solar_terms_golden.py` 可从本地 raw CSV 重新生成 fixture,但 raw 表按仓库治理要求不进入 Git 与导出包;第三方复核需要另行取得 `assets/data/calendar/solar_terms/source_manifest.tsv` 中登记的同哈希 raw 文件。

scripts/project/assets/fate/classics_rule_index.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030
"appliesWhen": ["月令、节气和五行分数齐备"],
3131
"doesNotApplyWhen": ["只进行民俗附录输出"]
3232
},
33+
{
34+
"id": "bazi.balance_five_elements",
35+
"system": "bazi",
36+
"topic": "五行平衡",
37+
"summary": "五行喜忌需结合五行分数、季节气势和日主状态,作为调候之外的平衡依据。",
38+
"sources": ["项目五行评分规则", "滴天髓", "穷通宝鉴"],
39+
"appliesWhen": ["五行分数、月令和日主状态齐备"],
40+
"doesNotApplyWhen": ["只存在单一五行标签或缺少四柱数据"]
41+
},
3342
{
3443
"id": "bazi.pattern_by_month_command",
3544
"system": "bazi",
@@ -39,6 +48,24 @@
3948
"appliesWhen": ["月令、天干透出和藏干信息齐备"],
4049
"doesNotApplyWhen": ["月柱缺失或节气边界未通过"]
4150
},
51+
{
52+
"id": "bazi.pattern_root_transparency",
53+
"system": "bazi",
54+
"topic": "格局",
55+
"summary": "格局成败应参考透干、通根、藏干和合化冲破,不只取月令名称。",
56+
"sources": ["子平真诠", "三命通会", "项目格局规则"],
57+
"appliesWhen": ["月令、透干、藏干和地支关系齐备"],
58+
"doesNotApplyWhen": ["只输出简化排盘或缺少干支关系"]
59+
},
60+
{
61+
"id": "bazi.stem_branch_relations",
62+
"system": "bazi",
63+
"topic": "干支关系",
64+
"summary": "干支合冲刑害破、入库和透藏关系用于解释结构变化,应作为证据展开而非孤立断语。",
65+
"sources": ["渊海子平", "三命通会", "项目干支关系规则"],
66+
"appliesWhen": ["四柱干支和地支藏干齐备"],
67+
"doesNotApplyWhen": ["只存在年柱或生肖数据"]
68+
},
4269
{
4370
"id": "bazi.spirits_auxiliary_only",
4471
"system": "bazi",

scripts/project/assets/tasks/0001-comprehensive-bazi-statement-service-hardening/ACCEPTANCE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
- 运行新增 pytest:节气 golden、报告结构快照、隐私脱敏、输入契约、多端同源输出。
1313
- 运行 `bash scripts/vendor-health.sh``bash scripts/check-source-hygiene.sh``bash scripts/check-privacy-fixtures.sh`
1414
- 运行 `bash scripts/acceptance.sh --with-dev`,确认导出包卫生与导出包 smoke 仍通过。
15-
- 在任务执行完成后生成 Git Delivery Evidence 与任务 closeout packet
15+
- 在任务执行完成后生成本地 Git Delivery Evidence;实时工作树快照不作为入库真相源,最终交付以 clean worktree、commit hash、acceptance 与 push 后 CI 为准
1616
- bugfix / regression / flaky 任务必须把 DEBUG.md 的回归证据串到 Recent Evidence
1717
- TP-01.01 | Verify: 输出 schema 文档和来源哈希对照。 | Gate: 确认 raw 表不会进入导出包。
1818
- TP-01.02 | Verify: fixture schema 校验和样本快照通过。 | Gate: 明确时区、容差、来源哈希。
19-
- TP-01.03 | Verify: pytest 对 `lunar-python` 计算结果与 fixture 进行边界断言。 | Gate: 任何误差必须有容差解释。
19+
- TP-01.03 | Verify: pytest 对 `lunar-python` 计算结果与 fixture 进行容差断言,并对抽样年份做 fixture 边界断言。 | Gate: 任何误差必须有容差解释。
2020
- TP-01.04 | Verify: pytest 覆盖起运顺逆样本。 | Gate: 起运样本来源和预期值必须可追溯。
2121
- TP-02.01 | Verify: 输出入口清单和默认块清单。 | Gate: 确认前端不应自行拼报告。
2222
- TP-02.02 | Verify: 结构快照不含紫微、黄历、建除、六爻等块。 | Gate: 非八字体系统一保留为独立 capability 或未来登记。
@@ -56,7 +56,7 @@
5656
- 标题: 节气 golden 回归
5757
- 验收标准:
5858
- fixture 不直接依赖 raw 文件运行。
59-
- 边界测试覆盖 t-1s/t/t+1s
59+
- 边界测试覆盖 fixture t-1s 与 fixture 容差窗口后的柱切换
6060
- 起运至少覆盖顺逆、性别、阴阳年样本。
6161
- Verify: pytest 新增节气 golden、月令边界、立春年界、起运样本测试。
6262
- Gate: 节气时间 schema、时区、容差和 fixture 来源全部明确。
@@ -82,7 +82,7 @@
8282
- 标题: 节气与月令边界测试
8383
- 验收标准:
8484
- 达成当前节点 objective,且输出物可复核
85-
- Verify: pytest 对 `lunar-python` 计算结果与 fixture 进行边界断言
85+
- Verify: pytest 对 `lunar-python` 计算结果与 fixture 进行容差断言,并对抽样年份做 fixture 边界断言
8686
- Gate: 任何误差必须有容差解释。
8787
- 输出物: 无
8888

0 commit comments

Comments
 (0)