fix(no-restricted-paths): resolve glob `except` patterns against `basePath` #626
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 267 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.334
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #626"
general
weight: 0.35
thekhegay
Closes #615
targetandfromare resolved againstbasePathbefore matching, but globexceptpatterns were matched as written against the absolute import path. So:./src/lib/allowed/never matched anything, so the exception did nothing(e.g./lib/allowed/) stopped matching once the project lived under a dot-directory like~/.worktrees/project, because minimatch'sskips dot segmentsNow each glob exception is matched both as written (as before) and resolved with
path.resolve(basePath, except), the same asfrom. Matching both keeps every pattern that worked before working, e.g./two/whenfrompoints outsidebasePath(../server//). A leading!is taken off before resolving and applied to the result, so!/three/still means "not under three".Tests:
except: ['./test/fixtures/restricted-paths/server/two/']with a globfrom(fails onmain)basePathandfrom: 'server//',except: ['server/two/'](fails onmain)except: ['/two/']withbasePath= client andfrom: '../server//'(works onmain, guards against resolving only)except: ['!/three/'](negation kept)The docs now say glob exceptions are resolved against
basePath. Added a patch changeset.yarn test(3976) andyarn lintpass.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Fixed
no-restricted-pathsso glob-based exceptions are matched both as written and relative to the configured base path.Improved support for negated exception patterns, including repeated
!characters, so they do not incorrectly exempt restricted imports.Exception matching now includes dotfiles.
Documentation
* Clarified that glob-based exceptions are matched as written and relative to the configured base path.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->