Skip to content

research(storage): benchmark Turso ops workload (#2257) - #2281

Merged
Sinity merged 1 commit into
masterfrom
feature/research/turso-ops-benchmark-2257
Jun 21, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/research/turso-ops-benchmark-2257

Conversation

@Sinity

@Sinity Sinity commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a representative ops.db-shaped benchmark to devtools lab probe turso and uses it to close the Turso backend-swap evaluation with a measured no-swap decision.

Problem

#2257 had enough feature-compatibility evidence to reject a direct sqlite3 to Turso swap, but it still lacked a representative Polylogue workload measurement. Without that, the issue stayed in a vague “maybe selected tier later” state instead of a concrete decision.

Solution

The Turso probe now runs two comparable local workloads over ingest-attempt, convergence-debt, and daemon-event tables:

  • SQLite WAL baseline through Python sqlite3.
  • Turso CLI/MVCC run through tursodb, with the generated SQL streamed on stdin so benchmark size is not limited by OS argument length.

The benchmark cleans SQLite/Turso sidecars before each run, records duration, row count, DB bytes, sidecar bytes, stdout/stderr, and keeps generated SQL out of persisted command metadata. The live measurement on this host was:

compatibility_blockers: python_binding, stored_generated_columns, fts5_virtual_table
sqlite_ops_workload: pass 50.524 ms, rows=7500, db=307200, sidecar=0
turso_ops_workload: pass 321.327 ms, rows=7500, db=8192, sidecar=300519

Decision: do not migrate Polylogue storage to Turso now. index.db remains blocked by stored generated columns and FTS5; embeddings.db would require a separate vector-provider experiment; ops.db is technically plausible but the representative local CLI/MVCC run does not show a reason to add a second backend yet. Keep Turso as an explicit lab probe/MCP inspection tool rather than a production dependency.

Closes #2257.

Verification

devtools test tests/unit/devtools/test_turso_probe.py -q
# 4 passed

ruff format --check devtools/turso_probe.py tests/unit/devtools/test_turso_probe.py
ruff check devtools/turso_probe.py tests/unit/devtools/test_turso_probe.py
# clean

devtools lab probe turso --json > /realm/tmp/polylogue-turso-probe-2257.json
# ok: true; blockers: python_binding, stored_generated_columns, fts5_virtual_table
# sqlite_ops_workload: pass 50.524 ms
# turso_ops_workload: pass 321.327 ms

devtools verify --quick
# exit_code: 0, run_id: 20260621T133550Z-quick-3887792-a24b9022

git push pre-push quick gate
# exit_code: 0, run_id: 20260621T141430Z-quick-4134222-2cc560f4

I also ran the default baseline:

devtools verify
# static/generated gates passed
# pytest-testmon selected 5397 tests because the seed was for a different git head
# 3592 passed, 14 failed in 36m56s, run_id: 20260621T133612Z-testmon-3892095-d0912879

Those failures are not from this branch’s two modified files. They are existing command-surface/scenario expectation drift, plus one devtools catalog invariant that already fails because lab schema compare/list/explain share devtools.schema_inspect. Focused Turso tests and the quick gates are clean.

Problem: #2257 needed a representative workload measurement before deciding whether Turso should become a Polylogue backend candidate. The existing probe exercised feature compatibility but not an ops.db-shaped write/read path.\n\nWhat changed: extend devtools lab probe turso with SQLite WAL and Turso MVCC benchmarks over ingest-attempt, convergence-debt, and daemon-event rows. The probe cleans SQLite/Turso sidecars between runs, reports file footprint and duration, and keeps generated SQL out of command metadata.\n\nVerification: devtools test tests/unit/devtools/test_turso_probe.py -q; ruff format --check devtools/turso_probe.py tests/unit/devtools/test_turso_probe.py; ruff check devtools/turso_probe.py tests/unit/devtools/test_turso_probe.py; devtools lab probe turso --json; devtools verify --quick.
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 7 minutes and 51 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 03687033-3e47-46e2-ab54-6511b0ddc51d

📥 Commits

Reviewing files that changed from the base of the PR and between 9cab703 and b7dadb3.

📒 Files selected for processing (2)
  • devtools/turso_probe.py
  • tests/unit/devtools/test_turso_probe.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/research/turso-ops-benchmark-2257

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity merged commit cb464aa into master Jun 21, 2026
11 checks passed
@Sinity
Sinity deleted the feature/research/turso-ops-benchmark-2257 branch June 21, 2026 14:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b7dadb3da4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/turso_probe.py Resolved
Comment thread devtools/turso_probe.py Resolved
Sinity added a commit that referenced this pull request Aug 19, 2026
## Summary

Deletes 5 of the 8 devtools modules the WS-C pruning ledger's tranche-1
table
listed for deletion, plus their catalog entries and tests. Three named
rows
(`dev_loop`, `mutmut_campaign`/`run_campaign`, `proof_world_real_slice`)
turned out to be live or contested on verification and are explicitly
excluded — see Problem below.

## Problem

`.agent/campaigns/2026-08-overhaul/ws-c-devtools-pruning.md` catalogs
~139
devtools modules toward a ~45k LOC / ~55 command target. Tranche 1 lists
8
"retired-workflow fossil" rows as high-confidence deletions, gated on a
per-row checklist (rule 5, "EVIDENCE BEFORE DELETION"): re-grep
`.beads-hooks/`, `.circleci/config.yml`, `.claude/hooks/`, `scripts/`,
and
`.github/workflows/*.yml` for module invocations before deleting,
because
string-keyed CLI dispatch and shell-invoked entrypoints don't show up in
an
import-graph grep (this is exactly how `pre_push_gate` and
`coverage_gate`
were wrongly flagged for deletion in the ledger's own 2026-08-18
correction
pass).

Re-running that checklist per row (the ledger's 2026-08-19 spot-check
had
already run it, but omitted `.github/workflows/*.yml` from the grep
target
list) found two more wrong entries before this PR was first opened, and
a
third was caught afterward by cold adversarial re-verification:

- **`dev_loop` (3,844 LOC + a cited product-side family in
`daemon/http.py`,
`daemon/cli.py`, `route_contracts.py`)** is not dead. It's
catalog-registered
  as `workspace dev-loop` with a large flag surface

(`--prepare`/`--launch-daemon`/`--capture-cli`/`--receiver-smoke`/etc.),
has
a 1,629-line test file, and a 757-line doc (`docs/dev-loop.md`) linked
from
`docs/README.md`'s nav — last touched by a real feature commit 5 days
before
this PR (#3333, "close remaining polylogue-5en gaps"). The ledger's
citation
("devloop workflow explicitly retired, CLAUDE.md: do not resurrect") is
a
name collision: CLAUDE.md's retirement note is about the unrelated
bespoke
  Beads/conductor-packet workflow, not this branch-local
  daemon/browser-capture preflight tool.
- **`mutmut_campaign` + `run_campaign` (624 LOC)** are two unrelated
modules
the ledger conflated by name similarity. `mutmut_campaign.py` (catalog:
  `bench mutation`) is invoked weekly by
  `.github/workflows/mutation-testing.yml` (`devtools bench mutation run
  "$campaign"`) — exactly the grep the spot-check missed by skipping
`.github/workflows/`. `run_campaign.py` (catalog: `bench synthetic`) is
a
  separate, live-tested command

(`test_benchmark_campaigns.py::test_run_campaign_skips_seed_archive_for_daemon_live`)
driving the ledger's own NEEDS-EVIDENCE/default-keep
`large_archive_generator`
+ `synthetic_benchmark_runtime` modules; it has nothing to do with
mutation
  testing.
- **AUDITED AND EXCLUDED (found by cold verification after this PR's
first
push, restored in a follow-up commit): `proof_world_real_slice` (440 LOC
+
test)**. The ledger's row cited it as belonging to the closed `jxe`
uplift
  campaign, but the module's own docstring and its test both cite
`polylogue-212.11` instead — an **open, P3** bead whose notes name this
  tool as "the harness half of the real-archive-data extension" with a
pending, unpromoted deliverable. Same name-collision failure class as
the
`dev_loop`/`mutmut_campaign` catches above, just missed on this row
during
  the original per-row pass. Restored verbatim (module, test, and the
  `demo real-slice-screen` CommandSpec) from before deletion.

All three exclusions were reported to the coordinator (the first two
before
this PR was opened, the third as soon as cold review surfaced it).

## Solution

Deletes the remaining 5 rows, each independently re-verified clean (no
hook/CI/doc/production references beyond the module's own catalog entry
and
test file):

- `claim_vs_evidence.py` + `claim_vs_evidence_evidence.py` (+ both test
  files) — the `polylogue-sru` campaign closed with terminal artifacts
  2026-07-06; this CLI re-proved an already-recorded claim. The durable
  production primitive it wrote through, `PublicClaimProjection`
(`polylogue/insights/measurement/public_claims.py`), is untouched and
lives
  independently. Trimmed `docs/findings/claim-vs-evidence.md`'s now-dead
"Reproduce"/"Regenerate" sections (they invoked the deleted command)
while
keeping the finding's substantive text as a frozen historical record —
the
2026-08-14 purge (#3950) had already retired "the closed
claim-vs-evidence
campaign's private-report/calibration/publishing harness" in spirit;
this
  PR finishes that.
- `turso_probe.py` (+ test) — Turso storage-backend research
(#2257/#2281,
June) concluded; direction settled on SQLite independence + Sinex mode.
- `resume_ranking_eval.py` (+ test) — orphan: no catalog entry, no
importers
  beyond its own test.
- `help_latency_probe.py` (no dedicated test file existed) — one-shot
  CLI-latency research; not wired into any gate.
- `temporal_read_profile.py` + `temporal_archive_aggregates.py` (+ both
test
  files) — one-shot read-profiling research (July 2).

Each deleted module's `CommandSpec` was removed from
`devtools/command_catalog.py`, then `devtools render devtools-reference`
regenerated `docs/devtools.md`. No CLAUDE.md tooling-list lines named
any of
the six deleted commands, so none needed trimming there.
`proof_world_real_slice`'s `CommandSpec` was restored to the same spot
in the
follow-up commit and `devtools render devtools-reference` re-run.

## Verification

- `devtools render all --check` — exit 0, no `out of sync` surfaces.
- `devtools verify --quick` — `"status": "success"`, `"exit_code": 0`
(run
  again after the `proof_world_real_slice` restore, still green).
- `devtools verify` (full, complete-corpus) — `"status": "success"`,
`"exit_code": 0`, `"terminal_green": true`, `"complete_corpus_covered":
  true`, `"non_green_count": 0`, `"release_baseline_allowed": true`.
- `devtools test tests/unit/devtools/test_proof_world_real_slice.py` —
20/20
  passed, confirming the restored module's tests are intact.
- `python -m devtools.verify_doc_commands` — `67 doc files scanned, no
stale
  commands` (caught and fixed one accidental literal reference to the
  now-deleted claim-vs-evidence command in the trimmed findings doc).

Anti-vacuity: pure deletion (plus one restoration); reachability
evidence per
surviving row is in the ledger plus the re-verification above (all rows
independently re-grepped against `.beads-hooks/`,
`.circleci/config.yml`,
`.claude/hooks/`, `scripts/`, `.git/hooks/`, and
`.github/workflows/*.yml`,
and cross-checked against `docs/` and git log recency).

## Bead disposition matrix

This PR does not close, claim, or otherwise mutate any Beads issue — it
is
pure code/doc deletion against the campaign's markdown ledger, not a
Beads
tracker item. `mutated_beads` is empty; using the `self_contained` scope
carrier. `polylogue-212.11` is cited as evidence for the
`proof_world_real_slice` exclusion but is not touched, claimed, or
closed by
this PR.

Candidate follow-ups for the coordinator (not closed by this PR):

| Item | Note |
| --- | --- |
| Tranche 1 revision | The ledger's tranche-1 table and its "Est. ~8.6k
LOC" total need updating to remove `dev_loop`,
`mutmut_campaign`/`run_campaign`, and `proof_world_real_slice` as
confirmed-live/contested, plus record the `.github/workflows/` gap in
the spot-check methodology so future tranches don't repeat it. |
| Tranche 2 execution | Unblocked to proceed independently; nothing in
this PR touches tranche-2 rows. |

## Verification commands run

```
devtools render all --check
devtools verify --quick
devtools verify
devtools test tests/unit/devtools/test_proof_world_real_slice.py
python -m devtools.verify_doc_commands
```
<!-- polylogue-pr-scope:v2
{
  "assigned_beads": [],
  "dispositions": [],
  "mutated_beads": [],
"scope_digest":
"79a7984a9ec80a157c96dc8d28561159c642c15de3793837eff751fa7eac34a1",
  "scope_kind": "self_contained",
  "version": 2
}
-->
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

research(storage): evaluate SQLite to Turso Database backend swap

1 participant