Atlas / Skills / tursodatabase / Debugging

DebuggingCAUTION

skills/tursodatabase/debugging

A SQL database in Rust: SQLite-compatible, now also speaking Postgres (experimental). The LLVM of databases.

Verdict
CAUTION
Grade
B
Trust score
89 /100
Version
—
Hosts
—
License
MIT
Stars
24,952
01

Overview

A SQL database in Rust: SQLite-compatible, now also speaking Postgres (experimental). The LLVM of databases.

Read from source at commit b6a8ee32ce87OBSERVED · 2026-10-22
Advertisement
02

What it tells the agent

The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.

---
name: debugging
description: How to debug tursodb using Bytecode comparison, logging, ThreadSanitizer, deterministic simulation, and corruption analysis tools
---
# Debugging Guide

## Bytecode Comparison Flow

Turso aims for SQLite compatibility. When behavior differs:

```
1. EXPLAIN query in sqlite3
2. EXPLAIN query in tursodb
3. Compare bytecode
   ├─ Different → bug in code generation
   └─ Same but results differ → bug in VM or storage layer
```

### Example

```bash
# SQLite
sqlite3 :memory: "EXPLAIN SELECT 1 + 1;"

# Turso
cargo run --bin tursodb :memory: "EXPLAIN SELECT 1 + 1;"
```

## Manual Query Inspection

```bash
cargo run --bin tursodb :memory: 'SELECT * FROM foo;'
cargo run --bin tursodb :memory: 'EXPLAIN SELECT * FROM foo;'
```

## Logging

```bash
# Trace core during tests
RUST_LOG=none,turso_core=trace make test

# Output goes to testing/test.log
# Warning: can be megabytes per test run
```

## Threading Issues

Use stress tests with ThreadSanitizer:

```bash
rustup toolchain install nightly
rustup override set nightly
cargo run -Zbuild-std --target x86_64-unknown-linux-gnu \
  -p turso_stress -- --vfs syscall --nr-threads 4 --nr-iterations 1000
```

## Deterministic Simulation

Reproduce bugs with seed. Note: simulator uses legacy "limbo" naming.

```bash
# Simulator
RUST_LOG=limbo_sim=debug cargo run --bin limbo_sim -- -s <seed>

# Whopper (concurrent DST)
SEED=1234 ./testing/concurrent-simulator/bin/run
```

## Stack Usage

Parsing and translating an expression recurse once per level of nesting, so
the stack frame size of those functions limits how deep an expression can be.
Three scripts in `scripts/stack/` measure stack use. Use a release build
(`cargo build --release --bin tursodb`): debug builds do not reuse stack slots,
so their frames say little about what users run. Run each script with `-h`
for all options.

```bash
# Frame size of each function, read from its prologue. -c compares two binaries.
scripts/stack/frame-sizes.sh 'translate::expr::'
scripts/stack/frame-sizes.sh -c /tmp/tursodb-main 'translate_expr$' 'parse_expr_inner$'

# Smallest stack that runs a SQL script, per binary. -S adds sqlite3.
scripts/stack/min-stack.sh -S -b /tmp/tursodb-main -b target/release/tursodb deep.sql

# Which functions use the stack at the deepest point (runs under lldb).
scripts/stack/stack-profile.sh deep.sql
```

Functions that recurse per level should be small. Move rare and large paths
into `#[inline(never)]` helpers, like SQLite's `SQLITE_NOINLINE`.

## Architecture Reference

- **Parser** → AST from SQL strings
- **Code generator** → bytecode from AST
- **Virtual machine** → executes SQLite-compatible bytecode
- **Storage layer** → B-tree operations, paging

## Corruption Debugging

For WAL corruption and database integrity issues, use the corruption debug tools in [scripts](./scripts).

See [references/CORRUPTION-TOOLS.md](./references/CORRUPTION-TOOLS.md) for detailed usage.
03

Trust audit

CAUTIONgrade B · trust 89/100 Install with care. The audit found things worth knowing before you trust its output.

LayerWhat it checksResult
L0Provenance & inventoryWARN
L1Static analysis of the codeNA
L2Instruction surface (what it tells the agent)PASS
L3Class-specific surfacePASS
L4Behavioural (sandbox)SKIPPED

What the source does

Filesystem
none-observed
Network
none-observed
Shell
none-observed
Dependencies
pinned
Secrets in source
none-found

Findings (5)

MEDIUMInventory / provenance · inv.symlink · CWE-1104
.claude/skills/debugging/scripts
.claude/skills/debugging/scripts
Why it matters. link not followed
MEDIUMInventory / provenance · inv.symlink · CWE-1104
.codex/skills
.codex/skills
Why it matters. link not followed
LOWInventory / provenance · inv.symlink · CWE-1104
.claude/skills/debugging/references/CORRUPTION-TOOLS.md
.claude/skills/debugging/references/CORRUPTION-TOOLS.md
Why it matters. link not followed
LOWInventory / provenance · inv.symlink · CWE-1104
CLAUDE.md
CLAUDE.md
Why it matters. link not followed
LOWInventory / provenance · inv.symlink · CWE-1104
examples/java/EncryptionExample.java
examples/java/EncryptionExample.java
Why it matters. link not followed

Gates applied: no_behavioural_pass.

Audited 2026-10-22 · audit v0.4.1 · source sha b6a8ee32ce87full audit observations/trust-audit/skill/tursodatabase__debugging.json · Report an issue / request a re-scan
04

Audit history

Every audit this skill has had.

DateSourceVerdictGradeScoreChange
2026-10-22b6a8ee32ce87CAUTIONB89first audit
05

Questions

What does the debugging — tursodatabase/turso skill do?

A SQL database in Rust: SQLite-compatible, now also speaking Postgres (experimental). The LLVM of databases.

Is debugging — tursodatabase/turso safe to install?

With care. The audit graded it B (89/100) and found 5 things worth knowing before you trust this skill, listed below with the exact line each was found on.

What can debugging — tursodatabase/turso access on my machine?

The audit observed no filesystem, network or shell use at all in its source.

How current is this page?

The grade is for one exact copy of the source (b6a8ee32ce87), read on 2026-10-22. The repository is watched, and a new audit runs when it changes — this is the first audit.

Add this badge to your README

Shows this page's audit result and links back to it. It updates when the audit does.

ModelsAtlas audit badge

Markdown
[![ModelsAtlas audit: Debugging](https://modelsatlas.com/skills/tursodatabase/debugging/badge.svg)](https://modelsatlas.com/skills/tursodatabase/debugging/)

Not your listing, or something out of date? Claim or update your listing.

Advertisement