Skip to content

fix(scoring): 审计 nit 修复(提示词边界 / 作废语义 / 版本断言) - #302

Merged
mariusiaowego-commits merged 1 commit into
mainfrom
fix/bv-direction-audit-nits
Nov 24, 2026
Merged

mariusiaowego-commits merged 1 commit into
mainfrom
fix/bv-direction-audit-nits

Conversation

@mariusiaowego-commits

Copy link
Copy Markdown
Owner

来源

hermes -p coder 对 #300 的独立只读审计,结论 APPROVE WITH NITS,6 条全是 P2,没有 P0/P1。这轮修掉其中 3 条真问题。

改了什么

  1. 提示词边界(审计 finding 3)。用户写的「研究提示词」和「碎片想法」原先只是自然语言标一句「这是用户输入」。现在用 <研究要求> / <用户想法> 标签圈起来,模型不会把标签里的内容当成规则接着往下写。测试锁住了标签存在、且闭合标签在十维 rubric 之前。
  2. 作废语义(审计 finding 6)。research_invalidated 之前是「改了字段 且 当前不可用」,方向本来就没研究过也会报 true,前端就会说「研究需重新生成」——但根本没有研究可重新生成。现在只有「确实有一份研究被作废」才为 true。
  3. 版本断言(审计 finding 1)。test_migration_059 原来写死 _CURRENT_VERSION == 59。058 还被未合并的 feat(llm): 对大模型的信息脱敏 —— 5 条 hermes 出站通道出站遮蔽 + 入站还原 + 审计账本 #294 占着,下一个迁移号一到,这个测试就会假红。改成 >= 59,和仓库里其它迁移测试一致。

审计里那条没改的

审计 finding 4 说「保存并立即研究」把 directionResearch(saved) 放在同一个 try 里,研究失败会被外层 catch 报成「保存方向失败」。这条不成立:directionResearch 自己带了 try/catch,失败时报的是「启动研究失败」,外层 catch 只管保存本身。没改。

测试

/usr/local/bin/python3 -m pytest tests/test_direction_api.py tests/test_migration_059_bv_direction_guidance.py tests/test_direction_store_guidance.py tests/test_scoring_direction_guidance.py tests/test_frontend_bv_direction_columns.py tests/test_direction_store.py tests/test_scoring_direction.py tests/test_direction_runner.py tests/test_direction_score_api.py -p no:cacheprovider -q

输出:145 passed in 10.06s。

还没做

  • 未合并、未打 tag、未部署。

独立审计给了 APPROVE WITH NITS,这轮修掉三条真问题:
- 用户写的研究提示词和碎片想法都用标签圈起来,标成输入而不是规则。
- research_invalidated 只在「确实作废过一份研究」时为真,没研究过不算。
- 迁移版本断言改成 >= 59,058 还没合,下一个迁移号不会再把这个测试打红。

审计提的「保存并立即研究失败会误报保存失败」不成立:directionResearch
自己 catch 了,失败时报的是「启动研究失败」,外层 catch 只管保存本身。
@mariusiaowego-commits
mariusiaowego-commits merged commit f7765c3 into main Nov 24, 2026
1 check passed
@mariusiaowego-commits
mariusiaowego-commits deleted the fix/bv-direction-audit-nits branch November 24, 2026 12:19
mariusiaowego-commits added a commit that referenced this pull request Nov 24, 2026
回填 v1.0.126:PR #300 业务方向研究提示词 + 两段式草稿、PR #301 Pin 表列宽收进内容区、PR #302 审计 nit 修复。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant