Repository navigation
fix(solve): init and initial_guess together raise "Conflicting aliases" in descriptive mode - #979
Merged
Merged
Conversation
…criptive mode (#964) route_all_options consumed the first alias and routed the leftover one to the strategies, where it was rejected as an unknown option. The alias check of _extract_action_kwarg is now a helper, _check_action_aliases, called by both modes before any routing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rror in both modes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #964.
Problem
solve(ocp; init=1, initial_guess=2)in descriptive mode reportedUnknown option :initwith unrelated suggestions (:mu_init,:max_iter, …). Explicit mode already reported "Conflicting aliases". CTBase'sroute_all_options→Options.extract_optionconsumes the first alias found and leaves the other one inkwargs. The leftover alias is then routed to the strategies.Change
_extract_action_kwargis now its own helper,_check_action_aliases(kwargs, names)(src/helpers/kwarg_extraction.jl). Explicit mode calls it through_extract_action_kwarg, as before._route_descriptive_optionscalls it on_INITIAL_GUESS_ALIASESbeforeroute_all_options.initorinitial_guess": states the error raised in both modes instead of describing the bug.[Unreleased].Output after the fix, for the reproducer of the issue, both modes:
Choices made
route_all_options. Extractingdisplayup front would bypass its documented priority rule withroute_to(_descriptive_action_defs: a strategy can also declaredisplay). The minimal check fixes the bug and changes nothing else.initial_guess/initis checked. It is the only action option with an alias;displayhas none. Adding an alias later means adding it to the call in_route_descriptive_options. I did not build a generic loop over_descriptive_action_defs()for a single case.CTBase.Options.extract_optionsilently accepts two aliases of one option. That affects every strategy option with aliases (e.g.backend/adnlp_backend), not only the action options. A CTBase fix would need a release and a compat bump, so this PR fixes the user-visible bug now. A follow-up issue on CTBase is worth opening (not done here). Once fixed upstream,_check_action_aliasesin descriptive mode becomes redundant but harmless.context. The error text is unchanged (context="solve - action option extraction"), so both modes print the same message.Tests
test/suite/helpers/test_kwarg_extraction.jl: unit tests of_check_action_aliases(none / one / both present).test/suite/solve/test_descriptive_routing.jl: regression tests on_route_descriptive_optionsandsolve_descriptivewithinit+initial_guess. They check that the message says "Conflicting aliases" and not "Unknown option": both areIncorrectArgument, so the type alone would not catch the bug.Ran locally:
test_kwarg_extraction,test_descriptive_routingandtest_explicitgive 171/171 passing. The issue's reproducer (without Ipopt, the error is raised before the solve) gives the output above in both modes. The full suite was not run locally.🤖 Generated with Claude Code