Skip to content

docs(exploration): database scale limits, virtualization, and materialization (0318) - #505

Merged
crs48 merged 3 commits into
mainfrom
claude/database-performance-testing-f395db
Jul 30, 2026
Merged

crs48 merged 3 commits into
mainfrom
claude/database-performance-testing-f395db

Conversation

@crs48

@crs48 crs48 commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Exploration 0318 — measured database load/render behavior at 10k / 100k / 1M / 10M rows, native tier (real SQLiteNodeStorageAdapter over better-sqlite3) plus the live web app on OPFS (Playwright).

Headlines (all measured):

  • Indexed first pages are scale-flat 0.6–0.8ms to 10M rows; raw keyset pagination is 1ms at depth 5,000,000.
  • Four O(N) query-shape cliffs: custom-property sort (the grid's sortKey order — 20s@1M), after-cursor pages (29s@1M, hydrates the full result set), count:'exact' (24.6s@10M), deep OFFSET (3.5s@5M).
  • At 10M every full-set-hydrating path — including the materialized-view build — dies with ERR_WORKER_OUT_OF_MEMORY (~2.5KB heap/row).
  • Browser: a 100k-row database cold-opens in 32s today; the grid never fetches past its 500-row window and the footer reports the window as the row count.
  • Adaptive-index property-sort pushdown compiles an ORDER BY no index can serve (temp B-tree every query; measured 60,000× headroom vs a covering index).

Recommends keyset pushdown + index-servable property sorts + estimate counts for effectively-infinite scroll (no materialization needed sequentially), and sequences the MV-table question against 0317's P5 (its "zero production opt-in" premise is stale — useGridDatabase ships db:<id> MV keys today).

Also adds the env-gated benchmark harness (packages/data/src/store/scale-limits.bench.test.ts, inert unless XNET_SCALE_BENCH is set) so the validation checklist is re-runnable.

Test plan

  • Harness skips cleanly without XNET_SCALE_BENCH (verified: 1 skipped)
  • prettier --check and tsc --noEmit -p packages/data clean
  • Raw results JSON preserved from all runs (2026-07-13)

🤖 Generated with Claude Code

… materialization

Measured 10k/100k/1M/10M-row databases end to end (native better-sqlite3
tier through the real SQLiteNodeStorageAdapter, plus the live web app on
OPFS via Playwright). Indexed first pages stay flat at 0.6-0.8ms to 10M;
four O(N) query shapes are the real limits (property sort, after-cursor,
exact count, deep OFFSET), the MV build OOMs at 10M, and the grid's
500-row window mislabels every larger database. Includes the env-gated
benchmark harness used to collect the data.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Signed-off-by: xNet Test <test@xnet.dev>
@crs48
crs48 temporarily deployed to pr-505 July 13, 2026 20:40 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

✓ Changelog fragment found — thanks!

github-actions Bot added a commit that referenced this pull request Jul 13, 2026
@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Preview removed for PR #505.

github-actions Bot added a commit that referenced this pull request Jul 13, 2026
crs48 added a commit that referenced this pull request Jul 17, 2026
## Summary

Adds exploration **0335** — a full-repo release-readiness audit
answering *"what's in the way of releasing xNet, and what would a
well-received release need?"* Grounded in a six-dimension parallel audit
(release/packaging infra, security & authz, CI & test health,
docs/DX/legal, product completeness, external launch bar). The four
release-blockers were re-verified against live code.

## Headline

Pipelines, protocol spec + golden vectors, and governance are all
healthy — the gap is a short, specific list.

**4 release-blockers (verified in code):**
1. Electron boots a deterministic test signing key —
`apps/electron/src/renderer/main.tsx:833` (`makeTestKey`, unconditional;
secure path in `secure-seed.ts` unused).
2. Wildcard UCAN neutralizes hub authz — `use-hub-auth-token.ts:10` +
`hub/ws/authorize.ts:146` (0307 "Option B").
3. Envelope signature omits ciphertext —
`packages/crypto/src/envelope.ts:167` (0307 "Option A").
4. No `SECURITY.md`.

**Operational blocker:** release PR #526 has zero CI (changesets branch
pushed with `GITHUB_TOKEN` → no workflows). Fix: provision
`RELEASE_GITHUB_TOKEN`.

**Well-received gap:** version incoherence, README advertising ~12 npm
packages that 404, at-scale perf (0318) unmerged on PR #505, read-only
AI assistant, rotted `validate:canvas-v2` gate.

