Skip to content

#39 — feat(examples): dogfooded playground fixture + matrix CI gate + unit_test format coverage - #63

Merged
cmbays merged 4 commits into
mainfrom
adapters-issue-39-playground-fixture
May 25, 2026
Merged

cmbays merged 4 commits into
mainfrom
adapters-issue-39-playground-fixture

Conversation

@cmbays

@cmbays cmbays commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The richer cute-dbt example sourced from cmbays/dbt-playground — a real healthcare-analytics dbt project on synthetic Synthea data. The fixture pair captures three modified models in one diff and exercises 4 of the 4 at-least-one criteria in issue #39:

  • ✅ UNION arm rendering — two distinct patterns (encounter+medication metric UNION ALL in mart_dq_summary; unknown-sentinel UNION ALL in dim_payers)
  • ✅ Multi-model in-scope — 3 modified models render as 3 per-model cards
  • ✅ Multi-test-per-model — mart_dq_summary carries 2 unit tests; dim_payers carries 1
  • ✅ Empty-state card — int_dq_quarantine__encounters is in scope but has 0 unit tests targeting it

Plus a bonus the issue didn't ask for: the 3 unit tests in the playground PR span dbt's three fixture formats (sql given + mixed dict/csv expect), and features/unit_test_format_coverage.feature pins cute-dbt's renderer against all three.

Closes #39.

Cross-repo coordination — READ ME

This PR pairs with cmbays/dbt-playground#290, which adds the 3 unit_tests captured in this fixture pair. Both PRs should be reviewed together:

  • The playground PR is the source of truth for the unit_tests YAML.
  • This PR commits the resulting dbt compile manifest snapshots as cute-dbt fixtures, plus a synthetic local-only body-modification overlay on three models to trip the StateComparator (the overlay is NOT committed to the playground).
  • tests/fixtures/MANIFEST.toml origin_url currently pins to the playground feat-branch HEAD dc1b08f for traceable provenance. Once playground#290 squash-merges, the origin_url entries will be updated to the merge commit SHA in a follow-up commit before this PR merges. That's intentional, not stale.

What ships

File Notes
tests/fixtures/playground-{current,baseline}.json 2× 2.9 MB. Compiled dbt-core 1.11.11 manifests, schema v12, adapter=duckdb.
tests/fixtures/MANIFEST.toml 2 new entries with synthetic_only=true, origin=dbt-playground, sha256, license, description.
examples/playground-report.html 3.6 MB rendered report — committed for click-through demo.
.github/workflows/ci.yml example-report-up-to-date refactored to a matrix (jaffle-shop + playground). Stable aggregator job retains the existing branch-protection check name (Example report is byte-identical to renderer output).
features/unit_test_format_coverage.feature + tests/steps/unit_test_format_coverage.rs 4 new BDD scenarios — feature count bumped 6→7 (atomic mirror update in ci.yml + lefthook).
tests/{resource_ref_lint,headless_zero_egress}.rs Both gates now loop over every committed example via a single COMMITTED_EXAMPLES array. The PRIMARY runtime proof (headless Chrome + DNS denied) covers BOTH examples in one launch (~7.7s).
book/src/examples.md + examples/README.md Document the new example.

Test plan

  • cargo nextest run — 324 passed, 1 skipped
  • cargo test --test bdd — 7 features, 36 scenarios, 202 steps all passing (4 new)
  • cargo test --test resource_ref_lint — 17 passed (incl. new matrix lint)
  • cargo test --test headless_zero_egress -- --ignored — 1 passed (covers BOTH examples in 7.74s)
  • cargo fmt --check, cargo clippy --all-targets -- -D warnings — clean
  • cargo test --test fixture_manifest_listed — 3 passed (every fixture listed with matching sha256)
  • lefthook pre-push gates — green
  • CI matrix CI verification (this PR)
  • CodeRabbit + Gemini bot disposition
  • origin_url SHA update post playground#290 merge
  • Squash-merge after both bots green

