perf: skip sanitizing trusted render spans#439
Conversation
Greptile SummaryThis PR introduces a
Confidence Score: 4/5Safe to merge; the trust invariant is correctly established because The core optimization is sound. The only gap is that The two fallback return sites in Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Raw diff line / HAST node"] --> B["cleanDiffLine\n(tabify → sanitizeTerminalLine)"]
A --> C["flattenHighlightedLine\n(tabify → sanitizeTerminalLine)"]
B --> D["RenderSpan\nterminalSafe: true ✓"]
C --> D
D --> E["mergeSpan / appendRenderSpan"]
E -- "both safe" --> F["merged span\nterminalSafe: true ✓"]
E -- "mixed trust" --> G["merged span\nterminalSafe: undefined"]
F --> H["sanitizeTerminalSpans"]
G --> H
H -- "terminalSafe: true" --> I["fast path: push ref,\nskip sanitizeTerminalLine"]
H -- "no marker" --> J["slow path: run\nsanitizeTerminalLine"]
I --> K["sliceSpansWindow / wrapSpans\n(new objects via spread)"]
J --> K
K --> L["renderInlineSpans → terminal output"]
M["spansForHighlightedSourceLine\nfallback (context rows)"] -- "missing terminalSafe ⚠" --> J
|
Summary
Validation
This PR description was generated by Pi using OpenAI GPT-5