fix(selling): 强制核对候选规格/预算与架构规划基线并禁止虚假合同优惠 - #303
Closed
ruanzhengxin-zhuxing wants to merge 2 commits into
Closed
Conversation
仓库锁定 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 而不拦截。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
candidate 只携带自由文本
monthly_estimate,architecture_planning推荐的计算规格没有任何结构化载体;cost_estimating上唯一的代码守卫require_context_constraint_coverage只校验source=user的硬约束。因此:architecture_planning→cost_estimating→ros_preview之间静默改变。prompts/confirm_and_select.md甚至主动要求忽略candidate.monthly_estimate,仓库内没有任何 deviation 实现。prompts/cost_estimating.md要求"即使数值相同也保留两个价格口径",导致无折扣账户仍被渲染出¥443.29/月(列表价,合同优惠后约¥443.29/月)。方案
按仓库既有的三层做法收敛:技能 schema 声明字段 → 提示词解释口径 →
complete_step代码守卫兜底(比照hard_constraints.py,模型删字段或改写结论都无法绕过)。planned_compute/planned_budget规划基线engine/cost_consistency.py,纯函数实现规格 reconcile、预算偏离判定与合同优惠真实性校验complete_step新增require_cost_consistency守卫,接入loader.py与 sellingpipeline.yaml的cost_estimating步骤spec_reconciliation/budget_deviation结论字段,并修正monthly_estimate口径:TradeAmount等于OriginalAmount时只输出列表价confirm_and_select两个提示词在偏离时向summary追加显式标注兼容性
新增字段全部可选且为追加,
deploying对preview_validation的消费保持兼容;候选未提供基线时降级为unknown而不拦截。验证
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 钩子否则会拦截一切提交。