fix(optimizer): enforce aggregation_id assignment via OptimizerSolution::register_config - #585
Merged
milindsrivastava1997 merged 1 commit intoAug 23, 2026
Conversation
…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
deleted the
worktree-564-aggregation-id-placeholder
branch
August 23, 2026 21:30
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.
Summary
candidate_gen.rsbuilds candidates withaggregation_id = 0as 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, justgreedy.rscorrectly-but-unenforced overwriting it before insertion.OptimizerSolution.deployed_configsprivate and route all insertion through a newregister_config()method, which always assigns a fresh id. No solver —greedy.rstoday, 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— cleancargo fmt -p asap_planner -- --check— cleanFixes #564
🤖 Generated with Claude Code