← Back to Pull requests

Zero width trivia #221

Open
bit-aloo opened this pull request with 20 lines diff across 2 files
View on GitHub
bit-aloo bit-aloo commented on Sep 27, 2026 12:43 UTC
Author

We allow rowan to include zero width trivia. These are needed to mark element boundaries, helping us determine whether certain post edit heuristics should be applied. Roslyn uses a similar concept with zero width trivia whcih they call elastic triva to mark locations where formatting may be applied.

Diff: 20 lines (+12 / -8) across 2 files Reviewer: ChayimFriedman2 Review duration: 16925m
All Vouch review confidence checks passed
Residual risk 0.02 = Change Risk (0.23) × (1 − Review Confidence (0.90)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.23 · 20 lines diff across 2 files
0.23
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.92 · 3 substantive comment(s)
0.92
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
90%
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.182
Real PR Conversation Timeline
5 items
ChayimFriedman2 ChayimFriedman2 approved these changes on Oct 07, 2026 10:03 UTC
Approved Reviewer

This will mess with TokenAtOffset::Between. Do you think we should skip zero-len tokens there (meaning the tokens won't necessarily be consecutive siblings), or keeping them as one side (which might not be what code expects)? If they are only used after editing, then this is probably not a problem - do we edit for permanent trees (i.e. outside assists and for viewing)?

bit-aloo bit-aloo commented on Oct 08, 2026 16:56 UTC
Author

This will mess with TokenAtOffset::Between. Do you think we should skip zero-len tokens there (meaning the tokens won't necessarily be consecutive siblings), or keeping them as one side (which might not be what code expects)? If they are only used after editing, then this is probably not a problem - do we edit for permanent trees (i.e. outside assists and for viewing)?

We already skip empty children in TokenAtOffset, so the tokens in between aren't necessarily consecutive siblings, and that's fine. Yup, these markers are introduced by the editing layer (make tokens and the editor's remove/splice operations) and only exist in temporary trees. We do edit trees outside assists too, I guess during expansion, and some pretifying macro, but none of those trees are persisted. I think we convert them to tt, so ya no permanent tree.

ChayimFriedman2 ChayimFriedman2 commented on Oct 08, 2026 17:42 UTC
Contributor

We didn't have any empty tokens in r-a until this.

ChayimFriedman2 ChayimFriedman2 commented on Oct 08, 2026 17:42 UTC
Contributor

Also I think there was some rowan API which could panic with empty tokens, I need to remember which.

Assignees
bit-aloo bit-aloo
Labels
risk: low confidence: 90.3% 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: 22.7% (LOW) · Higher = larger blast radius
22.7%
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: 90.3% · Lower = rushed or shallow review
90.3%
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: 2.2% · Safe to merge
2.2%