Skip to content

Fix test registries to use explicit parameters + add parameter=nothing for mock strategies#173

Merged
ocots merged 1 commit into
mainfrom
fix/test-registries-explicit-parameters
Jul 13, 2026
Merged

Fix test registries to use explicit parameters + add parameter=nothing for mock strategies#173
ocots merged 1 commit into
mainfrom
fix/test-registries-explicit-parameters

Conversation

@ocots

@ocots ocots commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

CTBase PR #497 introduced the parameter contract for AbstractStrategy. Parameterized strategies (e.g. Ipopt{P}) must be registered with explicit parameter lists (Ipopt, [CPU]) so the registry stores concrete Ipopt{CPU} — not the UnionAll Ipopt. The CTSolvers tests were registering parameterized strategies as bare UnionAlls, which triggered NotImplemented from the parameter contract. Additionally, non-parameterized mock strategies in tests lacked the required parameter = nothing method.

Changes

  • test_comprehensive_validation.jl: Fixed registries to use explicit parameter lists (ADNLP, [CPU]), (Exa, [CPU, GPU]), (Ipopt, [CPU]), etc. Added :cpu token to method tuples used with parameterized registries.
  • test_route_to_comprehensive.jl: Added parameter = nothing for 4 mock strategies (RouteCollocation, RouteADNLP, RouteIpopt, RouteMadNLP). Fixed real strategy registries to use explicit parameters. Added REAL_METHOD constant with :cpu token for real strategy tests.
  • test_strict_permissive_integration.jl: Added parameter = nothing for 3 mock strategies (FakeSolver, FakeModeler, FakeDiscretizer).

Rationale

The old get_parameter_type silently returned nothing for UnionAll types via try/catch, masking incorrect registry entries. The new parameter contract correctly exposes this: parameterized strategies must be registered with explicit parameter lists, as OptimalControl.jl already 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).

…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.
@ocots
ocots merged commit 961cf8c into main Jul 13, 2026
7 checks passed
@ocots
ocots deleted the fix/test-registries-explicit-parameters branch July 13, 2026 22:59
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.

1 participant