← Back to Pull requests

fix(first): keep code parsable after the autofix with decorators and no semicolons #600

Closed
unknown closed this pull request without merging on Nov 09, 2026 04:50 UTC
View on GitHub
unknown unknown commented on Nov 08, 2026 09:51 UTC
Author

Autofix of first can leave code that doesn't parse, seen on 4.18.0

Decorated export class as first statment. Range of export starts after decorators, so import is put between decorator and export:

@Component({ selector: 'x' })
export class X {}
import a from 'a'
// =>
@Component({ selector: 'x' })
import a from 'a'
export class X {}

Import without semicolon on line of other statement keeps that line, and without ; only line break ends it:

foo(); import a from 'a'
// => import a from 'a' foo();

Same with import b from 'b' above and foo(); import a from 'a'; below, moved import is glued after b

And when legal import shares line with code, like import b from 'b'; foo(), moved import without ; lands right before foo() on that line

Now insert goes before decorators, moved import gets its own line when code it follows has no ;, and line break after it when code folows on same line. Imports with semicolons on one line stay as before, existing cases are not changed

Fuzz over 1425 generated files: 148 broken outputs on master, 10 with this, no output changed where master was fine. Those 10 are other case wich I didn't touch here: import with code after it on its line, like import a from 'a'; bar() under foo(), removal still glues foo() bar()

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

Summary by CodeRabbit

Bug Fixes
Fixed an autofix issue that could produce unparseable code when moving imports around decorated class declarations or imports without semicolons.
Improved import placement and line-break preservation when multiple imports share a line.
Import movement now preserves valid ordering around exported and default-exported decorated classes, including when statements are separated by semicolons or line breaks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 244 lines (+183 / -61) across 3 files Reviewer: thekhegay Review duration: 1138m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 244 lines diff across 3 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
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
Diff Size diff_size
0.329
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #600"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% 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: 38.8% (MEDIUM) · Higher = larger blast radius
38.8%
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: 60.5% · Lower = rushed or shallow review
60.5%
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: 15.3% · Safe to merge
15.3%