Skip to content

fix(cli-driver): build driver schemas from config fields only - #1325

Closed
mangelajo wants to merge 3 commits into
cli-driver-schema-reviewfrom
fix/driver-schema-runtime-fields
Closed

mangelajo wants to merge 3 commits into
cli-driver-schema-reviewfrom
fix/driver-schema-runtime-fields

Conversation

@mangelajo

Copy link
Copy Markdown
Member

Stacked on #1071.

Fixes the schema-generation failure this PR attributes to Qemu being "expected to fail". It is not driver-specific: the schema was generated for the whole dataclass and filtered afterwards, so any runtime-only field pydantic cannot model (Qemu's _tmp_dir, Renode's, DutNetwork's Popen, HttpServer's aiohttp app, gpiod's Chip/LineRequest, ...) sank the whole entry.

On this branch, against the full installed driver set:

#1071 this branch
clean schemas 45/68 59/68
entries with error 23 9
unreferenced defs.Driver 45 drivers 0
Qemu name-only fallback full typed schema + $defs.Hostfwd

The remaining 9 are genuine: ISCSI (libudev missing on macOS), UStreamer/IsoTp/QemuFlasher/QemuPower/Renode* (an actual constructor field pydantic cannot model), ssh_mitm (entry point loads a module, now reported explicitly).

What changed:

  • build the schema from init=True, non-Driver fields via a filtered pydantic model
  • on failure, degrade only the unmodelable field and keep types/$defs for the rest
  • table output shows recovered keys instead of the pydantic traceback
  • non-class entry points are reported instead of emitting an empty schema
  • $ref root handling stays inside the per-entry error boundary

Tests:

  • hermetic fixtures now include a non-pydantic init=False runtime field (would have caught Qemu) and an unmodelable init=True field
  • new jumpstarter-all integration test runs the CLI over every installed driver and checks keys vs constructor fields, no runtime-field-induced errors, no base Driver defs, Qemu types, and gpiod fields

Validation:

  • pkg-test-jumpstarter-cli-driver: 24 passed
  • pkg-test-jumpstarter-all: 9 passed
  • ruff and ty clean

Assisted-by: OpenCode
Co-Authored-By: DeepSeek V4.1 Flash noreply@deepseek.com

Generate the JSON Schema from the driver's constructor config fields
instead of generating it for the whole dataclass and filtering afterwards.
Runtime-only fields (`init=False`, or non-pydantic handles such as Qemu's
`TemporaryDirectory`) are not user config, but pydantic still tried to model
them, so Qemu, Renode, DutNetwork, HttpServer, the gpiod drivers and others
fell back to a name-only schema with `error` set.

Failures are now contained per field: a constructor field pydantic cannot
model is degraded on its own, while the remaining fields keep their types
and `$defs`. This also drops the unreferenced base `Driver` definition that
used to be emitted for 45 of 68 drivers.

While here:
- show the recovered config keys in table output when an entry has an error,
  instead of printing the full pydantic traceback in the CONFIG KEYS column
- report entry points that do not resolve to a dataclass driver (currently
  ssh_mitm loads a module) instead of emitting an empty schema
- keep the `$ref` root dereference inside the per-entry error boundary

Tests:
- extend the hermetic fixtures with a non-pydantic `init=False` runtime
  field and an unmodelable `init=True` field
- add a jumpstarter-all integration test that runs `jmp driver schema`
  against every installed driver and asserts: all drivers are reported,
  keys match constructor fields, runtime fields never turn an otherwise
  modelable driver into an error, no unreferenced `Driver` definition,
  Qemu keeps its types/$defs, and gpiod drivers exclude runtime fields

Assisted-by: OpenCode
Co-Authored-By: DeepSeek V4.1 Flash <noreply@deepseek.com>
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 90c083e3-5f15-437b-9701-e0911a0f9d86

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

mangelajo and others added 2 commits November 10, 2026 17:50
setup-uv v9 removed the `python-version-file` input, but the workflows still
passed it. The action silently ignores unknown inputs, so uv resolved the
newest interpreter (3.14) instead of the version in `.py-version`:

  ##[warning]Unexpected input(s) 'python-version-file', valid inputs are
  ['version', 'version-file', 'python-version', ...]

On this branch the lockfile still pins `pydantic-core==2.33.2`, which has no
cp314 wheel, so the docs and type-check jobs failed while building it from
source:

  error: the configured Python interpreter version (3.14) is newer than
  PyO3's maximum supported version (3.13)

Main currently hides this because its newer lock has 3.14 wheels. Read
`.py-version` in the existing `id: uv` step and pass it through the supported
`python-version` input instead.

Also disable the uv cache in `build-python-wheels`: the build is skipped on a
wheels cache hit, so uv never runs and v9 fails post-job because the cache
directory it tries to save does not exist.

Assisted-by: OpenCode
Co-Authored-By: DeepSeek V4.1 Flash <noreply@deepseek.com>
ty flags `pytest.skip()` as not callable; follow the existing convention in
the repo and annotate it.

Assisted-by: OpenCode
Co-Authored-By: DeepSeek V4.1 Flash <noreply@deepseek.com>
@mangelajo
mangelajo force-pushed the fix/driver-schema-runtime-fields branch from fc7851e to 5692def Compare November 10, 2026 16:50
@mangelajo

Copy link
Copy Markdown
Member Author

@kirkbrauer this is a stack on top of your #1071 to see if we could merge it.

@mangelajo

Copy link
Copy Markdown
Member Author

I'll close this for now, but we can keep it around for reference.

@mangelajo mangelajo closed this Nov 16, 2026
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