Skip to content

PyDABs: acceptance-test authoring skill + per-resource coverage guard - #6527

Open
Sankalp-Mittal wants to merge 6 commits into
sankalp-mittal/pydabs-gen-unit-testsfrom
sankalp-mittal/pydabs-acceptance-tests-skill
Open

PyDABs: acceptance-test authoring skill + per-resource coverage guard#6527
Sankalp-Mittal wants to merge 6 commits into
sankalp-mittal/pydabs-gen-unit-testsfrom
sankalp-mittal/pydabs-acceptance-tests-skill

Conversation

@Sankalp-Mittal

Copy link
Copy Markdown
Collaborator

What

Two complementary pieces that make every PyDABs resource get a hand-written acceptance test:

  1. pydabs-acceptance-test skill (.agents/skills/pydabs-acceptance-test/) — an AI Agent Skill that guides an agent to author the acceptance test for a newly-onboarded PyDABs resource: the acceptance/bundle/python/<plural>-support/ fixture (databricks.yml + resources.py + mutators.py + script + test.toml + generated output.txt). Ships fill-in .tmpl templates. The 7-step flow: verify the resource is wired → find required fields (VariableOr[...] in the generated _models) → adapt realistic values from the resource's invariant config (dropping $VAR interpolation and cloud-only blocks) → author the fixture → generate the golden with -updatere-run without -update to prove determinism → confirm coverage + lint.

  2. test_python_support_coverage guard (python/databricks_tests/core/test_python_support.py) — asserts every resource in the _ResourceType registry has a <plural>-support fixture, so coverage can't silently regress as resources are onboarded. Mirrors the existing invariant-config coverage guard (acceptance/invariant_test.go). Shrink-only _LACKING allowlist, currently {jobs} (jobs' acceptance coverage predates the <plural>-support convention and is spread across the bundle/python suite).

Why

PyDABs acceptance tests are hand-written, one per resource, because the OpenAPI spec has no examples — an agent finding realistic values and writing a deterministic test is the scalable path. The skill is the authoring aid; the guard is the enforcement that turns "every new resource needs an acceptance test" into a CI gate. Together they are a prerequisite for full PyDABs resource coverage: onboard a resource → guard goes red → run the skill → green.

Both the skill and the guard derive the resource set from generated/runtime state (the _ResourceType registry), not the RESOURCE_NAMESPACE allowlist, so they follow the generated set whether it is allowlist-driven today or schema-derived later.

Testing

  • test_python_support_coverage passes (6/6); verified it fails with a clear message when a fixture is absent.
  • ruff check / ruff format clean; template files use the .tmpl suffix so the placeholder sources stay out of the linters.

Stacked on #6421 (PyDABs deterministic unit-test generation).

This pull request and its description were written by Isaac.

Sankalp-Mittal and others added 2 commits September 4, 2026 11:54
An AI Agent Skill that guides an agent to author the acceptance test for a
newly-onboarded PyDABs resource: the acceptance/bundle/python/<plural>-support/
fixture (databricks.yml + resources.py + mutators.py + script + test.toml +
generated output.txt). Includes fill-in templates (.tmpl so they stay out of
linters). Complements the schema-synthesized unit-test generation; realistic
field values are adapted from the resource's invariant config.

Co-authored-by: Isaac <no-reply@databricks.com>
test_python_support_coverage fails until each resource in the _ResourceType
registry has an acceptance/bundle/python/<plural>-support/ fixture, so coverage
cannot silently regress as resources are onboarded. Mirrors the invariant-config
coverage guard; shrink-only _LACKING allowlist ({jobs}, whose coverage predates
the convention). Lives in the python test suite (runs in CI via pydabs-test) since
it checks the filesystem rather than exercising the CLI.

Co-authored-by: Isaac <no-reply@databricks.com>
@Sankalp-Mittal
Sankalp-Mittal marked this pull request as ready for review September 4, 2026 12:01
Comment thread .agents/skills/pydabs-acceptance-test/SKILL.md Outdated
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 43de1d9

Run: 33878875831

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux 1 275 15 5:59
💚​ aws windows 1 277 13 4:30
💚​ azure linux 1 274 15 7:57
💚​ azure windows 1 276 13 4:32
💚​ gcp linux 1 275 15 6:47
💚​ gcp windows 1 277 13 4:55
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:09 gcp windows TestAccept
4:07 azure windows TestAccept
3:59 aws windows TestAccept
3:56 aws linux TestAccept
3:53 azure linux TestAccept
3:47 gcp linux TestAccept

Sankalp-Mittal and others added 2 commits September 4, 2026 13:00
Per review feedback (skills aren't reliably loaded, and the examples plus a
verbose failure are enough): drop the pydabs-acceptance-test skill in favor of
the repo's dresources pattern — a path-scoped .agents/rules/ file (auto-loaded
when working under acceptance/bundle/python/**) pointing to a concise
acceptance/bundle/python/README.md that leans on the existing fixtures. Retarget
the coverage guard's message at the README.

Co-authored-by: Isaac <no-reply@databricks.com>
@@ -0,0 +1,8 @@
---
description: Rules for authoring PyDABs resource acceptance tests
globs: acceptance/bundle/python/**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.agents/rules/*.md also need to be symlinked to .cursor/rules/<rule>.mdc. would be great if you could write a lint rule that auto-adds these symlinks 🙏

Copy link
Copy Markdown
Collaborator Author

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

Comment on lines +19 to +20
# jobs predates the <plural>-support convention; covered across the suite instead.
"jobs",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you going to migrate the test for this resource?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan on doing it eventually, but I am focussing on completing the codegen for now, the migration can be done later on as well

Add tools/validate_cursor_rules.py (wired into `task checks`) so a rule under
.agents/rules/ without its .cursor/rules/<name>.mdc symlink fails CI; `--fix`
auto-creates missing symlinks and drops stale ones. Also add the symlink for the
new pydabs-acceptance-tests rule.

Co-authored-by: Isaac <no-reply@databricks.com>
Comment thread Taskfile.yml Outdated
cmds:
- "! git grep -lF databricks.com -- '*uv.lock' '*.py.lock'"

check-cursor-rules:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should ideally be in a different PR

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added PR#6529

Remove tools/validate_cursor_rules.py and its check-cursor-rules task; the
symlink-mirror check is being shipped on its own. Keep the
.cursor/rules/pydabs-acceptance-tests.mdc symlink for the rule added here.

Co-authored-by: Isaac <no-reply@databricks.com>
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.

3 participants