DevTools & Observability

Solid Native treats debugging as a first-class runtime contract: every native tap can be traced through Solid's reactive graph to the exact Fabric commit, platform mount, and vsync frame—and inspected live on device.

Mount DevelopmentRoot#

tsx
/** @jsxImportSource @solidnative-dev/core */
import { DevelopmentRoot } from "@solidnative-dev/devtools/root";
import {
  createCausalTelemetry,
  createCausalTimeline,
} from "@solidnative-dev/observability";
import {
  getNativeHostBinding,
  startNativeApplication,
} from "@solidnative-dev/runtime";
import { CORE_COMPONENT_DESCRIPTORS } from "@solidnative-dev/core";
import { App } from "./App";

const causalTimeline = __DEV__
  ? createCausalTimeline({ capacity: 2_000 })
  : undefined;
const telemetry = causalTimeline
  ? createCausalTelemetry({ sink: causalTimeline.sink })
  : undefined;

let app: Awaited<ReturnType<typeof startNativeApplication>> | undefined;

void startNativeApplication(
  () => (
    <DevelopmentRoot
      causalTimeline={causalTimeline}
      snapshotTree={() =>
        app && !app.root.disposed ? app.root.snapshotTree() : undefined
      }
      measureTreeNode={(handle) =>
        app && !app.root.disposed
          ? app.root.measureNodeByHandle(handle)
          : undefined
      }
    >
      <App />
    </DevelopmentRoot>
  ),
  {
    binding: getNativeHostBinding(),
    descriptors: CORE_COMPONENT_DESCRIPTORS,
    surface: { name: "main" },
    telemetry,
  },
).then((started) => {
  app = started;
});

What's built in#

  • On-device DevTools HUD: floating badge opens tabs for Causal, UI Tree, Network, and Errors directly on iOS and Android devices.
  • Visual UI Tree highlight overlay: select any element (or text leaf) in the UI Tree inspector and tap Highlight on screen to measure live Fabric screen bounds (measureNodeByHandle) and draw a translucent highlight frame + dimensions banner over the running app.
  • Bidirectional causal cross-links: jump straight from a UI Tree node to the causal operations that created or updated it, and back.
  • Privacy-safe by default: causal telemetry records structural IDs, static computation names, and timing—never user text, input values, credentials, or URLs.
  • Zero production overhead: Metro resolves @solidnative-dev/devtools/root to a pass-through shim in release bundles, enforced by the production source-map gate.

Causal chain model#

text
native input
  -> Solid event handler & reactive flush
  -> coalesced renderer transaction
  -> Fabric host commit & shadow-tree revision
  -> UI-thread mount
  -> next CADisplayLink / Choreographer frame

Exporters & CLI capture#

Connect causal telemetry directly to OpenTelemetry or Sentry with bounded active spans and zero sensitive payload capture:

ts
import {
  createCausalTelemetry,
  createCausalTelemetryFanout,
  createOpenTelemetryCausalExporter,
  createSentryCausalExporter,
} from "@solidnative-dev/observability";

const otel = createOpenTelemetryCausalExporter({ tracer });
const sentryExporter = createSentryCausalExporter({ sentry });
const telemetry = createCausalTelemetry({
  sink: createCausalTelemetryFanout({
    sinks: [otel.sink, sentryExporter.sink],
  }),
});

Inspect live device traces, UI trees, and Hermes stack traces from the CLI:

sh
# Capture a causal trace or UI tree snapshot from a connected device
sn debug capture-ios dev.myapp --device DEVICE_ID
sn debug tree-android dev.myapp --serial DEVICE_SERIAL

# Generate a readable report or symbolicate a Hermes crash stack
sn debug report trace.json --tree tree.json
sn debug symbolicate index.ios.bundle.map --stack crash.txt