Fix test registries to use explicit parameters + add parameter=nothing for mock strategies#173
Merged
Merged
Conversation
…g for mock strategies
- Register parameterized strategies with explicit parameter lists
(e.g. (Ipopt, [CPU]) instead of bare Ipopt UnionAll) in all test
registries, matching the pattern used by OptimalControl.jl
- Add Strategies.parameter(::Type{<:T}) = nothing for 7 non-parameterized
mock strategies (RouteCollocation, RouteADNLP, RouteIpopt, RouteMadNLP,
FakeSolver, FakeModeler, FakeDiscretizer)
- Add :cpu token to method tuples used with parameterized registries
- Add REAL_METHOD constant for real strategy tests
All 511 integration tests pass.
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
CTBase PR #497 introduced the
parametercontract forAbstractStrategy. Parameterized strategies (e.g.Ipopt{P}) must be registered with explicit parameter lists(Ipopt, [CPU])so the registry stores concreteIpopt{CPU}— not the UnionAllIpopt. The CTSolvers tests were registering parameterized strategies as bare UnionAlls, which triggeredNotImplementedfrom theparametercontract. Additionally, non-parameterized mock strategies in tests lacked the requiredparameter = nothingmethod.Changes
test_comprehensive_validation.jl: Fixed registries to use explicit parameter lists(ADNLP, [CPU]),(Exa, [CPU, GPU]),(Ipopt, [CPU]), etc. Added:cputoken to method tuples used with parameterized registries.test_route_to_comprehensive.jl: Addedparameter = nothingfor 4 mock strategies (RouteCollocation,RouteADNLP,RouteIpopt,RouteMadNLP). Fixed real strategy registries to use explicit parameters. AddedREAL_METHODconstant with:cputoken for real strategy tests.test_strict_permissive_integration.jl: Addedparameter = nothingfor 3 mock strategies (FakeSolver,FakeModeler,FakeDiscretizer).Rationale
The old
get_parameter_typesilently returnednothingfor UnionAll types via try/catch, masking incorrect registry entries. The newparametercontract correctly exposes this: parameterized strategies must be registered with explicit parameter lists, asOptimalControl.jlalready does. No CTBase or CTSolvers source changes needed — the fix is entirely in test setup.Test Results
All 511 integration tests pass (0 failed, 0 errored).