Repository navigation
#249 — accept double-quoted ref()/source() in given-input leaf extraction - #272
Conversation
…t leaf extraction
given_input_leaf scanned for single-quoted arguments only
(rfind('\'')), so a double-quoted given input — ref("x"), which dbt
accepts and both engines ship verbatim on the manifest wire
(cute-dbt#245) — lost its leaf binding entirely. In the
union.arm-coverage check a fed arm then read as provably unfed and
degraded to a FALSE UNCOVERED nag (worse than the issue's stated
Unknown); the join checks' side_rows consumer mocked the side empty the
same way.
- the right-to-left scan now accepts either quote style under the
matching-quote rule (open/close must be the SAME character; mixed or
unbalanced pairs stay None, fail-open) — the domain twin of the
renderer's strip_matching_quotes contract from PR #248, kept local
because domain never imports adapters and the scan deliberately
tolerates trailing non-string kwargs (ref('orders', v=2))
- TDD: leaf-extraction test family (single-quote pins stay, double-
quote accepts, per-argument mixed styles for source(), mixed/
unbalanced-quote None pins) + a detector-level twin pinning that a
double-quoted given classifies arm-coverage identically to its
single-quoted twin (RED showed Uncovered vs Covered)
- dogfood (the paired-fixture rule): both playground mart_dq_summary
tests' stg_synthea__medications givens flipped to ref("…") in
current+baseline manifests AND the paired source YAML (same-revision
contract; 1:1 in-place line edits keep the pr-diff showcase hunk
numbers unshifted), so the committed goldens prove
union[combined_metrics] stays COVERED through a double-quoted given
- goldens regenerated: playground / diff-showcase / explore tests.html
carry the quote flip (bound_to_node intact in the payload);
jaffle-shop + explore dag.html byte-identical
- BDD steps' input capture widened to greedy (.+) so feature lines can
carry a double-quoted input string; MANIFEST.toml SHAs + provenance
notes updated
Closes #249
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR extends dbt given-input parsing to accept double-quoted ChangesQuote-style preservation for dbt ref/source givens
Possibly related issues
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
📄 Rendered report previewAll golden examples regenerated cleanly. 🟡 Golden examplesCommitted to
🐶 Live dogfood previewThis PR doesn't touch ▶ Open ↗ opens the report in your browser in one click — The Pages preview may take ~1 min to update after this comment Alternative: GitHub CLI# gh CLI >= 2.63 extracts into ./report-preview-playground/.
gh run download 27391176941 -R breezy-bays-labs/cute-dbt -n report-preview-playground
open report-preview-playground/playground-report.htmlPosted by |
There was a problem hiding this comment.
Code Review
This pull request adds support for both single and double quotes in dbt unit test given inputs (e.g., ref("...") as well as ref('...')), addressing issue cute-dbt#249. The given_input_leaf function in src/domain/checks.rs was updated to scan for either quote style while ensuring matching open and close quotes. Corresponding unit tests, feature files, test steps, and fixtures were updated to verify this behavior. There are no review comments to assess, so I have no additional feedback to provide.
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.
Overnight orchestration wrap-upMerged as What shipped: Cross-regen note: this PR regenerated 3 goldens (playground, diff-showcase, explore/tests.html). The two in-flight golden-touching branches (#251 AA tokens, #266 dbt_project.yml panel) have been instructed to merge this main and regenerate over the merged tree before their PRs finalize. 🤖 Generated with Claude Code |
Summary
Closes #249
src/domain/checks.rsgiven_input_leafextracted the leaf relation withrfind('\'')— single-quote only. A double-quoted given input (ref("x"), which dbt accepts and both engines ship verbatim on the manifest wire, #245) lost its leaf binding entirely. The RED test showed the real blast radius is worse than the issue's stated Unknown degradation: inunion.arm-coveragea fed arm read as provably unfed and produced a false UNCOVERED nag (UncoveredvsCoveredon otherwise-identical twins). The second consumer,side_rows(thejoin.left-null-propagation/join.anti-joinfamily), mocked the side as an empty table the same way.The fix
The right-to-left scan now accepts either quote style under the same matching-quote rule as
strip_matching_quotes(PR #248): the closing quote's character determines the style, the opener must be the same character, and mixed or unbalanced pairs fail open toNone. Bothchecks.rsconsumers are fixed through the one shared helper.On the issue's Discovery question (helper placement): kept as a domain-local implementation rather than promoting
strip_matching_quotesinward — the domain scan is deliberately different machinery (right-to-left over the whole call text, tolerating trailing non-string kwargs likeref('orders', v=2)— now pinned by test), while the render-side helper strips one pre-isolated argument. Sharing would have forced a render-parser refactor well beyond this slice.TDD
union_double_quoted_given_classifies_like_its_single_quoted_twin(detector level — failed withUncoveredvsCovered { by: [...] }) andgiven_input_leaf_extracts_double_quoted_arguments(helper level).source("a", 'b')(each arg is its own string literal — engine-valid, the #245 — accept double-quoted ref()/source() given inputs in Rust parsers #248 contract), versioned-ref kwarg tolerance, and the negative family —ref("x')/ref('x")mixed pairs and unbalanced quotes all stayNone(matching thestrip_matching_quotescontract),thisand non-call shapes stayNone.Audit — other single-quote-only assumptions in the same family
Greped
src/domain/for quote handling aroundref(/source(and string-literal stripping:src/domain/checks.rsgiven_input_leaf— the only remaining in-scope site; fixed here (both call sites:arm_coverage_for_testL1049,side_rowsL1449).src/domain/cell_diff.rsunquote— already dual-quote with matching-pair semantics (pinned byunquote_strips_only_a_matching_surrounding_pair). No change.src/domain/unit_test_yaml.rsparse_yaml_scalar— already handles both YAML quote styles incl. escapes. No change.src/domain/unit_test_table.rs— single-quote logic there is SQL string-literal parsing (csv/sql fixture rows), where'is the string delimiter and"is an identifier quote by SQL semantics. Correct as-is; out of this family.src/domain/check_config.rsparse_pragma— double-quote-only by its own documented grammar (-- cute-dbt: ignore(id, "reason")), not a dbt wire shape. Out of scope.refs_display/suggested_given_sketchrenderref('…')with single quotes — output formatting, not parsing. Unchanged.JS twin (
givenOwnerLabel) was fixed in #240/PR #244; render-side Rust parsers in #245/PR #248.Dogfood (paired fixture change — the showcase rule)
No committed fixture carried a double-quoted given, so the fix would have been invisible in artifacts. Splice: both playground
mart_dq_summarytests'stg_synthea__medicationsgivens flipped toref("stg_synthea__medications")inplayground-current.jsonandplayground-baseline.json(identical on both sides, so scope/changed classification is untouched) and the paired source YAML (same-revision contract; 1:1 in-place line replacements at lines 1392/1433, both above the pr-diff showcase's@@ -1446hunks — line numbers unshifted). The sibling encounters givens stay single-quoted, so the goldens show both styles side by side.Load-bearing by construction: both feeders of the medications arm are now double-quoted, so pre-fix code renders
union[combined_metrics]as a false uncovered; the committed goldens pincovered. The existingplayground_union_with_both_arms_fed_is_covered_with_attributionintegration test and theplayground_union_arm_findingsinsta snapshot now also guard the fix on real fixture data.Goldens (all 5 regenerated per the CI matrix)
examples/playground-report.html,examples/diff-showcase-report.html,examples/explore/tests.html— delta is exclusively the quote flip (YAML drawer text + payloadinputfields,bound_to_nodestill populated,union[combined_metrics]stayscovered).examples/jaffle-shop-report.html,examples/explore/dag.html(emptygit diff --textafter regeneration).tests/fixtures/MANIFEST.toml: SHA-256s recomputed for the three changed fixtures + provenance descriptions extended with the domain: given_input_leaf single-quote-only leaf extraction — double-quoted ref() degrades arm-coverage to Unknown #249 hand-surgery note.Cross-regen protocol: this PR touches goldens — if another concurrently-merging PR also regenerates
examples/, the second-to-merge must regenerate over the merged tree.Also: the two BDD step regexes' input capture widened from
"([^"]+)"to"(.+)"so a feature line can name a double-quoted input string (trailing anchors keep the capture unambiguous; single-quoted inputs unaffected).Gates (run directly, not via lefthook)
cargo fmt --check— cleancargo clippy --all-targets --locked -- -D warnings— exit 0cargo nextest run— 1276 passedcargo test --test bdd— 163 scenarios / 1044 steps passedcargo test --test headless_zero_egress --locked -- --ignored— 10 passed;cargo test --test headless_toggle --locked -- --ignored— 71 passedRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --locked— exit 0cargo deny check— exit 0Versioning: fix → patch. No breaking change.
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
ref()andsource()calls to support both single and double quote formats.Tests