Skip to content

ci: sticky preview runs cute-dbt --pr-diff on the PR's own dbt-project/ diff (#118) - #119

Merged
cmbays merged 3 commits into
mainfrom
ci-118-preview-prdiff
Jun 1, 2026
Merged

cmbays merged 3 commits into
mainfrom
ci-118-preview-prdiff

Conversation

@cmbays

@cmbays cmbays commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a prdiff-preview job to the sticky-comment workflow (report-preview.yml, cute-dbt#71) that — only when a PR touches dbt-project/ — installs pinned dbt-fusion, compiles an ephemeral manifest at the PR head, and runs cute-dbt --pr-diff on the PR's own git diff --unified=0 base...head -- dbt-project/, uploading a report-preview-dbt-project artifact the existing sticky-comment job globs (report-preview-*). So a PR editing dbt-project/ self-shows its rendered PrDiff diff (inline SQL diff #111, block-precise updated-test detection + YAML drawer diff #96) in the same sticky comment — the payoff of the embedded example landed in #114.

Closes #118

Design (locked)

Manifest = CI-recompiled ephemeral, not the committed one. Always correct regardless of whether the author recompiled; no leak risk — the manifest is ephemeral, never committed (the committed-manifest root_path scrub concern doesn't apply). Empty-diff is handled by an in-step guard (no new third-party action): on a PR that doesn't touch dbt-project/, the job runs the diff step, sets touched=false, and every downstream step skips — the job ends green with no artifact.

What's in it

  • report-preview.yml: the prdiff-preview job (pinned fusion 2.0.0-preview.177 via the standalone-binary installer, no pip; offline dbt compile; fetch-depth: 0; SHA-pinned actions + persist-credentials: false + least-privilege permissions). The committed dbt-project/target/ is excluded from the diff so a manifest-only PR doesn't trigger a pointless compile. The sticky-comment job gains a distinct dbt-project row label + a status line that branches on the job's touched output.
  • examples/cute-dbt-report-preview.yml: kept as the minimal baseline starter; its variations pointer now lists the dbt-fusion + PrDiff-self-dogfood patterns (which live in the recipe page, per the file's own convention).
  • book/src/recipes/github-actions-pr-review.md § 11: documents the dbt-fusion standalone-binary variant (no pip, offline compile, uvx dbt-autofix note) and cross-links this workflow as the worked dogfood example.

Validation

  • actionlint clean on both workflow files (incl. shellcheck of run: blocks).
  • Rehearsed locally: the exact cute-dbt --pr-diff --manifest dbt-project/target/manifest.json --project-root dbt-project line, against a fusion-compiled manifest + a real dbt-project/ diff → exit 0, inline-diff markup rendered. Fusion compile: 6 models / 29 success / 0 errors.
  • mdbook build book green.
  • Review pass (GO-WITH-FIXES): the should-fix — the comment status line branched on .result (always success since the job has no job-level if:), falsely claiming a dbt-project row on non-dbt PRs — is fixed (3388339): it now branches on the job's touched output.

Scope / follow-up

  • CI-only (no Rust, no change to the cute-dbt binary or its output) → ci: / non-versioning.
  • This PR ships the mechanism. Visually confirming it end-to-end needs a small follow-up demo PR that edits dbt-project/ (this PR doesn't touch dbt-project/, so its own preview is correctly empty).

Merge note

Keep the squash subject on the ci: line so release-plz classifies it non-versioning (the branch also carries a fix: commit for the review correction).

Summary by CodeRabbit

  • New Features

    • PR workflows now automatically generate PrDiff HTML reports when dbt-project files are modified, uploaded as preview artifacts.
  • Documentation

    • Added comprehensive guide for compiling dbt projects with dbt-fusion standalone binary, including offline compilation and version pinning details.

cmbays and others added 2 commits May 31, 2026 21:00
…t/ diff

Adds a `prdiff-preview` job to report-preview.yml that — only when a PR
touches dbt-project/ — installs pinned dbt-fusion (standalone binary, no
pip), compiles an EPHEMERAL manifest at the PR head, and runs
`cute-dbt --pr-diff` on the PR's own `git diff --unified=0 base...head --
dbt-project/`, uploading a `report-preview-dbt-project` artifact the
sticky-comment aggregator picks up (distinct label + status line). Empty
diff = skip clean via an in-step guard (no new third-party action). The
manifest is ephemeral (never committed) so the committed-manifest
root_path leak concern does not apply.

Syncs the consumer-recipe pointer (examples/cute-dbt-report-preview.yml)
and documents the dbt-fusion + PrDiff-self-dogfood variant in the book
recipe (github-actions-pr-review.md § 11).

Implements #118.

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

The prdiff-preview job has no job-level `if:`, so it always runs to
completion and reports `result: success` even on PRs that don't touch
dbt-project/. The old `case "$PRDIFF_RESULT"` therefore printed a
"dbt-project (PrDiff) row below" claim with no such row in the table on
every common-case (non-dbt) PR, and its `skipped)` branch was dead code.

Expose `touched` as a job output and branch the comment on it instead.
Also exclude `dbt-project/target/` from the diff so a PR touching only the
committed manifest doesn't trigger a pointless fusion compile + empty-scope
render. Addresses the review on PR #118.

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

coderabbitai Bot commented Jun 1, 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 51 minutes and 3 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: bc2cb7ca-cd71-4fcc-8098-3000f8f3ac09

📥 Commits

Reviewing files that changed from the base of the PR and between 3388339 and 57c7729.

📒 Files selected for processing (2)
  • .github/workflows/report-preview.yml
  • book/src/recipes/github-actions-pr-review.md
📝 Walkthrough

Walkthrough

The PR implements a new prdiff-preview job in the sticky PR comment workflow that detects changes to dbt-project/, compiles a dbt-fusion manifest offline, and renders a PrDiff diff report as an artifact. The sticky comment is extended to integrate this report status alongside baseline example previews and clarify which artifacts represent self-diff validation. Documentation and example workflow headers are updated to reference the dbt-fusion variant.

Changes

PrDiff preview integration for sticky PR comment

Layer / File(s) Summary
PrDiff preview job implementation
.github/workflows/report-preview.yml
New prdiff-preview job (lines 116–251) detects via git diff whether PR touches dbt-project/, conditionally installs pinned dbt-fusion, compiles dbt-project with ephemeral manifest, generates diff patch, renders PrDiff HTML report, and uploads report-preview-dbt-project artifact; exposes touched output. Fork-PR comment text (lines 22–23) is clarified.
Sticky comment job orchestration
.github/workflows/report-preview.yml
sticky-comment job now depends on both regenerate and prdiff-preview (line 260); environment extended with PRDIFF_RESULT and PRDIFF_TOUCHED from prdiff-preview outputs (lines 276–277).
Sticky comment rendering and PrDiff status
.github/workflows/report-preview.yml
Comment body generation customizes dbt-project artifact row label to distinguish it as "PrDiff — this PR's own changes" and adds a new PrDiff status section (lines 291–344) that conditionally reports job success/failure or "no changes" based on PRDIFF_TOUCHED flag.
Documentation and example workflow updates
.github/workflows/examples/cute-dbt-report-preview.yml, book/src/recipes/github-actions-pr-review.md
Example workflow header (lines 12–15) references "PrDiff-on-the-PR's own-diff self-dogfood pattern" with updated recipe URL. Recipe "Customization" section (lines 354–356) forwards to the dbt-fusion standalone-binary variant. New Section 11 (lines 449–502) documents compiling with dbt-fusion via official standalone installer, pinned version, offline dbt compile with in-project profiles.yml, and related notes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • breezy-bays-labs/cute-dbt#117: Introduces the embedded dbt-project/ example directory that serves as the input for the new prdiff-preview job's compilation and diff rendering.
  • breezy-bays-labs/cute-dbt#72: Extends the same sticky-comment workflow logic with additional job dependencies and environment setup to integrate PrDiff job outputs.

Poem

🐰 A PR diff job runs so keen,
Compiling dbt-project between,
Fusion spins up manifests quick,
Sticky comments show the trick,
Now your changes are truly seen! ✨

🚥 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 'ci: sticky preview runs cute-dbt --pr-diff on the PR's own dbt-project/ diff (#118)' accurately and specifically describes the main change: adding a prdiff-preview job to run cute-dbt --pr-diff on the PR's own diff scoped to dbt-project/.
Linked Issues check ✅ Passed The PR implementation fully addresses all acceptance criteria from #118: new prdiff-preview job runs only when dbt-project/ is touched, installs pinned dbt-fusion, compiles ephemeral manifest offline, generates git diff, runs cute-dbt --pr-diff, uploads artifact, handles empty-diff cleanly, labels PrDiff preview distinctly, maintains affordance-only contract, updates example workflow and book recipe, and includes local validation.
Out of Scope Changes check ✅ Passed All changes are scoped to the PR's objectives: the prdiff-preview job implementation, sticky-comment job updates to depend on prdiff-preview and set its environment, example workflow header update, and book recipe documentation for the standalone-binary variant—all directly tied to #118.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 ci-118-preview-prdiff

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 adds a new section to the documentation describing how to compile a dbt project using dbt-fusion as a standalone binary in GitHub Actions. The feedback suggests a minor correction to avoid misleading readers about dbt-fusion's support for package management (dbt deps).

Comment thread book/src/recipes/github-actions-pr-review.md Outdated
@github-actions

github-actions Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

📄 Rendered report preview

All examples regenerated cleanly.

This PR doesn't touch dbt-project/, so there's no PrDiff self-preview row.

Preview Artifact
jaffle-shop — jaffle-shop-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 26730198829 -R breezy-bays-labs/cute-dbt -n report-preview-playground
open report-preview-playground/playground-report.html

Posted by report-preview.yml for 57c772908076e66ade0d78eb89d8db58fd618685. Affordance only — never blocks merge.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@book/src/recipes/github-actions-pr-review.md`:
- Around line 464-471: The GitHub Actions step "Install dbt-fusion" uses the
install script with the unsupported argument `--version "$FUSION_VERSION"`;
replace that argument with the official flag(s) used in the Fusion docs (e.g.,
use `--update` and pass the FUSION_VERSION value as the installer expects) so
the installer pins the intended preview release; update the run block that
invokes `curl ... | sh -s --` to pass the documented flag(s) for
installing/pinning a specific preview and keep the FUSION_VERSION env variable
intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ecfd02c0-be5b-4e6b-80fe-025f89b205a9

📥 Commits

Reviewing files that changed from the base of the PR and between e5578cf and 3388339.

📒 Files selected for processing (3)
  • .github/workflows/examples/cute-dbt-report-preview.yml
  • .github/workflows/report-preview.yml
  • book/src/recipes/github-actions-pr-review.md

Comment thread book/src/recipes/github-actions-pr-review.md
…deps"

Bot review on PR #119:
- CodeRabbit (critical): the install uses `--version "$FUSION_VERSION"`,
  which IS the correct installer flag for pinning a specific release
  (installer usage: "--version VER  Install version VER"; `--update` is
  for updating an existing install, wrong for a fresh CI runner). Added a
  post-install version assertion so CI fails loud if the pin ever lands
  the wrong release — making the concern moot mechanically.
- Gemini: dropped "no dbt deps" from the § 7 fusion-variant pointer —
  fusion DOES support packages; the example skips `dbt deps` only because
  this project has none, not because of fusion.

Mirrored the version assertion into the book § 11 recipe snippet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.

ci: sticky preview runs cute-dbt --pr-diff on the PR's own dbt-project/ diff (CI-recompiled manifest)

1 participant