Debug IR
Debug IR (Debug Intermediate Representation) is the structured format Limelight uses to represent runtime analysis. Think of it like an AST for debugging — a machine-readable, token-efficient representation of what happened, why it happened, and what to do about it.Why not raw logs?
Raw logs and network traces are noisy, unstructured, and expensive for AI to parse. A single debugging session might produce thousands of events. Dumping all of that into an LLM’s context window wastes tokens and produces worse results. Debug IR solves this by:- Correlating raw events into causal chains before the AI sees them
- Detecting known anti-patterns automatically (so the AI doesn’t have to)
- Anonymizing sensitive values (passwords become
[string, 12 chars]) - Structuring output as typed JSON with consistent schemas
- Ruling out non-causes (so the AI doesn’t chase false leads)
What’s in a Debug IR analysis
Correlation Engine
The correlation engine is what transforms a flat list of runtime events into a connected graph of cause and effect.How it works
When you ask Limelight to investigate an error or analyze a component, the correlation engine:- Collects candidate events in a time window around the target
- Analyzes relationships between events using timing, trace IDs, component hierarchy, and state flow
- Scores each relationship with a confidence value
- Classifies edges by type:
| Edge Type | Meaning | Example |
|---|---|---|
TRIGGERED | Direct causation | Network response → setState |
CONTRIBUTED | Contributing factor | Slow API → component timeout |
FOLLOWED | Temporal sequence, likely related | Login → redirect → dashboard render |
EVIDENCE | Context for understanding | Console warning logged near the error |
- Builds a correlation graph with the target event at the center and related events as nodes
What makes this different from DevTools
Browser DevTools shows you individual events in isolated panels — network tab, console tab, components tab. You mentally correlate them yourself. Limelight does this correlation automatically:- A failed network request is linked to the error log it produced, the state update it prevented, and the component that’s now showing stale data
- A slow re-render is linked to the prop change that caused it, the state update that changed the prop, and the network response that triggered the state update
Causal Chains
A causal chain is an ordered sequence of events that explains how a problem occurred. It’s the core output of the Debug IR pipeline.Example: “Why is checkout failing?”
How chains are built
- Start from the target event (the error, the slow render, the failed request)
- Walk backwards through the correlation graph following high-confidence edges
- Walk forwards to see the downstream effects
- Include only events that are causally relevant (not everything that happened to occur nearby)
- Order chronologically and annotate each step
Event Types
Limelight captures four types of runtime events:Network Requests
Everyfetch and XMLHttpRequest with full request/response data, timing, status, and automatic GraphQL detection. Failed requests (4xx, 5xx, network errors) are flagged automatically.
Console Logs
Allconsole.log, .warn, .error, .info, and .debug calls with timestamps, source detection, and stack traces for errors.
Component Renders
React component render profiles captured from the Fiber tree — render count, cost (ms), velocity (renders/sec), cause breakdown (props vs state vs context vs parent), and changed props with reference stability analysis.State Updates
Zustand and Redux store changes with action names, changed keys, and shallow diffs. State values are type-described by default for privacy.Anti-Pattern Detection
The engine automatically detects these runtime anti-patterns:N+1 Queries
N+1 Queries
Multiple identical or near-identical network requests fired in rapid succession. Common when a list component fetches data per item instead of batching.
Render Loops
Render Loops
A component re-rendering at unsustainable velocity — often caused by a state update inside a
useEffect without proper dependencies.Race Conditions
Race Conditions
Out-of-order responses where a slower request’s response overwrites the result of a faster, more recent request. Classic search-as-you-type bug.
Unstable Props
Unstable Props
Props that change reference on every render (inline objects, arrays, or callbacks) causing unnecessary child re-renders. Detected by comparing prop reference stability across renders.
Render Cascades
Render Cascades
A parent component re-render that triggers a deep chain of child re-renders. Often caused by context changes or lifting state too high.
Retry Storms
Retry Storms
Rapid repeated requests to the same endpoint, often caused by error handlers that retry without backoff.
Stale Closures
Stale Closures
Event handlers or callbacks that capture outdated state values. Detected when a handler references state that has since changed.
State-Render Loops
State-Render Loops
A circular dependency where a state update triggers a render, which triggers another state update. Critical severity — can crash the app.