feat(cli): add driver configuration schema discovery - #1071
Conversation
Reports the config keys each installed driver accepts, as JSON Schema derived from the driver class itself, so tooling can complete and validate the `config:` block of an exporter config against the drivers actually installed in the environment. Fields common to every Driver (uuid, children, log_level, ...) are not part of a driver's own config and are excluded. A driver that fails to import is reported with its error rather than sinking the listing, and one whose field types pydantic cannot model still reports its key names and required-ness, recovered from the dataclass — 61 of the 67 drivers installed here yield usable keys. Signed-off-by: Kirk Brauer <kirkebrauer@gmail.com>
Keep Python-level discovery chatter on stderr, resolve recursive root definitions, exclude non-constructor fields, and reject every unknown requested name before loading. Replace installed-driver-dependent tests with hermetic CLI coverage, fix type-checking, and document the best-effort schema contract and import trust boundary. Assisted-by: Pi:gpt-6-astra Signed-off-by: Kirk Brauer <kirkebrauer@gmail.com>
|
Warning Review limit reachedNext included review available in 43 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| entry.description = _first_docstring_line(cls) | ||
| entry.client = _client_class_path(cls) | ||
| try: | ||
| schema = TypeAdapter(cls).json_schema() |
There was a problem hiding this comment.
so it seems that it would fail generating for qemu, becasue it has a TemporaryDirectory field
There was a problem hiding this comment.
Oh yeah, that might be an issue...I will take a look, when testing, it did seem to work OK for most drivers, but I wasn't able to try them all, maybe I can make an audit script
Summary
Add
jmp driver schema [NAMES...] [-o json|yaml|name]for environment-aware exporter configuration editing. It reports locally installed driver config keys, types, required fields, referenced definitions, client class paths, and package metadata without instantiating drivers or opening a lease itself.Contract and review fixes
{drivers: [...]}; tables and name output are also supported.errorset.$ref.init=False) fields from config keys.The VS Code extension keeps this API behind a dedicated default-off
experimentalDriverSchemasflag in addition to its general experimental CLI opt-in. Static YAML schemas and manual allow-list entry remain available without it.Validation
make pkg-test-jumpstarter-cli-driver: 22 passedmake pkg-test-jumpstarter-cli: 257 passedmake lint-fix: passedmake pkg-ty-jumpstarter-cli-driver: passedAI generated, human reviewed