Skip to content

#125 — pin override-only edits surface in the YAML text-diff drawer (verify-and-pin) - #144

Merged
cmbays merged 5 commits into
mainfrom
domain-125-overrides-diff
Jun 7, 2026
Merged

cmbays merged 5 commits into
mainfrom
domain-125-overrides-diff

Conversation

@cmbays

@cmbays cmbays commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Verify-and-pin + dogfood demonstration. cute-dbt#125 asks that an
override-only edit (a change confined to a unit test's overrides: block —
macros / vars / env_vars) show up in the PR-diff test-details drawer. The
existing #96 YAML text diff already surfaces it by construction:

This PR pins that behavior and makes it visible in the dogfooded artifacts.

What's here

Pins (tests + doc):

  • Slicer pin (domain/unit_test_yaml.rs): extract_unit_test_block on a
    3-kind overrides: block asserts overrides:/macros:/vars:/env_vars: +
    a deep value ride along, and the slice still spans given/expect.
  • Interaction pin (domain/cell_diff.rs): an override-line hunk yields a
    reconstruct_block_diffs change pair and an empty reconstruct_table_diffs
    (data_diff None).
  • Rendered-visibility pin (tests/headless_toggle.rs, real Chromium): the
    override change shows in the drawer Diff view; the given/expect grids render
    Current-only (no .cell-diff-toggle/.cell-diff-table).
  • Doc note (book/src/how-it-works.md): override changes ride the text diff;
    the dropped structured overrides payload is irrelevant to this path.

