fix: classify resolved paths correctly when the linted file is reached through a symlink #631
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 256 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.332
Real PR Conversation Timeline
1 comments
"Review active on #631"
general
weight: 0.35
thekhegay
Refs #490
When ESLint gets the linted file through a symlink (VS Code opened on symlinked worktree, its cwd and filenames are the link) and the resolver returns real paths, package root came from the symlinked filename and never contained the real resolved path. So internal files were classed external:
no-extraneous-dependenciesandordermisreported them, andno-relative-parent-importsmisreported aliasesNow
isExternalPath/isInternalPathcompare a resolved path that falls outside the package path with the real path of the package'spackage.json(cached once per package), and in that caseno-relative-parent-importstakes real path of the linted file beforepath.relative. Without symlinks nothing changes: a path inside the package returns before any fs callRan same files through real path and through a symlink with 8 resolver setups (ts legacy/next/project, node, webpack): messages that showed up only via the link went from 26 / 22 / 34 (
no-extraneous-dependencies/order/no-relative-parent-imports) to 0, real path counts are identical to master. PlainrealpathSyncat those lines, as suggested in the issue, madeno-relative-parent-importsworse (34 to 64), thats why the linted file is resolved tooNot covered:
no-cycle,no-self-import,no-restricted-paths,no-duplicatesstill miss some real reports through a symlink, same as master, andno-unresolvedfrom the issue didnt reproduce. Full suite 4037 pass<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Fixed import classification and parent-relative import checks when files or packages are accessed through symlinks. Imports are evaluated using the resolved file location, including when package metadata is symlinked.
* Corrected checks for imports that resolve within or outside a project, including aliased imports and deeply nested relative paths.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->