Skip to content

Debug harness: use load_scaling when evaluating the original plan#4218

Merged
springfall2008 merged 1 commit into
mainfrom
fix/debug-harness-load-scaling
Jul 9, 2026
Merged

Debug harness: use load_scaling when evaluating the original plan#4218
springfall2008 merged 1 commit into
mainfrom
fix/debug-harness-load-scaling

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

Problem

unit_test.py --debug <file> --redo prints two headline metrics: the original plan's (as loaded from the customer dump) and the re-calculated plan's. The original plan was evaluated against a load model built with scale_fixed=1.0, but calculate_plan immediately rebuilds load_minutes_step with the customer's load_scaling (plus load_adjust/load_baseline).

With load_scaling: 1.05 this made byte-identical plans appear to be a ~15p optimizer regression (orig metric -1146.86 vs final -1131.92), which cost a debugging session chasing a phantom "levels stage won't charge" bug.

Fix

Mirror calculate_plan's load-model parameters in the harness's reset_load_model block so both metrics are computed against the same load data. Verified on the triggering dump: orig and final now both report -1131.9186 for the identical plan.

Only affects manual --debug --redo runs; the debug_cases regression suite calls run_single_debug with redo=False and is unaffected (suite passes).

Testing

  • ./run_all --test debug_cases — PASSED
  • ./run_pre_commit — clean
  • Re-ran the triggering customer dump with --redo: orig/final metrics now identical for identical plans

🤖 Generated with Claude Code

…he re-calculated plan

run_single_debug --redo rebuilt load_minutes_step with scale_fixed=1.0, then
calculate_plan rebuilds it with the user's load_scaling (and load_adjust /
load_baseline). The original plan metric was therefore evaluated against
lighter load than the final plan, making identical plans look like a metric
regression (e.g. -1146.86 vs -1131.92 with load_scaling 1.05). Mirror the
calculate_plan load model parameters so the two printed metrics are comparable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 9, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns the debug harness’s “original plan” metric evaluation with the same load-model parameters used by Plan.calculate_plan, preventing misleading metric deltas when the plan itself is unchanged.

Changes:

  • Rebuild the debug harness load step data using load_scaling (instead of a fixed 1.0), matching calculate_plan.
  • Include load_adjust and load_baseline in the harness load-model rebuild to fully mirror the planning path.
  • Add explanatory comments documenting why the harness must mirror calculate_plan for fair metric comparison.

@springfall2008 springfall2008 merged commit 8a26ba4 into main Jul 9, 2026
3 checks passed
@springfall2008 springfall2008 deleted the fix/debug-harness-load-scaling branch July 9, 2026 20:06
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