Skip to content

FIX Coerce enum parameters for direct target creation#2196

Open
romanlutz wants to merge 2 commits into
microsoft:mainfrom
romanlutz:romanlutz-target-enum-coercion-clean
Open

FIX Coerce enum parameters for direct target creation#2196
romanlutz wants to merge 2 commits into
microsoft:mainfrom
romanlutz:romanlutz-target-enum-coercion-clean

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

Target creation through the backend can bypass registry coercion for classes that accept base configuration through **kwargs. As a result, enum-valued API parameters can remain raw strings instead of the values expected by target constructors.

This change extends the shared Parameter contract to coerce enum and optional scalar values, then applies that contract before direct target construction. Undeclared **kwargs and registry reference resolution remain unchanged, and no target-specific implementations are modified.

Tests and Documentation

  • Added unit coverage for enum and optional-enum coercion in parameter metadata, registry resolution, target registration, and backend target creation.
  • Focused unit tests: 192 passed.
  • Changed-file pre-commit hooks passed, including Ruff and ty type checking.
  • Documentation: N/A; this fixes internal coercion behavior without changing the public API shape.
  • JupyText: N/A.

Copilot AI added 2 commits July 11, 2026 20:47
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52e240e9-42d4-4c91-8608-6e14d5749576
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.

2 participants