chore: md 口径(主人 2026-10-29 定)——仅决策台账/索引入库推送,其余 md 退出跟踪(本地照常维护)

This commit is contained in:
lianjianwei2024
2026-10-29 15:36:53 +08:00
parent a2a1d81440
commit 5435e06736
36 changed files with 150 additions and 7097 deletions

View File

@@ -1,38 +0,0 @@
# core_intent_coverage —— 核心设计意图覆盖核验工具包
## 它是什么
一个**只读、零污染**的静态核验工具:把你最怕"改坏"的那几条业务口径(设计意图)
列成 `intents.json`,扫描 `CostReview/app` 源码与 `app/tests` 测试,报告这些意图
**有没有被现有 p0/p1 测试真正断言到**。
直接服务于「上市前第一步:功能验收 + 回归」——
先确认既有测试是不是真把你的设计设想编码成了断言,而不是只在跑 happy-path 冒烟。
## 安全边界(硬规矩)
- **绝不 import 任何 app 模块** → 不会触发 app 副作用、不会写库。
- **绝不向 `CostReview/` 写任何文件** → 输出只落在本包 `out/`。
- 对工程目录只做 `open(..., 'r')`。
## 怎么跑
```bash
cd D:/PricingReview/test/core_intent_coverage
python run.py
# 或自定义路径:
python run.py --app D:/PricingReview/CostReview/app --tests D:/PricingReview/CostReview/app/tests
```
零依赖(仅 Python 标准库,3.9+)。
## 输出
- `out/report.md` —— 人读报告(每条意图:源码是否存在 / 是否被测试覆盖 / 强度 / 断言数 / 命中测试)。
- `out/report.json` —— 机读,便于后续接入台账或 CI。
## 已知局限(诚实声明)
1. 这是**静态启发式**扫描(子串匹配 + 按 `test_` 函数分块统计 assert 数),
不等于运行态验证。它告诉你"哪里可能有断言",但**不保证断言逻辑正确**。
2. 标记词(markers)是关键词近似,可能误报/漏报;请结合 `report.md` 人工核对。
3. "在结果上修改"指的是**完善本工具的 `intents.json` / 调标记词**(改的是工具自己的配置,
不是你的软件代码)。若要在 `CostReview` 里**新增测试补缺口**,按你的规矩须由你/我显式确认后再动。
## 与 `CostReview/app/tests` 的关系
`app/tests` 是**真正的测试用例**(会跑、会动 DB,靠 `api_harness` 隔离副本)。
本工具是**元层检查器**:只读它们,不重复它们,不改它们。

View File