Dogfood (the consumed dbt projects now carry overrides — else the feature is
invisible in the downloadable artifact):

  • Showcase: a 3-kind overrides block added to
    test_mart_dq_summary_zero_quarantined_when_all_valid in the playground source
    (macros.dbt.current_timestamp pins the non-deterministic clock the test's own
    description calls out, + vars + env_vars), an override-only edit hunk in
    playground-pr-diff.patch, and a regenerated examples/playground-pr-diff-report.html.
    The Authoring-YAML Diff view now visibly carries the override change pair; the
    existing SQL diff (fct_provider_metrics 3/3) and cell diff (mart_dq_summary)
    are intact. MANIFEST.toml SHAs updated.
  • Live self-dogfood: a vars/env_vars overrides block on a dbt-project/
    unit test (dbt parse clean under fusion; inert here since no model reads them
    — meaningful macro overrides like is_incremental arrive with feat: surface incremental-model unit-test semantics (incremental badge + expect=merged-rows tooltip) #145).

On "multiple override edits for each type"

The diff substrate is type-agnostic — macros/vars/env_vars are just YAML lines
to the text diff. So all three kinds are present in the fixture content, with one
representative edit covering the mechanism, rather than three near-identical scenarios.

Acceptance criteria (#125)

Gates

fmt · clippy --locked -D warnings · nextest (690) · bdd · rustdoc -D warnings ·
mdbook · deny · llvm-cov ≥85 · headless_toggle (+ the new visibility test) ·
headless_zero_egress (on the regenerated example) · fixture-manifest SHA gate ·
example byte-identity (regenerated deterministically; root_path-free, verified).

Not in this PR

Incremental-model unit-test support (badges + the expect = merged rows, not the final table tooltip) is a separate feature (distinct surface, needs overrides
ingestion) — filed as #145.

Closes #125

🤖 Generated with Claude Code

cmbays and others added 2 commits June 6, 2026 16:03
#125)

cute-dbt#125 verify-and-pin: a unit test's `overrides` block
(macros/vars/env_vars) is sliced into the #69/#96 YAML block by
construction, so an override-only edit surfaces in the test-details
Authoring-YAML Diff view via the existing #96 text-diff path — no new
render surface. The edit leaves given/expect cells byte-identical, so
the #98 cell diff correctly returns None (no spurious/misleading cell
view), and the drawer is the only place the change shows.

- domain: end-to-end guard in cell_diff.rs — an override-line hunk on a
  test with given/expect rows + a 3-kind overrides block yields a
  reconstruct_block_diffs change pair (with the sibling override keys
  and given/expect data riding along as context, proving the slice
  spans the whole entry) AND an empty reconstruct_table_diffs.
- headless: rendered-visibility proof in headless_toggle.rs — the
  override change shows in the drawer Diff view while the given/expect
  grids render Current-only (no .cell-diff-toggle / .cell-diff-table).
- docs: how-it-works note — override changes ride the text diff; the
  dropped structured `overrides` payload is irrelevant to this path.

No production code or template change; examples and snapshots stay
byte-identical.

Closes #125

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Advisor follow-up: the cell_diff.rs end-to-end test hand-builds its
UnitTestYamlBlock, so it never exercised the real extract_unit_test_block
slicer — the function that actually decides whether `overrides:` rides
along (the foundational #125 link, and the issue's explicit Discovery
item "confirm the working-tree YAML block span includes the overrides
lines").

Add a dedicated slicer test that invokes extract_unit_test_block on a
3-kind overrides block and asserts overrides:/macros:/vars:/env_vars: +
a deep value ride along (and the slice still spans to given/expect).
Soften the cell_diff test comment so it no longer overclaims slicer
behavior — that test asserts only that reconstruction preserves untouched
sibling lines around the change pair.

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

coderabbitai Bot commented Jun 6, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@cmbays, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 12 minutes and 4 seconds. Learn how PR review limits work.

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

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 77bc2018-a313-463d-b159-b7d5c096cf78

📥 Commits

Reviewing files that changed from the base of the PR and between b95521f and 6f03eb0.

📒 Files selected for processing (7)
  • dbt-project/models/marts/_marts__models.yml
  • examples/playground-pr-diff-report.html
  • examples/playground-report.html
  • tests/fixtures/MANIFEST.toml
  • tests/fixtures/playground-pr-diff.patch
  • tests/fixtures/playground-source/models/marts/analytics/_analytics__models.yml
  • tests/headless_toggle.rs
📝 Walkthrough

Walkthrough

This PR adds test coverage and documentation for surfacing unit-test overrides block changes through the YAML text-diff fallback. When only overrides content changes (leaving given/expect byte-identical), the YAML diff displays the change while the cell-diff layer correctly ignores it, preventing spurious cell-diff UI.

Changes

Override-only edit text-diff fallback

Layer / File(s) Summary
YAML block slice includes full overrides subtree
src/domain/unit_test_yaml.rs
Regression test confirms extract_unit_test_block preserves the entire overrides: section with all three override kinds (macros, vars, env_vars) and nested values, while continuing through subsequent given/expect fields of the same test entry.
Override-only edits produce text diff but not cell diff
src/domain/cell_diff.rs
End-to-end unit test verifies that when only overrides changes (byte-identical given/expect), reconstruct_block_diffs produces a YAML text diff while reconstruct_table_diffs returns no cell-diff entry, confirming the cell-diff layer ignores override-only edits.
End-to-end integration test and user documentation
tests/headless_toggle.rs, book/src/how-it-works.md
Headless integration test drives Chromium to assert the Authoring-YAML Diff drawer shows override changes without cell-diff UI/toggle on expected or given panels. Documentation explains the text-diff fallback behavior and clarifies that overrides are surfaced via working-tree YAML slices because they are not parsed structurally.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • breezy-bays-labs/cute-dbt#140: Main PR adds override-only regression coverage for reconstruct_block_diffs vs reconstruct_table_diffs in src/domain/cell_diff.rs, which directly exercises the same cell-diff reconstruction logic refactored by retrieved PR #138 (display/key cell semantics).

Poem

🐰 Overrides slip silent through the cells,
No diff to tell their story well—
Till text-diff hops through YAML's door,
And shows what changed beneath before!
Now tests and docs in harmony dwell. 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: pinning override-only edits to surface in the YAML text-diff drawer, which is verified by the added tests and documentation updates.
Linked Issues check ✅ Passed All acceptance criteria from #125 are satisfied: override changes surface in the YAML text-diff drawer, no regression to cell-diff, and synthetic fixtures exercising override-only edits are provided through unit and integration tests.
Out of Scope Changes check ✅ Passed All changes directly address #125 requirements: documentation, slicer test, cell-diff test, and headless integration test validating override-only edit visibility without regression to cell-diff.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 domain-125-overrides-diff

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.

@ghost

ghost commented Jun 6, 2026 •

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 5 individual chapters for you:

Title
1 Document override-only edit behavior in the book
2 Pin YAML slicer support for overrides block
3 Verify text-diff fallback for override-only edits
4 Add overrides to dogfood and playground projects
5 Regenerate showcase reports and pin UI visibility
Open in Stage

Chapters generated by Stage for commit 6f03eb0 on Jun 6, 2026 8:58pm UTC.

@github-actions

github-actions Bot commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

📄 Rendered report preview

All examples regenerated cleanly.

This PR touches dbt-project/ — the dbt-project (PrDiff) row below renders this PR's own --pr-diff diff.

Preview Artifact
jaffle-shop — jaffle-shop-report.html Download
dbt-project (PrDiff — this PR's own changes) — dbt-project-report.html Download
pr-diff-showcase — pr-diff-showcase-report.html Download
playground — playground-report.html Download

Click Download to fetch the rendered HTML. Each artifact
is a zip containing the single-file report — extract and open
in any browser. Reports are fully self-contained (zero
external resource requests).

Alternative: GitHub CLI
# gh CLI >= 2.63 extracts into ./report-preview-playground/.
gh run download 27073726408 -R breezy-bays-labs/cute-dbt -n report-preview-playground
open report-preview-playground/playground-report.html

Posted by report-preview.yml for 6f03eb01969d9c1a367a73de74683357e8c2022e. Affordance only — never blocks merge.

@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 documentation and comprehensive tests for handling 'override-only' edits in cute-dbt unit tests, ensuring that changes confined to the overrides block correctly surface in the YAML text diff without producing spurious cell-level diffs. The review feedback identifies an issue in the headless integration test where the character offsets for text highlighting in the mock BlockDiff are off-by-two, and provides a code suggestion to correct them.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread tests/headless_toggle.rs
cmbays and others added 3 commits June 6, 2026 16:14
…PR#144)

Gemini flagged the hand-built BlockDiff mock's `emphasis` ranges as
off-by-two: `cutoff_days: ` is 13 chars after the 8-space indent (indices
8..=20), so the changed value starts at codepoint 21, not 19. Old `(19,_)`
highlighted the `: ` rather than the value. Corrected to `7` → [21,22),
`30` → [21,23). Cosmetic in this test (assertions key on the change LINES,
not emphasis) but the mock should describe a faithful diff.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e diff is visible

The #125 product change shipped without a paired dbt-fixture change, so no
consumed project actually carried an `overrides:` block — the feature was
mechanically correct but INVISIBLE in the downloadable PR-diff artifact
(Christopher's report: "I don't see overrides on the authored YML"). Pair the
product change with the dbt change:

- showcase (durable, downloadable): add a 3-kind `overrides` block
  (macros.dbt.current_timestamp pins the non-deterministic clock the test's
  own description calls out, plus vars + env_vars) to
  test_mart_dq_summary_zero_quarantined_when_all_valid in
  tests/fixtures/playground-source/.../_analytics__models.yml, placed AFTER
  `expect:` so the existing SQL/cell hunks don't shift; add an override-only
  edit hunk (dq_quarantine_threshold 10 -> 5) to playground-pr-diff.patch;
  regenerate examples/playground-pr-diff-report.html. The Authoring-YAML Diff
  view now visibly carries the override change pair; the existing SQL diff
  (fct_provider_metrics 3/3) and cell diff (mart_dq_summary expect) are intact.
  MANIFEST.toml SHAs updated for the two touched fixtures.
- live self-dogfood: add a vars/env_vars `overrides` block to a dbt-project
  unit test (dbt parse clean under fusion 2.0-preview; inert here since no
  model reads them — meaningful macro overrides like is_incremental arrive
  with the incremental-model work, #145).

No production code or template change. The regenerated example is
root_path-free, byte-deterministic, and zero-egress (verified). The process
gap (feature without a paired consumed-project fixture) is captured as a
durable memory.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…des fixture

examples/playground-report.html reads tests/fixtures/playground-source for its
authoring-YAML drawer, so adding the overrides block to the showcase source
changed it too (the in-scope test's drawer now shows the overrides in File view).
Regenerated; byte-deterministic, root_path-free. (The pr-diff showcase + the
fixtures + dbt-project override landed in e91bd7e; this is the paired baseline
example the same source feeds.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cmbays
cmbays merged commit b571967 into main Jun 7, 2026
31 checks passed
@cmbays
cmbays deleted the domain-125-overrides-diff branch June 7, 2026 17:08
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.

diff: surface unit-test overrides (env_vars/macros/vars) changes in the YAML text-diff fallback

1 participant