-
Notifications
You must be signed in to change notification settings - Fork 225
PyDABs: acceptance-test authoring skill + per-resource coverage guard #6527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Sankalp-Mittal
merged 12 commits into
main
from
sankalp-mittal/pydabs-acceptance-tests-skill
Sep 8, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
161095c
Test the dataclass path in test_add_resource_type
Sankalp-Mittal a09b78e
Generate per-resource unit-test cases from the codegen model
Sankalp-Mittal 19ca487
Fix ruff lint in the test-case generator
Sankalp-Mittal ffaf400
added explainatory comments
Sankalp-Mittal 4aa571c
Filter generated test-case fields by launch-stage maturity
Sankalp-Mittal 6f3cac8
add unit tests for the codegen to assert behaviour
Sankalp-Mittal 4dcee95
Add pydabs-acceptance-test skill for authoring resource acceptance tests
Sankalp-Mittal 9f42909
Assert every PyDABs resource has an acceptance test
Sankalp-Mittal a1ba7b3
Replace acceptance-test skill with an auto-loaded rule + README
Sankalp-Mittal 9efbf12
update skill
Sankalp-Mittal 3f15d68
Check that .cursor/rules mirror .agents/rules
Sankalp-Mittal bcca02d
Drop cursor-rules symlink lint (moving to a separate PR)
Sankalp-Mittal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| description: Rules for authoring PyDABs resource acceptance tests | ||
| globs: acceptance/bundle/python/** | ||
| paths: | ||
| - "acceptance/bundle/python/**" | ||
| --- | ||
|
|
||
| **RULE: Before adding a PyDABs resource acceptance test, read `acceptance/bundle/python/README.md`.** It covers the `<plural>-support/` fixture layout, how to source and adapt realistic field values, the version/engine `test.toml` knobs, and the determinism re-run. Every PyDABs resource needs one (enforced by `test_python_support_coverage`). | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../.agents/rules/pydabs-acceptance-tests.md |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # PyDABs resource acceptance tests | ||
|
|
||
| Each `<plural>-support/` directory is the acceptance test for one PyDABs resource. It | ||
| checks that the resource loads both from YAML and from Python and that a mutator runs | ||
| over it. `test_python_support_coverage` | ||
| (`python/databricks_tests/core/test_python_support.py`) requires every PyDABs resource | ||
| to have one, so a newly-onboarded resource needs a fixture here. | ||
|
|
||
| Copy an existing one — `alerts-support/` (a resource with required nested fields) or | ||
| `catalogs-support/` (direct-engine only) are the canonical examples. A fixture is six | ||
| files: | ||
|
|
||
| - `databricks.yml` — `bundle.name: my_project`, `sync: {paths: []}`, a top-level | ||
| `python:` block wiring `resources:load_resources` + `mutators:update_<singular>`, and | ||
| one YAML-declared instance `<plural>.my_<name>_1`. | ||
| - `resources.py` — `load_resources()` adds a second instance `my_<name>_2` via | ||
| `resources.add_<singular>(...)`. | ||
| - `mutators.py` — a `@<singular>_mutator` that appends `" (updated)"` to a required | ||
| string field; it runs over both instances. | ||
| - `script` — copy it verbatim (`bundle validate --output json | jq "pick(...)"`). | ||
| - `test.toml` — `Cloud = false`. | ||
| - `output.txt` — generated, never hand-written. | ||
|
|
||
| ## Authoring a new one | ||
|
|
||
| 1. Confirm the resource is wired: `python/databricks/bundles/<plural>/` exists, and | ||
| `add_<singular>` / `<singular>_mutator` are in `databricks.bundles.core`. If not, it | ||
| must be onboarded in PyDABs first. | ||
| 2. Required fields are the `VariableOr[...]` (no default) fields in | ||
| `python/databricks/bundles/<plural>/_models/<singular>.py`; set all of them, | ||
| recursing into required nested objects. `VariableOrOptional[...] = None` fields are | ||
| optional — omit them. | ||
| 3. Get realistic values from `acceptance/bundle/invariant/configs/<singular>.yml.tmpl`, | ||
| but **adapt**: replace `$UNIQUE_NAME` / `$TEST_DEFAULT_WAREHOUSE_ID` and other `$VAR`s | ||
| with plain literals, and drop cloud-only blocks (`permissions`, `grants`, | ||
| `file_path`) — this test is local and deterministic. | ||
| 4. `test.toml`: add `EnvMatrix.PYDAB_VERSION = ["current"]` for a brand-new resource | ||
| (it only exists in the current wheel), and `EnvMatrix.DATABRICKS_BUNDLE_ENGINE = | ||
| ["direct"]` for a direct-only resource. | ||
| 5. Generate the golden: | ||
| `go test ./acceptance -run 'TestAccept/bundle/python/<plural>-support' -update`. | ||
| 6. **Re-run without `-update`** — it must pass against the golden you just generated. A | ||
| test that only passes with `-update` is nondeterministic (usually a `$VAR` or a | ||
| volatile field left in); fix it before finishing. | ||
|
|
||
| Note: `bundle validate` normalizes the `python:` key to `experimental.python` in the | ||
| output — that's expected. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.agents/rules/*.mdalso need to be symlinked to.cursor/rules/<rule>.mdc. would be great if you could write a lint rule that auto-adds these symlinks 🙏There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added, the rule. Please TAL once