@@ -1,190 +0,0 @@
# 核心设计意图覆盖核验报告
> 生成方式:只读静态扫描,未 import / 未修改 CostReview 任何文件。
总意图数:**8** | 已覆盖:**7** | 未覆盖:**1**
## [✅] INT-01 价格导入:一个块=一个批次
- 描述:HTML 一个顶层块=一批次;期次优先级 块名→文件名→弹框;批次名 多块用块名/单块用弹框名。
- 源码存在:True | 测试覆盖:True | 强度:**强(邻近有断言)** | 邻近断言数:104
- 源码命中文件:core\export_cos.py, core\export_xlsx.py, core\import_job.py, core\match.py, core\price_html.py, core\price_xlsx.py, core\session_job.py, server\api_server.py, server\mcp_server.py, tests\test_api_p1.py, tests\test_api_upgrade.py, tests\test_export_structure.py, tests\test_kw_tier.py, tests\test_lme_uw_card.py, tests\test_match_tiers.py, tests\test_norm_op.py, tests\test_price_redesign.py, tests\test_unit_core.py, tools\backfill_lme_lib.py, tools\check_parity.py, tools\gen_price_mock.py, tools\gen_project_mock.py, tools\purge_batches.py, tools\rebuild_batch_db.py
- 测试引用(intent=与本意图邻近的断言数 / total=函数内总断言数):
- `test_api_p1.py::test_inq_lifecycle` (intent=3 / total=12)
- `test_api_p1.py::test_adopt_flow` (intent=1 / total=8)
- `test_api_p1.py::test_clear_mock_keeps_real` (intent=2 / total=3)
- `test_api_p1.py::test_price_import_rejects_empty_class` (intent=1 / total=1)
- `test_api_p1.py::test_price_import_single_and_dup` (intent=8 / total=8)
- `test_api_upgrade.py::test_upgrade_via_admin_api` (intent=2 / total=4)
- `test_api_upgrade.py::test_upgrade_via_audit_open` (intent=1 / total=3)
- `test_api_upgrade.py::test_upgrade_price_batch_rejected` (intent=2 / total=2)
- `test_export_structure.py::test_resource_pseudo_norm_skipped_on_import` (intent=2 / total=3)
- `test_export_structure.py::test_coef_unit_prefix_no_double_count` (intent=1 / total=4)
- `test_kw_tier.py::test_strict_first_loose_last` (intent=0 / total=1)
- `test_kw_tier.py::test_rank_combined_with_filters` (intent=2 / total=2)
- `test_match_tiers.py::test_disabled_batch_excluded` (intent=1 / total=1)
- `test_match_tiers.py::test_period_distance_sort_and_window` (intent=3 / total=3)
- `test_norm_op.py::test_norm_ntdel_export_omits` (intent=4 / total=8)
- `test_price_redesign.py::test_dirs_tree_and_counts` (intent=2 / total=9)
- `test_price_redesign.py::test_prices_filter_and_export` (intent=8 / total=11)
- `test_unit_core.py::test_price_html_parse_and_records` (intent=4 / total=8)
- `test_unit_core.py::test_price_xlsx_parse_and_template` (intent=5 / total=10)
- `test_api_group.py::test_group_conservation_and_name_layer` (intent=4 / total=9)
- `test_export_structure.py::test_new_bill_full_structure_cos` (intent=0 / total=12)
- `test_unit_core.py::test_clean_attr_strips_and_guard` (intent=3 / total=3)
- `test_unit_core.py::test_guess_period` (intent=4 / total=4)
- `test_unit_core.py::test_price_html_rejects_non_data` (intent=1 / total=2)
- `test_api_p0.py::test_gate_off_and_status` (intent=0 / total=2)
- `test_api_p0.py::test_import_project_ok` (intent=3 / total=10)
- `test_api_p0.py::test_import_encrypted_rejected` (intent=1 / total=1)
- `test_api_p0.py::test_import_unknown_rejected` (intent=1 / total=1)
- `test_api_p0.py::test_import_xml_rejected` (intent=1 / total=1)
- `test_api_p0.py::test_import_outside_path_rejected` (intent=1 / total=1)
- `test_api_p0.py::test_import_dup_confirm_then_force` (intent=3 / total=3)
- `test_api_p0.py::test_search_bill_self_excluded` (intent=0 / total=4)
- `test_api_p0.py::test_search_lme` (intent=0 / total=2)
- `test_api_p0.py::test_hist_search_kw` (intent=0 / total=4)
- `test_api_p0.py::test_delete_batch_cascade` (intent=1 / total=6)
- `test_api_p0.py::test_batch_row_edit_whitelist` (intent=0 / total=3)
- `test_api_p1.py::test_attach_lifecycle` (intent=1 / total=10)
- `test_api_p1.py::test_enabled_toggle` (intent=1 / total=3)
- `test_api_p1.py::test_price_xlsx_import` (intent=2 / total=12)
- `test_api_p1.py::test_dict_roundtrip` (intent=0 / total=7)
- `test_export_ext.py::test_ext_follows_source` (intent=1 / total=1)
- `test_export_structure.py::test_new_bill_top_anchor_position` (intent=1 / total=4)
- `test_export_structure.py::test_adoption_carries_express_adjustment` (intent=1 / total=6)
- `test_license_import.py::test_repo_pinned_keys_prod_key_self_consistent` (intent=0 / total=4)
- `test_license_import.py::test_import_validate_matrix` (intent=2 / total=2)
- `test_license_import.py::test_import_error_never_echoes_content` (intent=3 / total=3)
- `test_license_import.py::test_import_loopback_http_dev_only` (intent=2 / total=2)
- `test_license_import.py::test_import_happy_path` (intent=3 / total=3)
- `test_license_import.py::test_import_conflict_needs_explicit_confirm` (intent=5 / total=5)
- `test_license_import.py::test_import_same_instance_no_confirm_needed` (intent=1 / total=1)
- `test_license_import.py::test_import_high_water_preserved` (intent=2 / total=2)
- `test_license_verify.py::test_revoked_key` (intent=0 / total=0)
- `test_license_verify.py::test_non_p256_key_rejected_at_ring_build` (intent=0 / total=0)
- `test_lme_price.py::test_export_recode_renames_mother_and_rebuilds_children` (intent=0 / total=3)
- `test_lme_price.py::test_export_recode_childless_renames_only` (intent=0 / total=2)
- `test_norm_op.py::test_adopt_gcl_default_and_price_overwrite` (intent=0 / total=7)
- `test_norm_op.py::test_qty_export_follows_source_pattern` (intent=2 / total=6)
- `test_perf_baseline.py::test_large_project_import_and_open` (intent=1 / total=3)
- `test_perf_baseline.py::test_read_not_starved_under_write` (intent=0 / total=1)
- `test_price_redesign.py::test_dir_add_rename_move_seq` (intent=0 / total=11)
- `test_price_redesign.py::test_dir_del_rows_fall_uncat` (intent=0 / total=4)
- `test_price_redesign.py::test_row_crud_and_hash` (intent=1 / total=11)
- `test_unit_core.py::test_sniff` (intent=0 / total=1)
## [✅] INT-02 工料机/价格分表存储 + 判批次用 kind
- 描述:x_rows_lme 只存工料机数,x_rows_price 只存价格数;判断批次有没有工料机一律用 kind='project',永远别用行数。
- 源码存在:True | 测试覆盖:True | 强度:**强(邻近有断言)** | 邻近断言数:50
- 源码命中文件:core\export_xlsx.py, core\import_job.py, core\match.py, server\api_server.py, tests\test_api_p0.py, tests\test_api_p1.py, tests\test_price_redesign.py, tools\backfill_lme_lib.py, tools\gen_price_mock.py, tools\gen_project_mock.py, tools\test_parse_std.py
- 测试引用(intent=与本意图邻近的断言数 / total=函数内总断言数):
- `test_api_p0.py::test_import_project_ok` (intent=4 / total=10)
- `test_api_p1.py::test_price_xlsx_import` (intent=4 / total=12)
- `test_api_p1.py::test_price_import_single_and_dup` (intent=8 / total=8)
- `test_price_redesign.py::test_row_crud_and_hash` (intent=5 / total=11)
- `test_api_p0.py::test_import_dup_confirm_then_force` (intent=2 / total=3)
- `test_api_p1.py::test_inq_lifecycle` (intent=1 / total=12)
- `test_api_p1.py::test_clear_mock_keeps_real` (intent=0 / total=3)
- `test_api_p1.py::test_price_import_rejects_empty_class` (intent=1 / total=1)
- `test_api_upgrade.py::test_upgrade_via_audit_open` (intent=3 / total=3)
- `test_api_upgrade.py::test_upgrade_price_batch_rejected` (intent=1 / total=2)
- `test_export_structure.py::test_new_bill_top_anchor_position` (intent=1 / total=4)
- `test_export_structure.py::test_adoption_carries_express_adjustment` (intent=2 / total=6)
- `test_export_structure.py::test_resource_pseudo_norm_skipped_on_import` (intent=1 / total=3)
- `test_export_structure.py::test_coef_unit_prefix_no_double_count` (intent=0 / total=4)
- `test_kw_tier.py::test_rank_combined_with_filters` (intent=1 / total=2)
- `test_license_import.py::test_repo_pinned_keys_prod_key_self_consistent` (intent=1 / total=4)
- `test_license_verify.py::test_package_vectors_canonical_matches` (intent=2 / total=2)
- `test_lme_price.py::test_merge_child_group_repoints_unit_mothers_and_replaces_children` (intent=0 / total=9)
- `test_lme_price.py::test_http_lme_price_end_to_end` (intent=1 / total=10)
- `test_norm_op.py::test_norm_unadopt_hard_delete` (intent=0 / total=6)
- `test_norm_res_name.py::test_collision_row_takes_summary_whole` (intent=1 / total=2)
- `test_perf_baseline.py::test_large_project_import_and_open` (intent=1 / total=3)
- `test_perf_baseline.py::test_read_not_starved_under_write` (intent=0 / total=1)
- `test_price_redesign.py::test_prices_filter_and_export` (intent=1 / total=11)
- `test_unit_core.py::test_sim_weighted_token_veto` (intent=0 / total=2)
- `test_unit_core.py::test_lme_list_where_kind_cast` (intent=0 / total=1)
- `test_unit_core.py::test_parse_std_structure` (intent=9 / total=14)
## [✅] INT-03 会话↔后台批次同源绑定
- 描述:靠 batches.x_src_hash == sessions.src_name(都是 sha256_原名)只认同源文件;工作台只读,绑定/改绑只在后台。
- 源码存在:True | 测试覆盖:True | 强度:**强(邻近有断言)** | 邻近断言数:4
- 源码命中文件:core\export_cos.py, core\import_job.py, core\match.py, core\session_job.py, server\api_server.py, tests\test_api_upgrade.py, tests\test_export_ext.py, tests\test_kw_tier.py, tests\test_lme_proj_source.py, tests\test_lme_uw_card.py, tests\test_match_tiers.py, tests\test_norm_res_name.py, tests\test_source_guards.py, tests\test_stopwords.py, tools\backfill_lme_lib.py, tools\gen_price_mock.py, tools\gen_project_mock.py, tools\purge_batches.py, tools\test_parse_std.py
- 测试引用(intent=与本意图邻近的断言数 / total=函数内总断言数):
- `test_api_upgrade.py::test_upgrade_via_audit_open` (intent=0 / total=3)
- `test_export_ext.py::test_ext_follows_source` (intent=1 / total=1)
- `test_source_guards.py::test_reopen_with_new_file_syncs_src_and_remarks` (intent=3 / total=9)
## [✅] INT-04 列表排序口径
- 描述:排序 x_period_end_m DESC, x_imported_at DESC, id DESC(期次最新最前)。
- 源码存在:True | 测试覆盖:True | 强度:**强(邻近有断言)** | 邻近断言数:15
- 源码命中文件:core\export_xlsx.py, core\import_job.py, core\match.py, core\search_demo.py, server\api_server.py, tests\test_api_p1.py, tests\test_kw_tier.py, tests\test_match_tiers.py, tests\test_stopwords.py, tools\gen_price_mock.py, tools\gen_project_mock.py
- 测试引用(intent=与本意图邻近的断言数 / total=函数内总断言数):
- `test_api_p1.py::test_price_xlsx_import` (intent=3 / total=12)
- `test_api_p1.py::test_price_import_single_and_dup` (intent=4 / total=8)
- `test_api_group.py::test_group_conservation_and_name_layer` (intent=4 / total=9)
- `test_group_order.py::test_kw_group_mixed_by_tsum` (intent=1 / total=4)
- `test_kw_tier.py::test_loose_flag_matches_rank` (intent=0 / total=1)
- `test_norm_res_name.py::test_merge_groups_keep_composite_rows` (intent=3 / total=5)
## [✅] INT-05 序号递减口径
- 描述:序号 seq = total - ((page-1)*size + i)(首行=总数递减)。
- 源码存在:True | 测试覆盖:True | 强度:**强(邻近有断言)** | 邻近断言数:16
- 源码命中文件:core\export_cos.py, core\export_xlsx.py, core\import_job.py, core\match.py, core\price_xlsx.py, core\session_job.py, server\api_server.py, server\license_client\gate.py, shell.py, tests\test_api_group.py, tests\test_group_order.py, tests\test_grp_units.py, tests\test_kw_tier.py, tests\test_lme_price.py, tests\test_lme_proj_source.py, tests\test_match_tiers.py, tests\test_norm_res_name.py, tests\test_perf_baseline.py, tests\test_price_redesign.py, tests\test_stopwords.py, tools\check_parity.py, tools\gen_price_mock.py, tools\health_check.py, tools\purge_batches.py, tools\rebuild_batch_db.py
- 测试引用(intent=与本意图邻近的断言数 / total=函数内总断言数):
- `test_api_group.py::test_group_keyword_layer` (intent=0 / total=3)
- `test_group_order.py::test_kw_group_mixed_by_tsum` (intent=0 / total=4)
- `test_lme_price.py::test_merge_child_group_repoints_unit_mothers_and_replaces_children` (intent=3 / total=9)
- `test_norm_res_name.py::test_merge_groups_keep_composite_rows` (intent=1 / total=5)
- `test_price_redesign.py::test_dirs_tree_and_counts` (intent=1 / total=9)
- `test_price_redesign.py::test_dir_add_rename_move_seq` (intent=2 / total=11)
- `test_kw_tier.py::test_pagination_rank_stable` (intent=2 / total=2)
- `test_perf_baseline.py::test_large_project_import_and_open` (intent=1 / total=3)
- `test_perf_baseline.py::test_read_not_starved_under_write` (intent=0 / total=1)
- `test_price_redesign.py::test_prices_filter_and_export` (intent=4 / total=11)
- `test_stopwords.py::test_stop_before_limit_pagination` (intent=2 / total=2)
## [✅] INT-06 询价附件项目专属
- 描述:询价附件=项目专属,lmes 与 prices 零交叉,附件挂 lmes 天然只落项目;代码显式断言 kind='project'。
- 源码存在:True | 测试覆盖:True | 强度:**强(邻近有断言)** | 邻近断言数:34
- 源码命中文件:core\export_xlsx.py, core\import_job.py, core\match.py, core\search_demo.py, core\session_job.py, server\api_server.py, tests\api_harness.py, tests\test_api_p0.py, tests\test_api_p1.py, tests\test_lme_price.py, tests\test_lme_proj_source.py, tests\test_lme_uw_card.py, tests\test_norm_res_name.py, tests\test_perf_baseline.py, tests\test_unit_core.py, tools\backfill_lme_lib.py, tools\check_parity.py, tools\gen_price_mock.py, tools\gen_project_mock.py, tools\purge_batches.py, tools\rebuild_batch_db.py, tools\test_parse_std.py
- 测试引用(intent=与本意图邻近的断言数 / total=函数内总断言数):
- `test_api_p1.py::test_attach_lifecycle` (intent=0 / total=10)
- `test_api_p1.py::test_inq_lifecycle` (intent=11 / total=12)
- `test_api_p1.py::test_adopt_flow` (intent=3 / total=8)
- `test_price_redesign.py::test_prices_filter_and_export` (intent=3 / total=11)
- `test_api_p0.py::test_audit_open_reuse_and_remark` (intent=2 / total=9)
- `test_api_p0.py::test_delete_batch_cascade` (intent=5 / total=6)
- `test_lme_price.py::test_raw_uw_rows_are_nine_wide_with_taxrate_at_7` (intent=0 / total=4)
- `test_lme_price.py::test_raw_proj_fallback_nine_wide_taxrate_at_7` (intent=0 / total=4)
- `test_lme_price.py::test_raw_proj_fallback_without_taxrate_column` (intent=0 / total=1)
- `test_lme_price.py::test_raw_uw_agg_fallback_nine_wide_taxrate_at_7` (intent=0 / total=4)
- `test_lme_proj_source.py::test_migrate_rekeys_events_and_gate` (intent=0 / total=4)
- `test_norm_res_name.py::test_name_prefers_unit_summary` (intent=2 / total=2)
- `test_norm_res_name.py::test_legacy_chain_intact` (intent=1 / total=1)
- `test_norm_res_name.py::test_prices_filled_from_summary_when_missing` (intent=0 / total=1)
- `test_norm_res_name.py::test_collision_row_takes_summary_whole` (intent=0 / total=2)
- `test_perf_baseline.py::test_large_project_import_and_open` (intent=0 / total=3)
- `test_unit_core.py::test_parse_std_structure` (intent=7 / total=14)
## [❌] INT-07 数据源字典口径
- 描述:dict_region + dict_org(cat: publisher|builder);录入类下拉只取字典,过滤类下拉取 字典∪库里实际值。
- 源码存在:True | 测试覆盖:False | 强度:**未覆盖** | 邻近断言数:0
- 源码命中文件:core\match.py, server\api_server.py, tests\test_api_p1.py, tests\test_api_upgrade.py, tests\test_kw_tier.py, tests\test_price_redesign.py, tests\test_stopwords.py, tools\gen_price_mock.py
## [✅] INT-08 信息价期次优先级
- 描述:价格导入期次优先级 块名→文件名→弹框;一个块=一个批次。
- 源码存在:True | 测试覆盖:True | 强度:**强(邻近有断言)** | 邻近断言数:15
- 源码命中文件:core\export_xlsx.py, core\import_job.py, core\match.py, core\price_html.py, core\price_xlsx.py, core\search_demo.py, core\session_job.py, server\api_server.py, tests\api_harness.py, tests\test_api_p0.py, tests\test_api_p1.py, tests\test_kw_tier.py, tests\test_lme_price.py, tests\test_match_tiers.py, tests\test_norm_res_name.py, tests\test_unit_core.py, tools\check_parity.py
- 测试引用(intent=与本意图邻近的断言数 / total=函数内总断言数):
- `test_api_p0.py::test_batch_row_edit_whitelist` (intent=3 / total=3)
- `test_api_p1.py::test_price_xlsx_import` (intent=3 / total=12)
- `test_api_p1.py::test_price_import_single_and_dup` (intent=3 / total=8)
- `test_kw_tier.py::test_strict_first_loose_last` (intent=0 / total=1)
- `test_kw_tier.py::test_pagination_rank_stable` (intent=0 / total=2)
- `test_match_tiers.py::test_period_distance_sort_and_window` (intent=3 / total=3)
- `test_unit_core.py::test_sniff` (intent=1 / total=1)
- `test_lme_price.py::test_sub_composition_rows_are_editable` (intent=1 / total=2)
- `test_lme_price.py::test_merge_still_registers_codes_after_refactor` (intent=1 / total=3)
- `test_lme_price.py::test_merge_group_includes_child_rows_with_flag` (intent=0 / total=3)
- `test_norm_res_name.py::test_merge_groups_keep_composite_rows` (intent=0 / total=5)