Follow-ups (tracked, out of scope)

  • dbt-autofix sweep on playground for dbt-fusion compatibility (separate playground PR — fusion 2.0-preview blocks parse on ~166 deprecated test-args YAML occurrences; dbt-core works as-is).
  • Fusion-produced cross-engine fixture in cute-dbt (after playground YAML is fusion-compatible).
  • Cross-join demo model (playground has none today — engine-level cross-join classification is already covered by src/adapters/cte_engine.rs unit tests).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a new playground example report demonstrating unit test rendering across multiple format types (dict, csv, sql), including multi-model selectors, UNION patterns, and empty-state card behavior.
  • Documentation

    • Updated examples guide with details on the new playground report and regeneration instructions.

Review Change Stack

cmbays and others added 2 commits May 25, 2026 00:50
… unit_test format coverage

Adds the richer cute-dbt example sourced from cmbays/dbt-playground#290
— a real dbt project with synthetic Synthea healthcare data. The
fixture pair captures three modified models exercising in one report:

- Multi-model in-scope cascade: mart_dq_summary, dim_payers, and
  int_dq_quarantine__encounters are all modified.
- UNION arm rendering in two distinct patterns (encounter +
  medication metric UNION ALL; unknown-sentinel UNION ALL).
- Multi-test-per-model: mart_dq_summary carries 2 unit tests;
  dim_payers carries 1.
- Empty-state card: int_dq_quarantine__encounters is in scope but
  carries no unit tests targeting it.
- dbt unit_test fixture-format diversity: the 3 unit tests in the
  playground span sql `given` + mixed dict/csv `expect` formats.

Changes:

- tests/fixtures/playground-{current,baseline}.json + MANIFEST.toml
  provenance entries (synthetic_only=true, origin=dbt-playground,
  sha256, license, description).
- examples/playground-report.html committed (3.6MB) rendered from
  the fixture pair via the cute-dbt CLI.
- .github/workflows/ci.yml example-report-up-to-date refactored to a
  matrix (jaffle-shop + playground) with a stable aggregator job
  presenting the existing branch-protection check name. Adding new
  examples now only requires adding a matrix row.
- features/unit_test_format_coverage.feature + 4 BDD scenarios
  asserting cute-dbt renders unit_tests authored in dict / csv / sql
  formats uniformly. Feature count bumped 6 → 7 in ci.yml + lefthook
  (atomic mirror update).
- book/src/examples.md + examples/README.md updated with the new
  playground example.

Cross-repo coordination:
- cmbays/dbt-playground#290 (private) adds the 3 unit_tests this
  fixture pair captures. The MANIFEST.toml origin_url pins to that
  commit SHA for provenance audit.

Follow-ups tracked but out of scope:
- dbt-autofix sweep on playground for fusion compatibility (separate
  playground PR).
- Fusion-produced cross-engine fixture in cute-dbt.
- Cross-join demo model (playground has none today).

Verified locally:
- cargo nextest run: 324 passed, 1 skipped
- cargo test --test bdd: 7 features, 36 scenarios, 202 steps all
  passing (4 new scenarios)
- cargo fmt --check, cargo clippy --all-targets -- -D warnings: clean
- resource-ref lint: 17 passed (both jaffle-shop + playground HTML)
- fixture-manifest-listed: all 7 fixtures listed with matching sha256

Closes #39.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…itted example

The PR-D commit added examples/playground-report.html but left the
zero-egress audit gates hardcoded to examples/jaffle-shop-report.html.
That meant the new example shipped without:

- the secondary structural lint (`tests/resource_ref_lint.rs`)
- the PRIMARY runtime proof (`tests/headless_zero_egress.rs`) — the
  load-bearing auditability test that opens the report in real
  Chromium with DNS denied and asserts zero `Network.requestWillBeSent`
  events for http/https/ws/wss.

