feat: expose bounded parameter expansion - #112
Conversation
Add a thread-safe importable expansion API with exact cardinalities and bounded Cartesian prefixes for planning consumers. AI-Tool: Codex AI-Model: GPT-5 AI-Effort: not specified
There was a problem hiding this comment.
The new expand_parameters() API promises structured ExpansionError failures, but a schema-valid document with a set using include and no top-level global-options raises an uncaught KeyError from load_param_sets(). The schema permits this shape because global-options is optional.
Reproducer: multiplex.expand_parameters({"sets": [{"include": "missing"}]}) raises KeyError: "global-options".
Please either treat a missing global-options block as empty or translate it into ExpansionError("invalid_input", ...).
This also makes Rickshaw planner lose the specific failure code and report generic expansion_failed.
Return a structured invalid_input error from the importable expansion API when a set references an undefined global-options group, including when the optional block is omitted. AI-Tool: Codex AI-Model: GPT-5 AI-Effort: not specified
|
Thanks for the review. Addressed in commit The importable Added a regression test covering the reviewer reproducer: multiplex.expand_parameters({"sets": [{"include": "missing"}]})Validation: — AI-signed: Codex | model: GPT-5 | effort: not specified |
There was a problem hiding this comment.
The missing global-options case is fixed, but a schema-valid requirements document can still escape the structured API error handling. Calling expand_parameters with a normal x parameter and requirements whose validation vals pattern is an opening parenthesis raises Python re.error (PatternError) instead of ExpansionError. req-schema.json accepts any non-empty string for vals, so invalid regex syntax reaches re.match after schema validation. The adapter currently converts only SystemExit; please translate this path, and ideally other non-SystemExit expansion failures, into ExpansionError (likely invalid_requirements) and add a regression test.
Translate invalid requirements regexes and other unexpected library expansion exceptions into ExpansionError results, with regression coverage for malformed validation patterns. AI-Tool: Codex AI-Model: GPT-5 AI-Effort: not specified
|
Addressed the follow-up review in commit The importable Added regression coverage for a schema-valid requirements document containing an invalid validation regex. Validation: — AI-signed: Codex | model: GPT-5 | effort: not specified |
atheurer
left a comment
There was a problem hiding this comment.
The new expand_parameters() API still silently succeeds for malformed transform regexes. transform_param_val() catches re.error from both transform.search and transform.replace, logs it, and returns the original value, so a schema-valid requirements document can return success instead of the promised structured ExpansionError("invalid_requirements", ...).
Reproducer:
multiplex.expand_parameters(
{"sets": [{"params": [{"arg": "x", "vals": ["value"]}]}]},
{"validations": {"x": {
"args": ["x"], "vals": ".*",
"transform": {"search": "(", "replace": "x"},
}}},
)This returns a successful expansion with val: "value". Please validate/propagate transform regex failures through the library API and add regression coverage.
Validate transform search and replacement expressions before library expansion so malformed requirements return structured invalid_requirements errors instead of silently preserving the original value. AI-Tool: Codex AI-Model: GPT-5 AI-Effort: not specified
|
Addressed the remaining review finding in commit The library API now validates transform regexes before invoking the legacy expansion pipeline:
The reviewer’s reproducer now returns a structured Added regression coverage. Validation: — AI-signed: Codex | model: GPT-5 | effort: not specified |
atheurer
left a comment
There was a problem hiding this comment.
Re-reviewed the updated head. The transform-regex error handling is fixed, regression coverage is present, and local validation passes (111 passed, 5 xfailed). GitHub CI is green.
Summary
What this changes for users
This PR adds a programmatic library/API mode; it does not add a new CLI flag, alternate command-line mode, or graphical UI.
The existing Multiplex CLI behavior remains unchanged. New callers such as Rickshaw’s run planner and Crucible’s MCP planning tools can call
expand_parameters(...)directly to:max_resultscountandtruncatedmetadataExpansionErrorfailuresValidation
python -m pytest -q tests— 4 tests passedThis companion change provides the bounded Multiplex APIs consumed by Rickshaw planning and Crucible MCP planning tools.
— AI-signed: Codex | model: GPT-5 | effort: not specified