Skip to content

xhatspecific_spoke: wire scenario_dict and all_nodenames (#586)#707

Merged
DLWoodruff merged 3 commits into
Pyomo:mainfrom
DLWoodruff:fix-xhatspecific-spoke-586
May 18, 2026
Merged

xhatspecific_spoke: wire scenario_dict and all_nodenames (#586)#707
DLWoodruff merged 3 commits into
Pyomo:mainfrom
DLWoodruff:fix-xhatspecific-spoke-586

Conversation

@DLWoodruff
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Unused arguments in xhatspecific_spoke #586. xhatspecific_spoke in mpisppy/utils/cfg_vanilla.py declared scenario_dict and all_nodenames parameters but discarded both before building the spoke dict, so callers got runtime errors (the XhatSpecificInnerBound bounder reads opt.options['xhat_specific_options']['xhat_scenario_dict'] at startup, and nothing was setting it).
  • Forwards all_nodenames to _Xhat_Eval_spoke_foundation (matching xhatshuffle_spoke).
  • Populates opt_kwargs.options.xhat_specific_options with xhat_scenario_dict (from the argument) and xhat_solver_options (reusing iterk_solver_options, matching xhatlooper_spoke's pattern).
  • Also fixes the only known caller, examples/aircond/aircond_cylinders.py: when --solver-options was passed alongside --xhatspecific, the override loop reached into xhat_looper_options (which xhatspecific does not have) instead of xhat_specific_options. Post-factory-fix that line would still KeyError; renamed to the correct key.

Test plan

  • ruff check . clean on changed files
  • python -c "from mpisppy.utils import cfg_vanilla" imports cleanly
  • CI on this PR (no existing direct test for xhatspecific_spoke; aircond example exercises it indirectly)

🤖 Generated with Claude Code

xhatspecific_spoke in cfg_vanilla took `scenario_dict` and `all_nodenames`
parameters but dropped both before constructing the spoke dict, so callers
got "missing data" errors at runtime:

* `all_nodenames` was not forwarded to _Xhat_Eval_spoke_foundation (sibling
  spokes like xhatshuffle_spoke already forward it).
* `scenario_dict` should populate
  opt_kwargs.options.xhat_specific_options.xhat_scenario_dict, which the
  XhatSpecificInnerBound bounder reads at startup. Nothing was setting
  that key, so the bounder hit a KeyError before it could try a candidate.

Fix:
- Forward all_nodenames through to _Xhat_Eval_spoke_foundation.
- Populate xhat_specific_options with xhat_scenario_dict (from the
  argument) and xhat_solver_options (mirroring xhatlooper_spoke's pattern
  of reusing iterk_solver_options).

Also fix the only known caller, examples/aircond/aircond_cylinders.py:
when `--solver-options` is passed alongside `--xhatspecific`, the override
loop reached into `xhat_looper_options` (which xhatspecific does not have)
instead of `xhat_specific_options`. Post-factory-fix this would still
KeyError; rename to the correct key.

Fixes Pyomo#586

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.42%. Comparing base (1cc109e) to head (a3c8425).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
mpisppy/utils/cfg_vanilla.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #707      +/-   ##
==========================================
- Coverage   71.42%   71.42%   -0.01%     
==========================================
  Files         154      154              
  Lines       19462    19463       +1     
==========================================
  Hits        13901    13901              
- Misses       5561     5562       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DLWoodruff DLWoodruff enabled auto-merge (squash) May 18, 2026 00:53
@DLWoodruff DLWoodruff merged commit 265345b into Pyomo:main May 18, 2026
29 checks passed
@DLWoodruff DLWoodruff deleted the fix-xhatspecific-spoke-586 branch May 18, 2026 01:05
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.

Unused arguments in xhatspecific_spoke

1 participant