Both tests are now keyed on a single `COMMITTED_EXAMPLES` array. Adding
a new examples/<name>-report.html requires only appending its filename
there (same shape as the .github/workflows/ci.yml matrix added in the
parent commit). The headless test loops over examples inside a single
Chrome instance (fresh tab per example, separate event capture per
example) so the additional runtime cost is one extra tab, not an extra
Chrome launch.

Verified locally:
- cargo test --test resource_ref_lint: 17 passed
- cargo test --test headless_zero_egress -- --ignored: 1 passed
  (covers both jaffle-shop AND playground in 7.74s on a single launch)

Surfaced by advisor pre-PR-open audit — exactly the kind of silent
audit gap PR-Cβ taught us about.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@cmbays, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 29 minutes and 35 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f0c5cc32-1de0-498d-98ca-389f5ed48594

📥 Commits

Reviewing files that changed from the base of the PR and between e8a33a4 and bf366ae.

📒 Files selected for processing (14)
  • .github/workflows/ci.yml
  • book/src/examples.md
  • examples/README.md
  • examples/playground-report.html
  • features/unit_test_format_coverage.feature
  • lefthook.yml
  • tests/common/mod.rs
  • tests/fixtures/MANIFEST.toml
  • tests/fixtures/playground-baseline.json
  • tests/fixtures/playground-current.json
  • tests/headless_zero_egress.rs
  • tests/resource_ref_lint.rs
  • tests/steps/mod.rs
  • tests/steps/unit_test_format_coverage.rs
📝 Walkthrough

Walkthrough

This PR introduces the dbt-playground example—a new fixture-driven, multi-format unit test coverage showcase with full BDD feature tests, generalized test infrastructure for multi-example validation, updated documentation, and restructured CI workflows.

Changes

dbt-playground Example and Test Coverage

Layer / File(s) Summary
Playground fixture data and manifest
tests/fixtures/MANIFEST.toml
Two new fixture entries—playground-baseline.json and playground-current.json—register the example data with SHA-256 checksums and detailed provenance, documenting their role in diff-scoping and unit test format diversity testing.
Documentation for playground example
book/src/examples.md, examples/README.md
Book chapter and examples README document the playground example report, multi-model UNION rendering patterns, unit test format coverage (dict/csv/sql), empty-state behavior, and regeneration instructions alongside the existing jaffle-shop example.
Unit test format coverage feature and steps
features/unit_test_format_coverage.feature, tests/steps/mod.rs, tests/steps/unit_test_format_coverage.rs
New Gherkin feature and Cucumber step implementations validate that the playground report correctly renders unit tests authored in dict, csv, and sql formats, and assert empty-state rendering when models have zero wired unit tests.
Generalize tests for multi-example validation
tests/headless_zero_egress.rs, tests/resource_ref_lint.rs
Both headless and lint tests refactored to validate multiple committed examples: new COMMITTED_EXAMPLES lists, parameterized file path helpers, single Chromium instance with per-example tabs, and aggregated failure reporting across all examples.
CI feature count and example regeneration workflow
.github/workflows/ci.yml, lefthook.yml
Feature count requirement bumped from 6 to 7 files; CI workflow restructured with new matrix-driven example-report-check job that byte-compares regenerated reports and an example-report-up-to-date aggregator job, replacing the prior single-case jaffle-shop validation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • breezy-bays-labs/cute-dbt#43: Extends the existing cucumber ATDD test/step infrastructure by adding the new unit_test_format_coverage feature and step module, directly building on the earlier cucumber harness and resource-ref lint work.
  • breezy-bays-labs/cute-dbt#61: Updates the examples documentation in book/src/examples.md by adding the dbt-playground section, directly following the mdBook chapter introduction in that PR.
  • breezy-bays-labs/cute-dbt#38: Updates the CI workflow's example-report-up-to-date job by replacing single-case jaffle-shop regeneration with a new matrix-driven example-report-check plus aggregator, directly extending the prior example-report-up-to-date foundation.

Poem

