fix(ci): use path segment boundary matching to prevent prefix collisions#135
fix(ci): use path segment boundary matching to prevent prefix collisions#135
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughTrims trailing slashes from each FILTER and changes matching so a directory passes when it equals the normalized FILTER or when it is under that FILTER (DIR == FILTER or DIR starts with FILTER/), replacing the previous prefix-only check. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/config/changed-paths/action.yml`:
- Around line 131-132: The FILTER trailing-slash normalization currently strips
only one slash using "${FILTER%/}", which fails for inputs like
"init/casdoor//"; update the normalization before the comparison used in the if
condition (the block referencing DIR and FILTER and the test if [[ "$DIR" ==
"$FILTER" ]] || [[ "$DIR" == "$FILTER"/* ]]) to remove all trailing slashes from
FILTER (e.g. loop while FILTER ends with '/' repeatedly strip the trailing
slash) so FILTER becomes a canonical no-trailing-slash path before matching.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 56e1826e-e1c0-4e83-820c-28350040910b
📒 Files selected for processing (1)
src/config/changed-paths/action.yml
GitHub Actions Shared Workflows
Description
Fixes a prefix collision bug in the
changed-pathscomposite action's filter matching logic.Bug: The pattern
[[ "$DIR" == "$FILTER"* ]]matches on string prefix, not path segment boundary. This meansinit/casdoorincorrectly matchesinit/casdoor-migrations, causing the wrong filter to be applied and thebreakto skip the correct filter.Fix: Replace with path-segment-aware matching:
Now
init/casdooronly matchesinit/casdoororinit/casdoor/..., neverinit/casdoor-migrations.Type of Change
feat: New workflow or new input/output/step in an existing workflowfix: Bug fix in a workflow (incorrect behavior, broken step, wrong condition)perf: Performance improvement (e.g. caching, parallelism, reduced steps)refactor: Internal restructuring with no behavior changedocs: Documentation only (README, docs/, inline comments)ci: Changes to self-CI (workflows under.github/workflows/that run on this repo)chore: Dependency bumps, config updates, maintenancetest: Adding or updating testsBREAKING CHANGE: Callers must update their configuration after this PRBreaking Changes
None. Callers that had overlapping prefixes and worked around it by ordering
filter_pathslongest-first will continue to work. Callers that were silently affected by the collision will now match correctly.Testing
@developor the beta tagCaller repo / workflow run: To be validated on
plugin-authwithinit/casdoorandinit/casdoor-migrationsfilters.Related Issues
Related to #131 (discovered during tag comparison fix investigation).
Summary by CodeRabbit