test: wildcard matching + config markdown sanitization#408
test: wildcard matching + config markdown sanitization#408anandgupta42 wants to merge 2 commits intomainfrom
Conversation
Add edge-case tests for Wildcard.match (security-critical permission matching) and ConfigMarkdown.fallbackSanitization/shell() (YAML frontmatter recovery). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> https://claude.ai/code/session_01ArGQ4moupZc4ZY6pwjMVTj
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review.
Tip: disable this comment in your organization's Code Review settings.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo test files now include expanded test coverage: ConfigMarkdown methods ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 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 |
|
Superseded by #439 which consolidates all 12 test PRs into one, deduplicates overlapping tests, and fixes bugs found during review. |
What does this PR do?
1.
Wildcard.match,Wildcard.all,Wildcard.allStructured—src/util/wildcard.ts(7 new tests)This module powers the entire permission system —
PermissionNext.evaluatecallsWildcard.matchfor both permission names and file patterns. Existing tests covered basic matching and command patterns but missed several edge cases. New coverage includes:*matches across/boundaries (diverges from shell glob semantics intentionally —src/*must matchsrc/deep/nested/file.tsfor permission patterns to work)$,^in patterns are treated as literals, not regex metacharacters. A bug here could allow pattern injection attacks.allStructured:matchSequencescans non-contiguously —git push extra --forcematches patterngit push --forcebecause tokens are matched in order but not required to be adjacent. This is the actual behavior the permission system relies on.git --force pushdoes NOT matchgit push --forcebecause after findingpushat the end, no items remain for--force2.
ConfigMarkdown.fallbackSanitization+ConfigMarkdown.shell—src/config/markdown.ts(14 new tests)These functions had zero test coverage.
fallbackSanitizationis the YAML recovery path whengray-matterfails to parse frontmatter from other tools (e.g., Claude Code's CLAUDE.md files with unquoted URLs containing colons).shell()extracts!backtick`` shell commands from skill templates. New coverage includes::(like URLs) are converted to YAML block scalars (|-)>and|markers pass through without double-wrapping\r\nin frontmatter is handled by the regex!git status`` syntax, pipes/flags in commands, no false positives on regular backticks or empty bang-backticksType of change
Issue for this PR
N/A — proactive test coverage from
/test-discoveryHow did you verify your code works?
Checklist
https://claude.ai/code/session_01ArGQ4moupZc4ZY6pwjMVTj
Summary by CodeRabbit