🐰 A playground springs to life with tests so bright,
Unit formats danced—dict, csv, sql unite,
Empty states whisper true, examples now align,
Fixtures in the manifest, CI checks the line,
Multi-tale validation flows—no egress takes flight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly reflects the main changes: adding a playground fixture with BDD coverage, implementing a matrix CI gate for multiple examples, and covering unit_test format coverage scenarios.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch adapters-issue-39-playground-fixture

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

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new 'dbt-playground' example to demonstrate richer dbt features such as multi-model in-scope cascades, UNION-ALL rendering, and empty-state cards for modified models without unit tests. It also adds a new BDD feature to verify coverage for various dbt unit test fixture formats (dict, csv, sql). Feedback focuses on improving the robustness of the new tests by moving duplicated constants to a shared location, using structured HTML parsing instead of ad-hoc string containment, and deriving assertions from test data rather than hardcoding keywords.

Comment thread tests/headless_zero_egress.rs Outdated
Comment thread tests/steps/unit_test_format_coverage.rs
Comment thread tests/steps/unit_test_format_coverage.rs Outdated
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

cmbays and others added 2 commits May 25, 2026 01:17
…2cb38

cmbays/dbt-playground#290 squash-merged at 602cb38 (2026-05-25 04:58Z).
Update both playground fixture entries' origin_url from the feat-branch
HEAD dc1b08f to the merge commit. The fixture sha256s are unchanged —
the manifests themselves are identical; only the provenance pointer
moves to the stable merge commit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…rtion (Gemini disposition)

Addresses 3 medium-severity findings from gemini-code-assist on PR #63.

G-1 (resolved) — `COMMITTED_EXAMPLES` was duplicated in
`tests/headless_zero_egress.rs` and `tests/resource_ref_lint.rs`.
Moved the array to `tests/common/mod.rs` as `pub const`, along with
the `example_path(filename)` helper. Both gates now reference a
single source of truth — adding a new committed example only requires
appending its filename in one place.

G-2 + G-3 (resolved) — the `that model's section indicates zero unit
tests are wired` step matched a loose union of keyword variations
(`html.contains("0 unit tests wired") || .contains("No unit tests")
|| .contains("no unit tests")`). The assertion would pass if the
copy appeared anywhere on the page, not just on the named model's
card. Rewrote all 4 `Then` steps to parse the embedded
`<script id="cute-dbt-data">` JSON payload via `tl` + `serde_json`
and assert structurally:

  - "contains the unit test X" → find X across all models' `tests`
    arrays; stash the owning model name in `World.last_named_model`.
  - "that unit test names the target model X" → compare the stashed
    owner to X (no double regex match needed).
  - "contains a section for the model X" → look up the model in the
    payload by name; stash the name.
  - "that model's section indicates zero unit tests are wired" →
    assert the stashed model's `tests` array is empty.

Per-model assertions now correctly scope to the named model, not the
whole document.

Verified locally:
- cargo test --test bdd: 7 features, 36 scenarios, 202 steps passing
- cargo test --test resource_ref_lint: 17 passed
- cargo test --test headless_zero_egress -- --ignored: 1 passed
  (covers both jaffle-shop + playground in one Chrome launch)
- cargo fmt --check, cargo clippy --all-targets -- -D warnings: clean
- cargo nextest run: 324 passed, 1 skipped

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cmbays

cmbays commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

The original review was rate-limited at 04:56Z. Three commits have landed since then with bf366ae addressing 3 medium-severity Gemini findings (COMMITTED_EXAMPLES deduplication + structural empty-state assertions). Requesting a fresh review across the full diff. CI is fully green.

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

@cmbays Sure — kicking off a full review across the complete diff now, including the three follow-up commits and bf366ae's fixes for the COMMITTED_EXAMPLES deduplication and structural empty-state assertions.

✅ Actions performed

Full review triggered.

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.

examples: richer fixture(s) from dbt-playground / Tuva (multi-model, UNION CTEs, multi-test-per-model)

1 participant