Repository navigation
#183 — Windows-style path separators in PR-diff path matching - #190
Conversation
A dbt manifest compiled on Windows serializes original_file_path from a native PathBuf verbatim -- backslash-separated (dbt-fusion crates/dbt-schemas/src/schemas/manifest/manifest_nodes.rs @ 9977b6cb; no slash normalization at serialization, and fusion's own dbt_common::path::path_separator_eq treats / and \ as equivalent). git diff, by contrast, emits /-separated repo paths on every platform (index/tree entry path names are stored with / -- git/git Documentation/gitformat-index.adoc @ 1ff279f34). Without canonicalization a Windows-compiled manifest never matched the diff keyset and PR-diff scoping silently missed. normalize_path now canonicalizes backslash to / as Step 0, applied to the path and the strip prefix, so every later step (./ strip, prefix strip, separator-run collapse) sees one separator vocabulary. The single normalization authority (NormalizedDiffIndex) normalizes both the diff-side keyset and the declaring-side lookups through it, so the fix covers both directions. tests/path_matching.rs gains backslash-separator mirrors of every / case shape (mutation-kill parity); src/domain/path.rs joins the cargo-mutants examine_globs (it was extracted from scope.rs at #96 with its dedicated kill suite but never re-added to the focused scope). Bounded mutation run over domain/path.rs: 13/13 caught. The tracked: cute-dbt#183 deferral comments at both exclusion sites are resolved into the canonicalization docs (exclusions rule). Closes #183 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds Windows path separator canonicalization to the path normalization module. Backslash separators are converted to forward slashes as the first normalization step, enabling consistent path matching across platforms. Implementation includes updated documentation, comprehensive test coverage for both inline validation and mutation kill, and configuration updates. ChangesWindows Path Canonicalization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
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 |
|
Ready to review this PR? Stage has broken it down into 3 individual chapters for you:
Chapters generated by Stage for commit 61f7e89 on Jun 10, 2026 10:38pm UTC. |
📄 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 27310909030 -R breezy-bays-labs/cute-dbt -n report-preview-playground
open report-preview-playground/playground-report.htmlPosted by |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Code Review
This pull request introduces Windows-style path separator canonicalization to forward slashes in path normalization and matching, addressing compatibility issues with Windows-compiled dbt manifests. It also includes comprehensive unit and integration tests to prevent regressions. The review feedback suggests optimizing the path normalization function to avoid a redundant heap allocation when handling Windows paths.
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.
Closes #183
Summary
normalize_pathnow canonicalizes Windows-style\separators to/as Step 0 (applied to the path and the--project-rootstrip prefix), closing a one-sided real gap: a dbt manifest compiled on Windows carries\-separatedoriginal_file_pathwhilegit diffemits/on every platform — so a Windows-compiled manifest silently missed PR-diff scoping. The fix lives in the domain's single normalization authority, so both the diff-side keyset and the declaring-side lookups (NormalizedDiffIndex) are covered.Step-0 findings (research dbt-fusion source first)
Pinned to dbt-fusion commit
9977b6cbb1b761065536300037560d8e3c037011(currentmain, same SHA as prior pins):/or\inoriginal_file_path? →\. Fusion typesoriginal_file_path: PathBufin the manifest node PODs (crates/dbt-schemas/src/schemas/manifest/manifest_nodes.rslines 93/121/288;crates/dbt-schemas/src/schemas/nodes.rsCommonAttributesline 4460) with noserialize_with/slash normalization — serde emits the nativePathBufverbatim, and on Windows those paths are built with\. Fusion itself confirms the divergence is real:dbt_common::path::path_separator_eq(crates/dbt-common/src/path.rs) compares strings "treating/and\as equivalent", used incrates/dbt-adapter/src/time_machine/serde.rs:169-174to "Normalize path separators so recordings made on Linux (/) match replay on Windows (\)". Noto_slash-style normalization exists anywhere in the repo.git diffon Windows emit/? → Yes. Git stores index/tree entry path names with/as the path separator on every platform (git/gitDocumentation/gitformat-index.adoclines 130–133 @1ff279f3404a482a83fb04c7457e41ab26884aea); diff headers print the stored names.So the gap is one-sided (manifest
\vs diff/) — not docs-only. Canonicalizing\→/innormalize_pathmirrors fusion's own/≡\equivalence semantics. A Unix filename containing a literal\is therefore misread — accepted deliberately and documented (fusion's own path equality already conflates the two).Acceptance criteria
normalize_pathtreats\and/equivalently — Step-0 canonicalization in the domain (the single-normalization-authority arm, stronger than a boundary-only doc), applied to both the path and the strip prefix. Module docs carry the full source-pinned canonicalization rationale.tests/path_matching.rsgains\-separator cases with mutation-kill parity — every/case shape has a mirrored\case (12normalize_pathmirrors + 7match_changed_pathmirrors, incl. the real-world\-manifest ↔/-diff bridge, the segment-aware-prefix guard, the substring-collision guard, and mixed-separator inputs). Boundedcargo mutantsoversrc/domain/path.rswith kill detection restricted to the dedicated kill suite + lib unit tests: 13/13 caught (including all 4canonicalize_separatorsreplacement mutants).src/domain/path.rsalso joins.cargo/mutants.tomlexamine_globs— it was extracted fromscope.rsat feature: block-precise PrDiff updated-test detection + inline YAML diff #96 with its kill suite but never re-added to the focused scope.tracked: cute-dbt#183deferral comments insrc/domain/path.rs(module doc + fn doc) andtests/path_matching.rsare resolved into the canonicalization documentation (exclusions rule — no live deferral pointers remain; verified by grep).Gates (run directly — lefthook skips in fresh worktrees)
cargo fmt --check— cleancargo clippy --all-targets --locked -- -D warnings— exit 0, no issuescargo nextest run— 911 passed, 32 skippedcargo test --test bdd— 96 scenarios / 607 steps passedRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --locked— exit 0cargo deny check— advisories/bans/licenses/sources okcargo llvm-cov nextest+crap4rs --config crap4rs.toml --coverage lcov.info— PASS, 0/1305 functions above threshold (worst 23.0)git diff --text -U0 -- examples/emptycargo mutants(bounded, path module only): 13 mutants tested, 13 caughtTests are platform-independent string-level normalization cases — no filesystem dependence (no
create_dir_all-class macOS/Linux divergence risk).🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests