Skip to content

fix(schema): include 'default' and 'kubevirt' in driver validation error message - #4708

Open
ByteEngr wants to merge 5 commits into
ansible:mainfrom
ByteEngr:main
Open

ByteEngr wants to merge 5 commits into
ansible:mainfrom
ByteEngr:main

Conversation

@ByteEngr

@ByteEngr ByteEngr commented Sep 22, 2026 •

Copy link
Copy Markdown

Summary

This PR addresses a minor discrepancy between the driver enum definitions and the corresponding schema error message in src/molecule/data/molecule.json.

Specifically, the schema enum allowed "default" and "kubevirt" as valid driver names, but the custom error message defined under messages.anyOf omitted both drivers from the error text displayed to users when driver schema validation fails.


Issue / Problem Description

When an invalid or unrecognized driver name is specified in a scenario configuration (e.g. driver: { name: "invalid_driver" }), Molecule validates the configuration against molecule.json.

In the existing schema:

  • Allowed enum array: ["azure", "ec2", "delegated", "default", "docker", "containers", "openstack", "podman", "vagrant", "digitalocean", "gce", "libvirt", "lxd", "kubevirt", "lima"]
  • Validation error message (messages.anyOf): "is not one of ['azure', 'ec2', 'delegated', 'docker', 'containers', 'openstack', 'podman', 'vagrant', 'digitalocean', 'gce', 'libvirt', 'lxd', 'lima', 'molecule-*', 'molecule_*', 'custom-*', 'custom_*']"

Because 'default' and 'kubevirt' were missing from messages.anyOf, the error hint provided incomplete guidance to the user.


Proposed Changes

  1. src/molecule/data/molecule.json:

    • Added 'default' and 'kubevirt' to the messages.anyOf error string to match the full set of accepted driver enum values.
  2. tests/unit/model/v2/test_driver_section.py:

    • Updated base_error_msg in test_driver_has_errors to match the updated error message string.

Detailed Schema Comparison

  "messages": {
-   "anyOf": "is not one of ['azure', 'ec2', 'delegated', 'docker', 'containers', 'openstack', 'podman', 'vagrant', 'digitalocean', 'gce', 'libvirt', 'lxd', 'lima', 'molecule-*', 'molecule_*', 'custom-*', 'custom_*']"
+   "anyOf": "is not one of ['azure', 'ec2', 'delegated', 'default', 'docker', 'containers', 'openstack', 'podman', 'vagrant', 'digitalocean', 'gce', 'libvirt', 'lxd', 'kubevirt', 'lima', 'molecule-*', 'molecule_*', 'custom-*', 'custom_*']"
  }

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Bug Fixes**
  * Updated driver validation messages to include all supported backends, including `default` and `kubevirt`.
  * Improved command output sanitization by redacting paths that include molecule scenario directories.

* **Tests**
  * Updated validation and output-sanitization checks to reflect the corrected behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Maliksaad69 and others added 5 commits September 21, 2026 23:23
fix(schema): include 'default' and 'kubevirt' in driver validation er…
…ror message

Signed-off-by: Saad Ahmed <saadahmedawan224@gmail.com>
fix(schema): include 'default' and 'kubevirt' in driver validation er…
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 26505983-31da-4fff-800e-1441b8c88fc0

📥 Commits

Reviewing files that changed from the base of the PR and between e4abab3 and 0de0d0d.

📒 Files selected for processing (3)
  • src/molecule/data/molecule.json
  • tests/integration/test_command.py
  • tests/unit/model/v2/test_driver_section.py

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


📝 Walkthrough

Walkthrough

The pull request updates the driver validation message and its test, and adds specific redaction for paths containing /molecule/ in sanitized integration output.

Changes

Driver validation

Layer / File(s) Summary
Driver error message contract
src/molecule/data/molecule.json, tests/unit/model/v2/test_driver_section.py
The validation message and test now include the default and kubevirt driver names.

Output sanitization

Layer / File(s) Summary
Molecule path redaction
tests/integration/test_command.py
_sanitize_molecule_output redacts paths containing /molecule/ before applying general absolute-path redaction.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: ssbarnea

Merge Risk: ⚪ Minimal · up to 0de0d

No actionable merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary schema change: adding 'default' and 'kubevirt' to the driver validation error message.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.


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

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants