Skip to content

fix(optimizer): reject empty search spaces - #2174

Merged
rapids-bot[bot] merged 2 commits into
NVIDIA:developfrom
primorLee:fix/validate-empty-search-space
Aug 23, 2026
Merged

rapids-bot[bot] merged 2 commits into
NVIDIA:developfrom
primorLee:fix/validate-empty-search-space

Conversation

@primorLee

@primorLee primorLee commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Reject a non-prompt SearchSpace that defines neither categorical values nor numeric bounds during Pydantic configuration validation. This prevents an empty configuration from reaching Optuna as two None bounds and failing mid-run with an unrelated TypeError.

The existing grid-search runtime test is moved to the shared construction-time validation contract, and the complete SearchSpace test module remains green.

Closes #2172

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • The commit is signed off under the Developer Certificate of Origin.
  • Existing and new tests cover these changes.
  • No documentation update is required because this only enforces the already documented search-space contract.

Validation

  • python -m pytest packages/nvidia_nat_core/tests/nat/data_models/test_optimizable.py -q (45 passed)
  • python -m ruff check on both changed files
  • YAPF 0.43.0 diff check on both changed files

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation for search space configurations.
    • Configurations must now provide either explicit values or both lower and upper bounds.
    • Invalid configurations are rejected during creation with clearer behavior.

@primorLee
primorLee requested a review from a team as a code owner August 23, 2026 18:17
@copy-pr-bot

copy-pr-bot Bot commented Aug 23, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a5a78109-23e6-494f-99a4-78b0166ca25e

📥 Commits

Reviewing files that changed from the base of the PR and between 4128a62 and 484ae94.

📒 Files selected for processing (1)
  • packages/nvidia_nat_config_optimizer/src/nat/plugins/config_optimizer/optimizable_utils.py

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

SearchSpace validation now rejects empty configurations during construction. Internal dictionary wildcard markers use model_construct() to bypass validation.

Changes

SearchSpace validation

Layer / File(s) Summary
Construction-time SearchSpace validation
packages/nvidia_nat_core/src/nat/data_models/optimizable.py, packages/nvidia_nat_core/tests/nat/data_models/test_optimizable.py
The validator rejects configurations without values or both low and high. Tests verify the construction-time ValueError and remove the deferred grid-conversion case.
Internal wildcard marker
packages/nvidia_nat_config_optimizer/src/nat/plugins/config_optimizer/optimizable_utils.py
The static dictionary wildcard marker uses SearchSpace.model_construct() instead of validated construction with missing bounds.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 484ae

This localized validation change prevents empty non-prompt search spaces from reaching runtime failure paths, and no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise, descriptive, and uses imperative wording that matches the change.
Linked Issues check ✅ Passed The changes reject empty SearchSpace configurations during construction and add coverage for issue #2172.
Out of Scope Changes check ✅ Passed All changes support validation of empty search spaces or preserve required wildcard sentinel behavior.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@willkill07 willkill07 added bug Something isn't working non-breaking Non-breaking change labels Aug 23, 2026
@willkill07

Copy link
Copy Markdown
Member

/ok to test 4128a62

@willkill07

Copy link
Copy Markdown
Member

/ok to test 484ae94

@willkill07

Copy link
Copy Markdown
Member

/merge

@rapids-bot
rapids-bot Bot merged commit 2d2e342 into NVIDIA:develop Aug 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty SearchSpace() passes validation and fails inside Optuna instead

2 participants