GeezerVison is showing github.com — docs: Scaler-era Atlas/Turso data architecture revision by dezren39 · Pull Request #5667 · developing-today/code
Conversation
dezren39
commented
Nov 4, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Design revision ordered by Drew 2026-11-04 alongside the Turso Scaler signup. Companion to the atlas binary/service design note (epic #5350) and to dezren39/hatch-personal#20 / #21 — this note revises the data side; the binary/service design stands.
Covers:
- Write anatomy — what a write is on production atlas (single-writer queue on the libSQL primary) and why one insert took 1,345 s server-side: facts F1–F5 vs hypotheses H1–H3, incl. the correction that Turso's docs claim index backfill does happen — our observed 0-row shadow after CREATE INDEX and after a 75-min REINDEX is an observed hosted defect/limit, with a cheap scratch-table distinguishing test named.
- Config audit C1–C8 — 160,576 B/row index shadow (full index ≈ 17.3 GB; post-build total ≈ 22.1 GB vs 24 GB Scaler included), legacy BGE table, location topology (verified: single us-east-1 primary — nothing to trim), scan-as-default, serve-role gap.
- Caching — query-embedding cache (pure function of text+model, no TTL) and snapshot-keyed result cache, plus
--no-cache, --wait, --expand N, --raw.
- Two-tier architecture — staging tier partitioned by work unit with a versioned schema and merge-on-close aggregator; core tier partitioned first by exactly three physical sensitivity levels (public/internal/secret, default internal), topic within level, mechanical row-move reclassification.
- Sharding math — 18.1k rows/s per DB scan stream, ≤250 ms/shard budget → ~4,500 chunks/shard (~24 shards today), topic-first partitioning, hash only inside a hot partition, split-index build parallelism, embedded replicas on the laptop and the 24 GB sync-budget check.
- Engine verification — production atlas is libSQL (
turso db show: Type SQLite, 4.8 GB); the concurrent-writer engine (TursoDB) is a separate opt-in DB type in early preview, no in-place conversion — pilot proposed for the registry + embedding-cache DBs only.
- Wider strategy — Supabase stays system of record (Phase A); lab k8s Postgres as the large central store (Phase B); small managed fallback subset (Supabase + Neon); Oracle-runnable variant kept real by standard-Postgres + versioned-schema portability rules.
- Migration backlog — every Atlas/search/embedder script outside this repo inventoried with its destination here / in the fleet binary.
Appendix A measurements (2026-11-04): with the #20 index rewrite in flight (11,700/97,139 rows at 15:02 CST, 1.01 rows/s, ETA ≈ Nov 5 14:30 CST), production search measured 582.9 s cold / warm DNF vs Gate B's 18.5–21.9 s this morning with the rewrite idle — hypotheses and the post-rewrite distinguishing test are in the doc. The scratch write probe was skipped by rule (rebuild in flight); current write evidence = the 01:24 CST probe (0.2–0.9 s/step) + rewrite batch timings.
Open questions for Drew are in Appendix B (C1 spike priority, TursoDB dashboard toggle, shared embedding-cache DB).
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Design revision for the Turso Scaler plan: write-path anatomy of the
1,345 s insert (hatch-personal#20), config audit, query-embedding +
snapshot-keyed result caching with --no-cache/--wait/--expand/--raw,
two-tier staging/core architecture (three physical sensitivity levels),
sharding math, engine verification (libSQL today; TursoDB preview
pilot), wider Supabase/lab-Postgres strategy, and the code migration
backlog. Companion to the atlas binary/service design (epic #5350).
coderabbitai
Bot
commented
Nov 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 20 seconds.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a933a0b3-02b6-4938-83ce-d8a851d6dfb2
Commits
-
Reviewing files that changed from the base of the PR and between af0847d and f600d09.
Files selected for processing: 1
-
doc/2026-11-04T21-27-34Z_design_atlas_scaler_revision/2026-11-04T21-27-34Z_design_atlas_scaler_revision.md
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-05T01:51:16.664714Z |
f600d09 |
New commits |
ℹ️ 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" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 4, 2026
There was a problem hiding this comment.
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: b975daa74b
ℹ️ 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".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+179
to
+181
|
|
- **Key:** `sha256(query_text || snapshot_id || ceiling || flags)`.
|
|
|
- **Reuse rule:** while the snapshot id is unchanged, a cached result is
|
|
|
*correct*, not merely fresh — return it as-is.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include the authorized corpus set in result-cache identity
When two clients have the same sensitivity ceiling but access to different corpora, this key gives identical requests the same cache entry. Section 4.2 explicitly permits corpus-specific access restrictions, so returning a cached result “as-is” can expose snippets from a corpus the second client cannot query; the reverse ordering can return incomplete results. Include the resolved authorized database/corpus set, or an equivalent authorization-scope identity, in the cache key.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+208
to
+209
|
|
All four flags are part of the result-cache key, so a `--raw` answer is
|
|
|
never served to a grouped request or vice versa.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exclude cache-control flags from the result-cache key
Including all four flags makes --no-cache part of the cache identity, contradicting its refresh semantics above. A request with --no-cache would write a different entry from the ordinary request it is meant to refresh, and subsequent --no-cache requests would bypass that entry anyway. Exclude --no-cache from the key while retaining output-affecting options such as --raw and --expand, so a bypassed computation refreshes the entry normal requests actually read.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+289
to
+290
|
|
Snowflake model, promotes in **bounded batches** (≤ 500 rows/txn, so a
|
|
|
promotion never holds a core writer for more than seconds), bumps the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Size indexed promotion batches against measured writer time
For core corpora that receive the optional indexes in §5.4, a 500-row transaction cap does not establish the promised seconds-long writer occupancy: §1.3 already measures 92–157 seconds for batches of just 100 indexed rows. Those batches satisfy this limit while still holding the single writer for minutes, recreating the contention the bounded-promotion design is meant to prevent. Specify a measured writer-time budget with appropriately smaller or adaptive batches for indexed stores instead of treating the row-count cap as a latency bound.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
… revision
Read-only inventory of the muse-dev2 Supabase project (120 tables,
~473k live rows) classified against the §7 placement placements:
KEEP in Postgres 21 tables, candidate Turso 42, candidate D1 8,
retire 49. Adds the placement rule and per-group reasons as §9,
extending the revision doc without changing its placements.
Design-level only; no data moves.
This was referenced Nov 4, 2026
Spike addendum (2026-11-04 evening): the 52× shadow, measured — §2/§5 update
Drew prioritized the shadow-cost spike ("especially the 52x"); it ran cloud-side the same evening. Full record on dezren39/hatch-personal#20 (verdict comment). What it changes in this doc:
- §2 (write anatomy): the size is not a defect. Every fresh index measures the identical 160,576 B/row. Metadata literally stores the constant; blob anatomy shows why: each DiskANN node materializes 52 vector slots (own vector + neighbors' full f32 vectors) + 832 B — byte law
52 × dims×4 + 832, exact at dims 384/768/1536, linear in dims and rows. The 17.3 GB full-index projection stands as the index's honest cost. Add hypothesis-killer: the wedged-writer explanation for Defect 1 gains a mechanism — an interrupted index build leaves a dangling transaction (see next point).
- Defect 2's emptiness is a wedged index, reproduced at 5,000 rows. CREATE INDEX builds in one transaction (shadow = 0 until commit; 100 rows = 2.7 s, 5,000 rows > 121 s uncommitted). Interrupt it and the DB keeps the shadow tables + meta row but no index in sqlite_master —
DROP INDEX says "no such index", CREATE INDEX fails forever with unable to update global metadata table, and manual meta cleanup blocked/EOF'd in our test. Production's CREATE INDEX/REINDEX almost certainly died this way (a 107,639-row build needs ≥ ~1 h). In-place un-wedging is unreliable; fresh-DB restore is the recovery.
- §5 (sharding): validated with real numbers, one correction of emphasis. Two disjoint 1k write-path shards, 5 held-out queries: index↔scan parity 10/10 everywhere, merged fan-out == exact global top-10 (10/10 ×5). Latency at N=1k is network-bound (index 577–767 ms ≈ scan 611–748 ms) — sharding's wins are build time, write contention, and blast radius, not per-query latency at small N, and not storage (52× applies per shard too). Write-path population costs ~200 ms/row at N=1k, degrading with N — shard size should also respect a population-time budget, not just the §5 scan-time budget.
- §6 (engine): resolved + one new constraint. Atlas is definitively libSQL (db show Type=SQLite + libsql:// + sqlite_version 3.47.0, vs Turso/3.50.4 on the pilots — both pilots now exist, created via CLI
--tursodb, no dashboard click needed). TursoDB rejects libsql_vector_idx outright — the ANN design is libSQL-only today; the pilots suit the registry/embedding-cache roles (no ANN needed there).
- Recommendation recorded on Update Rust crate indicatif to 0.17.5 #20: restore atlas into fresh topic shards (~5k chunks each, never interrupt a build), default new corpora to scan-over-shards, and — Drew's call, not executed — stop the in-flight row-rewrite, which is filling a shadow whose index isn't registered and so cannot become searchable even when it completes.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 5, 2026
…pabase-audit-2026-11-04
docs: Supabase placement audit addendum (§9) — what moves out of Postgres
There was a problem hiding this comment.
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: f600d09c82
ℹ️ 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".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+179
to
+181
|
|
- **Key:** `sha256(query_text || snapshot_id || ceiling || flags)`.
|
|
|
- **Reuse rule:** while the snapshot id is unchanged, a cached result is
|
|
|
*correct*, not merely fresh — return it as-is.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include search parameters in the result-cache key
Requests that differ only in filters, pool, or vector_backend collide under this key: §3.3 defines flags as the four new presentation/cache-control flags, not these existing search parameters. The companion binary/service design retains all three in POST /v1/search/jobs (§2, line 194) and explicitly states that increasing pool produces a different ranking, not merely more pages (lines 201–208). Consequently, a deeper follow-up search can return the earlier shallow ranking, or a filtered search can receive results from an unfiltered request. Include the effective search parameters in the cache identity before permitting reuse as-is.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 5, 2026
This was referenced Nov 14, 2026
This was referenced Nov 14, 2026
This was referenced Nov 24, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|