**Recommendation:** phased Option B — soft-launch SDK + hosted demo +
hub (fixing the two multi-user security blockers + SECURITY.md +
release-PR CI first), position desktop as beta, then cut `xnet 1.0`.

Docs-only; no changeset needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@crs48 crs48 added the skip-changelog Exclude this PR from the changelog label Jul 30, 2026
@crs48
crs48 temporarily deployed to pr-505 July 30, 2026 16:00 — with GitHub Actions Inactive
github-actions Bot added a commit that referenced this pull request Jul 30, 2026
github-actions Bot added a commit that referenced this pull request Jul 30, 2026
@crs48
crs48 temporarily deployed to pr-505 July 30, 2026 16:08 — with GitHub Actions Inactive
@crs48
crs48 merged commit bcec607 into main Jul 30, 2026
19 of 20 checks passed
@crs48
crs48 deleted the claude/database-performance-testing-f395db branch July 30, 2026 16:18
github-actions Bot added a commit that referenced this pull request Jul 30, 2026
crs48 added a commit that referenced this pull request Jul 30, 2026
…(0410) (#658)

Implements exploration
`0410_[_]_OPEN_PR_TRIAGE_AND_THE_STRANDED_BRANCH_PROBLEM.md`, written in
the previous turn.

## What this closes out

Eight PRs were open, the oldest from March. Checking each one's **actual
diff against `main`** (rather than its description) found that four
described work already in `main`, re-derived and landed weeks later by
another route.

| PR | Age | Action taken |
| --- | --- | --- |
| #400 | 24d | **Closed** — fix landed on main in a better form; branch
predates 0391 and would have deleted `NodeLineRunner` |
| #9 | 145d | **Closed** — draft;
`apps/electron/src/renderer/workspace/` no longer exists |
| #595 | 11d | **Closed** — byte-identical to main (`fbc2965a2`) |
| #463 | 20d | **Closed** — main has a longer, `[x]` version of 0298 |
| #13 | 141d | **Closed** — both fixes on main verbatim |
| #505 | 17d | **Merged** — exploration 0318 + scale bench |
| #389 | 25d | **Merged** — exploration 0270 |
| #449 | 20d | **Rebuilt here** — see below |

`#400` was the load-bearing one: `git diff origin/main pr400 --
packages/devkit/src/command-runner.ts` showed ~150 lines of *deletion*
covering the whole 0391 streaming agent seam. Only its `CONFLICTING`
state had prevented that.

`#505`'s `build-and-smoke-test` went green on a rebase, confirming it
was branch staleness rather than the diff.

## The #449 rebuild (0290 bugs #2 and #3)

The original patched `apps/web/src/workbench/SyncStatus.tsx`, which 0406
deleted; the component now lives in `packages/workbench`, so the rebuild
lands on **desktop and web at once**.

- `WorkbenchHost` gains a `hub` capability (`configuredUrl` / `connect`)
so the shell can offer a way out of the disconnected state without
importing either app's `hub-url` module. `connect` returns a reason
string on rejection — never a silent no-op.
- `SyncStatus` exports `openSyncStatusPanel()`; the desktop popover and
mobile sheet both listen. The panel shows an inline hub-URL form while
there is no hub.
- `ShareDialog`'s `!ready` branch explains why a hub is needed and
offers **Connect a hub…**; private-hub links now confirm before copying.
- Adds `normalizeHubUrl` to the electron renderer's `hub-url` mirror (+4
unit tests), so a malformed URL is rejected loudly rather than
persisted.

Verified by driving the real app against a local hub — the CTA closes
the dialog and opens the panel; an invalid URL shows an error and
persists nothing; `https://hub.xnet.fyi/` normalises to
`wss://hub.xnet.fyi`; a `localhost` link's first Copy click asks "Copy
local-only link?" and writes nothing, the second copies. No console
errors. 0290 is now `[-]` at 11/20.

## Stopping the recurrence

Time-to-merge for the last 20 merged PRs was **0 hours median, 1 hour
max** — there is no review queue, so a PR that outlives its session is
abandoned, not pending.

- `.github/workflows/stale.yml` — warns at 14d, closes at 21d,
`keep-open` exempts. Named consumer (the maintainer, weekly) and a
decidable pass condition, per AGENTS.md.
- Fixed the `/explore` next-number command, which read only the working
tree and so handed out numbers already claimed on branches. Seven
explorations were found stranded that way.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

This branch was previously deployed

1 inactive deployment
pr-505 — 70756d99 Deployed Jul 30, 2026 by crs48 via deploy-preview #1293
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Exclude this PR from the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant