Skip to content

fix(sleep): reject unknown backend names instead of silently mocking - #350

Open
Hrushikesh Ramilla (Hrushikesh-ramilla) wants to merge 1 commit into
microsoft:mainfrom
Hrushikesh-ramilla:fix/sleep-backend-unknown-validation
Open

Hrushikesh Ramilla (Hrushikesh-ramilla) wants to merge 1 commit into
microsoft:mainfrom
Hrushikesh-ramilla:fix/sleep-backend-unknown-validation

Conversation

@Hrushikesh-ramilla

@Hrushikesh-ramilla Hrushikesh Ramilla (Hrushikesh-ramilla) commented Nov 1, 2026 •

Copy link
Copy Markdown

Summary

Currently, get_backend() falls back to MockBackend() if a requested backend name does not match any recognized alias. As noted in #314, a misspelled name or invalid backend in configuration or CLI flags silently runs with mock responses (often yielding misleading 0.0 scores) instead of alerting the user.

This PR makes get_backend() explicitly check for mock (and empty/default input) before raising a ValueError for unknown names, listing the supported backends.

Changes

  • In skillopt_sleep/backend.py: explicit check for mock and raise ValueError on unrecognized backends.
  • In tests/test_sleep_engine.py: add unit tests in TestGetBackend verifying that mock / default names still resolve to MockBackend, and unknown names / typos raise ValueError both directly and through build_backend().

lucatreiber2007 added a commit to lucatreiber2007/SkillOpt that referenced this pull request Nov 1, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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