Repository navigation
fix(cli): report unknown dataset names without a traceback - #120
Closed
HarshRajSinghania wants to merge 4 commits into
Closed
HarshRajSinghania wants to merge 4 commits into
HarshRajSinghania wants to merge 4 commits into
Conversation
added 4 commits
October 21, 2026 21:24
Catch KeyError from ExampleRegistry.get/load in datasets show and infer-policy-expectations, print the registry message to stderr, and exit with status 2. Preserve other KeyErrors from loaders. Adds offline tests covering unknown names (with and without suggestions), successful paths, and non-unknown loader KeyErrors.
Catch KeyError from ExampleRegistry.get/load in datasets show and infer-policy-expectations, print the registry message to stderr, and exit with status 2. Preserve other KeyErrors from loaders. Adds offline tests covering unknown names (with and without suggestions), successful paths, and non-unknown loader KeyErrors.
Collaborator
|
@HarshRajSinghania, the pushed head #119 was opened earlier for the same issue and contains a focused implementation, so I am using it as the primary review path for #118. Please hold further work on this duplicate while that review completes. If #119 passes review, I will close this PR as superseded. In the meantime, please focus on the outstanding implementation in #103 and the readiness check in #112. |
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Unknown dataset names in
rai datasets showandrai datasets infer-policy-expectationsnow produce a clean error on stderr and exit with status 2 instead of an uncaught KeyError traceback. The registry's existing suggestion logic is preserved.Motivation
Fixes #118. An unknown dataset name currently produces a Python traceback. The registry already provides a useful error message and suggestions; the CLI should present that message as an input error.
Implementation
KeyErrorfromExampleRegistry.get/ExampleRegistry.loadonly when the message indicates an unregistered dataset.Testing
python -m pytest -q tests/test_cli.py— 12 passed (Python 3.11.2, uv venv).Offline tests cover:
bbqqsuggestion and an unknown name with no suggestion.rai datasets show bbq.rai datasets infer-policy-expectations bbq --limit 0(status 0, empty JSON array).No new dependencies. No README changes.