fix(oxide): simplify @source pattern handling and ensure gitignore negation#19879
fix(oxide): simplify @source pattern handling and ensure gitignore negation#19879JBR-0100 wants to merge 2 commits intotailwindlabs:mainfrom
Conversation
WalkthroughThis pull request introduces two modifications. First, an HTML comment line is appended to README.md after the Contributing section. Second, in 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/oxide/src/scanner/mod.rs (1)
664-668: Add a regression test for ignored parent directories.Please add a focused scanner test where a directory is git-ignored but an explicit
@sourcepattern inside it is still discovered. This is the key behavior this block now guarantees and should be locked in.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/oxide/src/scanner/mod.rs` around lines 664 - 668, Add a unit test in the scanner module that verifies a git-ignored parent directory still yields an explicit `@source` inside it (the behavior enabled by the ignores.entry(base).or_default().insert(format!("!{}", pattern)) change). Create a test (e.g., test_ignored_parent_with_explicit_source) that sets up a directory listed in .gitignore, places a file inside containing an explicit `@source` pattern, runs the scanner entry point used by other tests (the same function that discovers sources in mod.rs), and assert that the explicit source is discovered; keep it focused and minimal to lock in the precedence behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Line 37: Remove the non-functional HTML comment "<!-- Auto-generated
contribution -->" from README.md (line with that exact string) or replace it
with a brief explanatory sentence if it is meant as a placeholder for generated
content; update the README by deleting that comment or adding a one-line note
such as "This section is auto-generated" so the purpose is documented and the
unrelated comment no longer appears in the commit.
---
Nitpick comments:
In `@crates/oxide/src/scanner/mod.rs`:
- Around line 664-668: Add a unit test in the scanner module that verifies a
git-ignored parent directory still yields an explicit `@source` inside it (the
behavior enabled by the ignores.entry(base).or_default().insert(format!("!{}",
pattern)) change). Create a test (e.g.,
test_ignored_parent_with_explicit_source) that sets up a directory listed in
.gitignore, places a file inside containing an explicit `@source` pattern, runs
the scanner entry point used by other tests (the same function that discovers
sources in mod.rs), and assert that the explicit source is discovered; keep it
focused and minimal to lock in the precedence behavior.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: df1b1ff5-229a-41ac-97ac-c22ef30a1574
📒 Files selected for processing (2)
README.mdcrates/oxide/src/scanner/mod.rs
| ## Contributing | ||
|
|
||
| If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindlabs/tailwindcss/blob/main/.github/CONTRIBUTING.md) **before submitting a pull request**. | ||
| <!-- Auto-generated contribution --> |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Verify whether this PR actually includes the oxide scanner changes from the objective.
BASE_REF="${BASE_REF:-origin/main}"
echo "Changed files vs ${BASE_REF}:"
git diff --name-only "${BASE_REF}...HEAD"
echo
echo "Scanner file diff (if present):"
git diff "${BASE_REF}...HEAD" -- crates/oxide/src/scanner/mod.rs || trueRepository: tailwindlabs/tailwindcss
Length of output: 157
🏁 Script executed:
# First, check if README.md exists and examine line 37
if [ -f README.md ]; then
echo "=== README.md line 37 (with context) ==="
sed -n '30,45p' README.md
else
echo "README.md not found"
fi
echo
echo "=== Check for oxide/scanner references ==="
find . -type f -name "*.rs" -path "*/oxide/*" 2>/dev/null | head -20 || echo "No oxide Rust files found"
echo
echo "=== Repository root structure ==="
ls -la | head -20Repository: tailwindlabs/tailwindcss
Length of output: 2815
🏁 Script executed:
# Check if scanner/mod.rs exists
if [ -f ./crates/oxide/src/scanner/mod.rs ]; then
echo "=== scanner/mod.rs EXISTS ==="
wc -l ./crates/oxide/src/scanner/mod.rs
else
echo "=== scanner/mod.rs NOT FOUND ==="
fi
echo
echo "=== Search for scanner directory ==="
find ./crates/oxide -type d -name "scanner" 2>/dev/null || echo "No scanner directory found"
echo
echo "=== Check git status of current branch ==="
git status
echo
echo "=== List changed files in current branch ==="
git diff --name-only HEAD~1 HEAD 2>/dev/null || echo "Cannot determine single commit diff"
git log --oneline HEAD~3..HEAD 2>/dev/null || echo "Cannot access commit log"Repository: tailwindlabs/tailwindcss
Length of output: 607
🏁 Script executed:
# Examine FETCH_HEAD state
echo "=== FETCH_HEAD details ==="
git show --stat HEAD 2>/dev/null | head -50 || echo "Cannot show HEAD"
echo
echo "=== Try git reflog to see recent operations ==="
git reflog 2>/dev/null | head -20
echo
echo "=== Check if we can see FETCH_HEAD commit ==="
git log -1 --format="%H %s" FETCH_HEAD 2>/dev/null || echo "Cannot access FETCH_HEAD"
echo
echo "=== Check file modification times ==="
stat README.md | grep -E "Modify|Access"
stat ./crates/oxide/src/scanner/mod.rs | grep -E "Modify|Access"
echo
echo "=== Quick check: what's in the PR by examining working directory ==="
# See if there are any uncommitted changes
git diff HEAD 2>/dev/null | head -100Repository: tailwindlabs/tailwindcss
Length of output: 3606
🏁 Script executed:
# Get the full file list for this commit
echo "=== Full changed files in this commit ==="
git show --name-only 20a621a49e90d90aeeb654e82c9c01cba7cbf0dc | tail -200
echo
echo "=== Check if scanner/mod.rs was modified ==="
git show 20a621a49e90d90aeeb654e82c9c01cba7cbf0dc -- crates/oxide/src/scanner/mod.rs | head -100
echo
echo "=== Check README.md changes ==="
git show 20a621a49e90d90aeeb654e82c9c01cba7cbf0dc -- README.mdRepository: tailwindlabs/tailwindcss
Length of output: 14614
Remove this non-functional HTML comment from README.md line 37.
The <!-- Auto-generated contribution --> comment is non-functional and unrelated to the oxide scanner fix objective. While it was bundled with the scanner changes in this commit, it should either be removed or its purpose should be documented. If this is intended as a placeholder for generated content, clarify its use.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@README.md` at line 37, Remove the non-functional HTML comment "<!--
Auto-generated contribution -->" from README.md (line with that exact string) or
replace it with a brief explanatory sentence if it is meant as a placeholder for
generated content; update the README by deleting that comment or adding a
one-line note such as "This section is auto-generated" so the purpose is
documented and the unrelated comment no longer appears in the commit.
|
Hey! I appreciate the PR, but would love to see an actual issue it solves (by opening an issue and/or adding tests first). Also please don't add unnecessary things to PRs such as the auto-generated contribution comment. Going to close this for now, but if you still want to PR something like this, let's open an issue first so we have a record of something that's actually wrong today. Thanks! |
This PR simplifies the pattern handling in the Oxide scanner. Previously, complex logic for guessing patterns could fail to correctly whitelist files in git-ignored directories. By consistently prefixing all @source patterns with '!' in the internal Gitignore builder, we ensure they are always discovered even when buried in ignored paths.