Skip to content

fix(selling): 强制核对候选规格/预算与架构规划基线并禁止虚假合同优惠 - #303

Closed
ruanzhengxin-zhuxing wants to merge 2 commits into
mainfrom
harness/d4d9e333
Closed

fix(selling): 强制核对候选规格/预算与架构规划基线并禁止虚假合同优惠#303
ruanzhengxin-zhuxing wants to merge 2 commits into
mainfrom
harness/d4d9e333

Conversation

@ruanzhengxin-zhuxing

Copy link
Copy Markdown
Collaborator

问题

candidate 只携带自由文本 monthly_estimatearchitecture_planning 推荐的计算规格没有任何结构化载体;cost_estimating 上唯一的代码守卫 require_context_constraint_coverage 只校验 source=user 的硬约束。因此:

  1. 规格漂移无核对 — 规划规格可以在 architecture_planningcost_estimatingros_preview 之间静默改变。
  2. 预算超支从不标注prompts/confirm_and_select.md 甚至主动要求忽略 candidate.monthly_estimate,仓库内没有任何 deviation 实现。
  3. 虚假合同优惠prompts/cost_estimating.md 要求"即使数值相同也保留两个价格口径",导致无折扣账户仍被渲染出 ¥443.29/月(列表价,合同优惠后约¥443.29/月)

方案

按仓库既有的三层做法收敛:技能 schema 声明字段 → 提示词解释口径 → complete_step 代码守卫兜底(比照 hard_constraints.py,模型删字段或改写结论都无法绕过)。

  • architecture 技能候选新增 planned_compute / planned_budget 规划基线
  • 新增 engine/cost_consistency.py,纯函数实现规格 reconcile、预算偏离判定与合同优惠真实性校验
  • complete_step 新增 require_cost_consistency 守卫,接入 loader.py 与 selling pipeline.yamlcost_estimating 步骤
  • cost 技能新增 spec_reconciliation / budget_deviation 结论字段,并修正 monthly_estimate 口径:TradeAmount 等于 OriginalAmount 时只输出列表价
  • confirm_and_select 两个提示词在偏离时向 summary 追加显式标注

兼容性

新增字段全部可选且为追加,deployingpreview_validation 的消费保持兼容;候选未提供基线时降级为 unknown 而不拦截。

验证

  • 新增 29 个 cost_consistency 单测(含三个证据 session 的真实数值)与 4 个 require_cost_consistency 守卫单测,全部通过
  • make lint(ruff + ty)通过
  • 全量 pytest:14376 passed;剩余 4 failed / 3 errors 与改动前基线一致

另含一个 style 提交:仓库锁定 ruff 0.15.10 但 16 个存量文件未按该版本格式化,pre-commit 的 format 钩子否则会拦截一切提交。

仓库锁定 ruff 0.15.10,但 16 个存量文件尚未按该版本格式化,pre-commit 的
format 钩子每次提交都会改写它们,使任何提交都无法通过。先单独落地这批纯
格式化改动,让后续功能提交的 diff 保持干净。
candidate 只携带自由文本 monthly_estimate,architecture_planning 推荐的计算
规格没有任何结构化载体;cost_estimating 上唯一的代码守卫
require_context_constraint_coverage 只校验 source=user 的硬约束,因此规划
规格可以在 architecture_planning → cost_estimating → ros_preview 之间静默
漂移,预算超支也从不标注(confirm_and_select 提示词还主动要求忽略
candidate.monthly_estimate)。同时 cost_estimating 提示词要求"即使数值相同
也保留两个价格口径",导致无合同折扣的账户仍被渲染出"合同优惠后约¥X"的
虚假优惠。

按仓库既有的三层做法收敛:技能 schema 声明字段、提示词解释口径、
complete_step 代码守卫兜底。

- architecture 技能候选新增 planned_compute / planned_budget 规划基线
- 新增 cost_consistency 模块,比照 hard_constraints 的纯函数风格实现规格
  reconcile、预算偏离判定与合同优惠真实性校验
- complete_step 新增 require_cost_consistency 守卫并接入 loader 与
  selling pipeline.yaml 的 cost_estimating 步骤
- cost 技能新增 spec_reconciliation / budget_deviation 结论字段,并修正
  monthly_estimate 口径:TradeAmount 等于 OriginalAmount 时只输出列表价
- confirm_and_select 两个提示词在偏离时向 summary 追加显式标注

字段全部可选且新增,deploying 对 preview_validation 的消费保持兼容;
候选未提供基线时降级为 unknown 而不拦截。
@guima-why guima-why closed this Aug 25, 2026
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.

2 participants