← Back to Pull requests

feat(namespace): check heritage clauses against JSDoc types of JavaScript modules #632

Open
unknown opened this pull request with 213 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 12, 2026 10:06 UTC
Author

Closes #592

Since #567 heritage clauses (interface X extends ns.Foo, class Y implements ns.Foo) skip JavaScript modules entirely, so typo in member of JS module isnt caught there. Now a non TS module (JS, or .mdx and such with their configured parser) is checked against its exports plus @typedef / @callback names from JSDoc comments of its AST, each read with existing parseComment, so no new dependency (question from the #567 thread). Names are read lazily, only when such clause hits such module, and cached per module

To avoid new false positives it still skips modules whose types may come from elsewhere: anything under node_modules (own .d.ts, @types) and modules with export . A .d.ts next to module is resolver job, TS resolver already picks it over .js

Two #567 valid cases (ns.T from named-exports.js, b.T through deep/a) name nothing there, so they are invalid now, thats the precision coming back. Full suite 4033 pass

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->

Summary by CodeRabbit

New Features
The import-x/namespace rule recognizes JSDoc @typedef and @callback declarations in local JavaScript modules when validating names used in heritage clauses.
Missing names are reported when they are neither exported nor declared with a supported JSDoc tag. Package modules and modules using export are excluded from this validation.
Documentation
* Updated the rule documentation to explain the JSDoc checks, exclusions, and how declaration-file selection depends on the resolver.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 213 lines (+159 / -54) across 2 files Reviewer: thekhegay Review duration: 3033m
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.37) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 213 lines diff across 2 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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.321
Real PR Conversation Timeline
1 comments
"Review active on #632"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.6% (MEDIUM) · Higher = larger blast radius
36.6%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 19.5% · Safe to merge
19.5%