Skip to content

fix(optimizer): enforce aggregation_id assignment via OptimizerSolution::register_config - #585

Merged
milindsrivastava1997 merged 1 commit into
mainfrom
worktree-564-aggregation-id-placeholder
Aug 23, 2026
Merged

fix(optimizer): enforce aggregation_id assignment via OptimizerSolution::register_config#585
milindsrivastava1997 merged 1 commit into
mainfrom
worktree-564-aggregation-id-placeholder

Conversation

@milindsrivastava1997

Copy link
Copy Markdown
Contributor

Summary

  • candidate_gen.rs builds candidates with aggregation_id = 0 as a placeholder, needed for cost evaluation before any solver has run — the comment claimed a "greedy/MIP solver" would replace it, but there was no tracking issue and no enforcement, just greedy.rs correctly-but-unenforced overwriting it before insertion.
  • Make OptimizerSolution.deployed_configs private and route all insertion through a new register_config() method, which always assigns a fresh id. No solver — greedy.rs today, a future MIP solver later — can add a deployed config without going through id assignment.

Test plan

  • cargo test --lib -p asap_planner optimizer — 38 passed (36 existing + 2 new: register_config_never_leaves_the_placeholder_id, register_config_assigns_distinct_ids)
  • cargo clippy --lib -p asap_planner --tests — clean
  • cargo fmt -p asap_planner -- --check — clean

Fixes #564

🤖 Generated with Claude Code

…on::register_config

candidate_gen.rs builds candidates with aggregation_id=0 as a placeholder for
cost evaluation, since the id isn't known until a solver deploys the config.
greedy.rs correctly overwrote it before insertion, but nothing stopped a
future solver (or a change to greedy.rs) from forgetting to.

Make deployed_configs private on OptimizerSolution and route all insertion
through register_config(), which always assigns a fresh id. No caller can
add a deployed config without going through id assignment.

Fixes #564
@milindsrivastava1997
milindsrivastava1997 merged commit 85c112e into main Aug 23, 2026
5 checks passed
@milindsrivastava1997
milindsrivastava1997 deleted the worktree-564-aggregation-id-placeholder branch August 23, 2026 21:30
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.

Optimizer: candidate_gen.rs hardcodes aggregation_id = 0

1 participant