Skip to content

#403 — feat(domain): PR-scope mini-DAG per-node lines added/removed - #405

Merged
cmbays merged 3 commits into
mainfrom
domain-403-prdag-lines
Jun 14, 2026
Merged

cmbays merged 3 commits into
mainfrom
domain-403-prdag-lines

Conversation

@cmbays

@cmbays cmbays commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #403

Epic #352, Slice B. Pure-domain per-node line counts for the PR-scope mini-DAG (PrDag, Slice A / #357). Additive and concurrent-safe: reads the diff index / diff_lines only, no cli/mod.rs run-loop wiring, no render. The PrDagNode type is EXPERIMENTAL-gated and not yet rendered into any golden, so this is byte-neutral (git status examples/ clean).

What this adds

Per-node count definitions

  • pr-diff modified node: +/- line counts summed over every hunk touching the node's original_file_path.
  • baseline modified node: Added/Removed line counts from diff_lines(old_raw_code, new_raw_code).
  • connector / unchanged carrier: 0/0. pr-diff arm — its file is absent from the diff, so hunks_for returns an empty slice; baseline arm — identical raw_code is all-Context.
  • node whose file is absent from the diff: 0/0 (empty hunk slice, never a panic).
  • deleted ghost: pr-diff arm → 0/0 (a deleted model has no current original_file_path, so the diff arm cannot key it); baseline arm → removed-everything (every baseline line counted as removed — a deletion is a real, countable change, so the baseline arm surfaces it rather than a silent 0/0).
  • new node: baseline arm → all current lines counted as added (old == None).
  • both None (no raw_code either side — synthetic / non-SQL): 0/0.

Empty (Some("")) and absent (None) raw_code are treated identically (both zero lines). A single trailing \n is stripped so the dbt-core (strips) vs dbt-fusion (retains) terminator divergence never inflates the count; a genuine EOF blank line survives.

Tests (TDD)

12 new pr_dag tests with exact-count assertions: pr-diff modified node (multi-hunk sum), per-file isolation (no cross-file leak), connector/absent-file → 0/0, no-original_file_path → 0/0, empty index; baseline modified node, unchanged → 0/0, new node (all-added), deleted ghost (all-removed), both-absent → 0/0, empty≡absent equivalence, trailing-newline parity; plus a field-plumbing test asserting compute_pr_dag emits 0/0 on every node.

Gates (all run directly in a fresh worktree — true exit codes)

cargo fmt --check 0 · cargo clippy --all-targets --locked -- -D warnings true exit 0 / 0 warnings · cargo nextest run 2123 passed / 0 failed · cargo test --test bdd 226/226 scenarios · RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items --locked 0 · cargo deny check 0 · domain-purity (domain_clean_arch) pass · golden byte-identity + git status examples/ clean.

🤖 Generated with Claude Code


Open in Stage

#403 (epic #352, Slice B). Add additive `lines_added` / `lines_removed`
counts to `PrDagNode` plus two pure arm-specific counters in
`src/domain/pr_dag.rs`:

- `pr_dag_lines_from_diff(original_file_path, index)` — pr-diff arm:
  sums `+`/`-` hunk line counts for the node's file via
  `NormalizedDiffIndex::hunks_for`. Connector / absent-file / no
  original_file_path → 0/0 (never panics).
- `pr_dag_lines_from_raw_code(old, new)` — baseline arm: counts
  Added/Removed lines from the `raw_code` old→new `diff_lines` LCS diff.
  New node (old=None) → all-added; deleted ghost (new=None) →
  removed-everything; both None → 0/0. A single trailing `\n` is
  stripped (dbt-core/fusion parity) so the framing terminator never
  inflates the count.

`compute_pr_dag` (Slice A topology) emits 0/0 — the type is
EXPERIMENTAL-gated and not yet rendered, so this is byte-neutral to the
goldens. Slice C (#404) wires the population + render once the #261 CLI
lane settles `cli/mod.rs`. Domain-pure (std + serde + intra-domain
pr_diff import only); no cli/render wiring this slice.

Closes #403

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

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 11 minutes and 34 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ 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: 8e97bee7-10c5-41ed-a3ed-513573e8a802

📥 Commits

Reviewing files that changed from the base of the PR and between 6d37ab5 and b3e1fee.

📒 Files selected for processing (1)
  • src/domain/pr_dag.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch domain-403-prdag-lines

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 14, 2026 •

Copy link
Copy Markdown

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

Title
1 Update documentation and imports for line counts
2 Define line count types and computation logic
3 Integrate line count fields into PrDagNode
4 Test line count computation and plumbing
Open in Stage

Chapters generated by Stage for commit b3e1fee on Jun 14, 2026 4:47am UTC.

@github-actions

github-actions Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

📄 Rendered report preview

All golden examples regenerated cleanly.

🟡 Golden examples

Committed to examples/ and byte-identity gated — the canonical reports contributors and consumers browse. Stable across PRs.

Report View Download
diff-showcase-report.html ▶ Open ↗ ⬇ Download
playground-report.html ▶ Open ↗ ⬇ Download
seed-showcase-report.html ▶ Open ↗ ⬇ Download
macro-heavy-report.html ▶ Open ↗ ⬇ Download
jaffle-shop-report.html ▶ Open ↗ ⬇ Download

🐶 Live dogfood preview

This PR doesn't touch dbt-project/, so there's no live dogfood preview.

🧭 Explore preview

The two-page cute-dbt explore explorer — dag.html (model lineage) + tests.html (unit-test viewer). Same golden/live split as the report.

🟡 Golden explore

The committed examples/explore/ playground golden (the full synthetic playground manifest). Byte-identity gated in Example report check. Stable across PRs.

Page View Download
explore/dag.html ▶ Open ↗ ⬇ Download
explore/tests.html ▶ Open ↗ ⬇ Download

🐶 Live explore

This PR doesn't touch dbt-project/, so there's no live explore preview.

▶ Open ↗ opens the report or explorer in your browser in one
click — published to this repo's GitHub Pages under
/pr-405/.
⬇ Download fetches the same self-contained HTML as a workflow
artifact (auth-gated; works fully offline). Either way the report
makes zero external resource requests.

The Pages preview may take ~1 min to update after this comment
posts. On PRs from forks the Open link is unavailable (read-only
token) — use Download.

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

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

cmbays and others added 2 commits June 14, 2026 00:38
…rebase

The index_of test helper in pr_dag.rs constructs a PrDiff struct literal
that did not set the new `deleted` field added by #396 (cute-dbt#396),
breaking the build (E0063) once #405 was rebased onto a main carrying
that field. Match the explicit-Vec::new() idiom used by the sibling
`renames` field.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cmbays
cmbays merged commit 0327cbf into main Jun 14, 2026
41 checks passed
@cmbays
cmbays deleted the domain-403-prdag-lines branch June 14, 2026 04:52
@cmbays

cmbays commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Merged via gated cascade — adversarial gate verdict SHIP, all 22 required checks green, behind:0. Closes #403.

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.

domain: PR-scope mini-DAG per-node lines added/removed (#352 Slice B)

1 participant