Skip to content

test(perf): add independent native SQLite benchmarking and profiles - #2152

Open
n30nex wants to merge 14 commits into
Kpa-clawbot:masterfrom
n30nex:codex/sqlite-performance
Open

n30nex wants to merge 14 commits into
Kpa-clawbot:masterfrom
n30nex:codex/sqlite-performance

Conversation

@n30nex

@n30nex n30nex commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2150. Related to #2146.

The native SQLite benchmark now has its own manual dispatch and automatically qualifies harness changes against upstream 2df9ac7a7. Baseline, candidate and harness use separately verified commits. The deployment workflow matches upstream. The benchmark runs when its own files change. Its workflow test exercises profile selection, full SHA checks and the published-evidence allowlist.

The manifest recognizes both legacy observer row IDs and the current observers.idx identity. The synthetic fixture includes radio retunes, linked observations and a neighbour report. Receipt times advance with the fixture while device-reported times retain their original meaning. The documented small smoke run compares identical application code. Primary measurements on shared hosted runners are labelled indicative.

The earlier v3.15.0 qualification used 22 application tables and 211 manifest columns. Those results retain their original revision. v3.15.0 run · October 20 qualification · Original qualification · Retention comparison · Optional-backend comparison

@n30nex
n30nex marked this pull request as ready for review October 9, 2026 17:16
@n30nex
n30nex marked this pull request as draft October 9, 2026 17:51
@n30nex

n30nex commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Benchmark coverage corrected (commit 1c5eb9d)

  1. The failed B run returned 240 empty upstream path responses; it remains excluded from performance conclusions.
  2. Paths now use a deterministic repeater with retained canonical routes under both observation ordering cases. Reach/RX targets, data rows, rates and validation remain unchanged.
  3. Native S/B regressions reproduced missing coverage and pass after the fix. All 41 Python controls, native overlay controls and complete Go suites pass locally.

Fresh Linux qualification is running before the retention comparison is retried.

@n30nex
n30nex marked this pull request as ready for review October 9, 2026 21:43
@n30nex

n30nex commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Review/update plan after checking current upstream:

This remains useful as the independent measurement tool for #2153 and #2145. It also carries an older copy of #2160 (9d800035), so the rebase needs to drop that copy and preserve the current deployment workflow, authoritative test runner and configuration tests.

The next useful gate is a fresh native SQLite smoke qualification with baseline, candidate and harness revisions pinned separately. Retain complete logical-data parity, equivalent cache and endpoint coverage, zero-drop/error checks, resource accounting and durability checks. Diagnostic/profile runs should stay separate from timing results, and benchmark-only workflows must retain their no-publish/no-deploy guards.

The comparison markers currently in the body identify historical revisions. They should be updated only when a new comparison is actually requested and run. The successful qualification and comparisons remain valid for their recorded revisions; the excluded failed benchmark run is not evidence for a speed claim.

I would land this tool-only change separately, then use it to measure the focused retention change and a narrower storage candidate against contemporary upstream. No new benchmark or rebase was performed during this discussion review.

Reconstruct f29c443, 1c5eb9d and 4de4194 on b9593f7. Drop the duplicate 9d80003 changes now superseded by upstream Kpa-clawbot#2160; preserve current workflows, test inventory and configuration tests. The harness sources and portable controls remain unchanged.
@n30nex

n30nex commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

I’m rebasing the harness onto current upstream b9593f71 and dropping its duplicate #2160 commit. The small automatic qualification will compare the current application with itself using the rebased harness; the historical comparisons remain separately labelled.

I’m preserving the old 4de41941 harness revision in the fork before updating this branch with an explicit lease. This update does not request a large primary or diagnostic run. I’ll post the new head and qualification results when available.

@n30nex
n30nex force-pushed the codex/sqlite-performance branch from 4de4194 to 6a924cc Compare October 20, 2026 13:37
@n30nex

n30nex commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Review feedback addressed (commit 6a924cc2)

  1. Rebuilt the harness on upstream b9593f71, dropping the duplicated 9d800035 test fix and preserving the current workflow and test inventory.

  2. Pinned automatic smoke qualification to contemporary upstream, keeping explicit baseline, candidate and harness revisions independent.

  3. Added complete current-schema coverage for all 21 application tables, with guards for unexpected table/column changes and regression coverage for legacy 18-table data, quoted identifiers, row mutations, observer layout adoption and index-only changes.

  4. All 55 Python controls, workflow protections and native Go overlay controls pass. A native startup fixture loaded 100 transmissions and 300 observations and preserved every application-table digest.

  5. The fresh Linux S smoke qualification passed on this head with 30,000 transmissions and 90,000 observations, all 21 tables and unchanged source databases. Its sanitized evidence records the exact three pins. It is an A/A controller qualification, not evidence of a speedup.

Normal CI has also passed on this head. Post-push Chromium validation passed 148 checks with three explicit fixture-dependent skips against the unchanged server/frontend. No primary/diagnostic benchmark was requested or run, and no new speed claim is made.

@n30nex

n30nex commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Review feedback addressed (commit 28f91906)

  1. Merged upstream v3.15.0 without rewriting the review history and refreshed the independent A/A qualification baseline to 7fa86fe1.
  2. Added coverage for all 22 current application tables and 211 manifest columns, including client-name receipt timestamps while preserving repeater clocks. Production code matches upstream.
  3. All 56 Python controls, workflow protections, standalone frontend suites and native build/startup controls pass. Post-push Chromium passed 148 checks with three explicit fixture-dependent skips.
  4. Fresh Linux S qualification and normal CI passed on this head. The artifact records the exact pins and verifies 22-table parity and unchanged source databases.

This is controller qualification with identical production code, not a new speed comparison. Historical measurements remain labelled with their original revisions.

@n30nex

n30nex commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

The next qualification after #2292 needs populated radio-history fixtures. The harness already discovers both radio tables, shifts their timestamps and rejects changed mappings/stale manifests; synthetic checks confirm those paths.

The remaining gap is generated data: sqlite_adapter_test.go creates observers without radio settings after schema setup, and ingestor_test.go emits packets without receiver-radio IDs. Add deterministic retunes and sparse multi-radio mappings, then a small A/A check pinned to the updated application. Existing 22-table results remain tied to 7fa86fe1; this does not establish a new performance result.

@n30nex

n30nex commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Trial merge with 35a99800a: both release-routing suites passed. The benchmark itself needs a new qualification. The current server refuses the pinned v3.15.0 corpus because observers.idx is absent. Upgrading it moves the schema from 22 to 25 tables, and the strict manifest correctly rejects that comparison.

Each server loaded 26,250 retained transmissions and 78,750 observations from its matching S fixture. All three new tables were empty. I suggest a separately pinned current-schema A/A run, then deterministic radio retunes, observation-to-radio mappings and neighbor reports. The original measurements still apply to their published revisions.

@zfouts zfouts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at 28f91906. Requesting changes. The harness itself is careful: CGO_ENABLED=1 is set explicitly and sqlite_version() comes from a real connection, so it can't benchmark a stub. It verifies independent baseline, candidate and harness SHAs, and it keeps reads and writes separated. Uploads go through a whitelist, and I found no new dependencies or private data. The problems are in how it hooks into CI. Master has moved 150+ commits since the base.

Blocking

  1. The automatic smoke run fails once rebased. The baseline is pinned to v3.15.0 7fa86fe1 (sqlite-benchmark.yml:115), while the candidate is the rebased head. As your own latest comment says, the current server refuses that corpus because it has no observers.idx (#2407), and the strict table manifest rejects 22 → 25 tables. Please re-pin the baseline to current master, teach the harness about observers.idx and the new tables, and post a fresh A/A smoke run.
  2. Remove the deploy.yml coupling. The comment says the dispatcher lives in deploy.yml only because the new workflow isn't on the default branch yet, and that reason goes away when this merges. The coupling adds !inputs.sqlite_benchmark to five production jobs, and master's newer jobs (server-race-shard, e2e-shard, release-artifacts) would each need it added by hand. It's also the only textual conflict. Instead, give sqlite-benchmark.yml its own workflow_dispatch and revert the deploy.yml changes.
  3. Drop deploy.yml from paths. As written, every PR that touches deploy.yml gets a 30-minute benchmark job, and with item 1 that job is red on unrelated PRs.
  4. tests/unit/test-sqlite-benchmark-ci.js hand-parses deploy.yml and evaluates four jobs' if: expressions in a vm with a fixed needs set. If an unrelated deploy.yml change makes one of those conditions read a job outside that set, test-all.sh fails. With item 2 done, the test can check only sqlite-benchmark.yml.

Notes, none blocking:

  • Primary runs on shared ubuntu-24.04 runners are noisy. A 5% p95 difference is about the size of normal runner variance, so label hosted-runner results as indicative, or document a self-hosted path.
  • The Go version is pinned to 1.27.2 with GOTOOLCHAIN=local, and someone will have to bump it by hand.
  • This is about 4.6k lines, roughly 1.85k of them Python, and the overlays reach into unexported fields (db.msgCacheMu). Worth confirming the maintainers are willing to own that. #2153 already cites numbers from this harness, so landing a working version does have value.

@n30nex
n30nex marked this pull request as draft December 2, 2026 23:38
@n30nex

n30nex commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Review feedback addressed (commit 86c58385f).

  1. The benchmark has its own manual dispatch, path filters and workflow tests. The deployment workflow matches master.
  2. The current fixture covers observers.idx, radio retunes and mappings, neighbour reports and catalog receipt times. The v3.15.0 fixture still verifies legacy row IDs.
  3. The fresh hosted A/A passed on Go 1.27.2 with 30,000 transmissions, 90,000 observations and 26 tables. Both sides produced identical application binaries. Shared-runner primary timings are labelled indicative.

@zfouts, the updated head is ready for your re-review.

@n30nex

n30nex commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Kent Beck Gate: PASS (test quality) at 86c58385f. The regressions catch a duplicated observer identity, unchanged receipt times and an empty linked fixture. Native controls exercised 22 legacy and 26 current tables. They check the main radio retune, link auxiliary receptions to their observer, and resolve a reported neighbor. Catalog fields survive the time shift, and the device-reported clock stays fixed.

@n30nex
n30nex marked this pull request as ready for review December 3, 2026 00:26

@zfouts zfouts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed at 86c58385. The four points from my review at 28f91906 are resolved:

  1. Smoke run after rebase.
    • The baseline is pinned to the current master, 2df9ac7a.
    • run.py no longer counts the observer idx primary key twice.
    • The fixture now fills the newer tables (radio retune, auxiliary-radio tags, a neighbour report, a catalogue proposal), and the test fails if they are empty.
    • Freshening shifts received_at and catalog_keys.updated_at.
    • The automatic smoke on this head is green.
  2. deploy.yml coupling. Against master, the PR no longer touches deploy.yml. The workflow has its own workflow_dispatch with a profile choice and SHA inputs.
  3. Trigger paths. paths lists only the harness, its workflow and its test, and tests/unit/test-sqlite-benchmark-ci.js pins that list.
  4. The CI test. It now reads only sqlite-benchmark.yml, so a change to deploy.yml can't break test-all.sh.

Outside scripts/sqlite-benchmark/, the workflow and its test, the only change is one line in test-all.sh. The workflow is contents: read with no secrets. It reads the PR body from the event file rather than interpolating it, requires every ref to be a full lowercase SHA, and checks out with persist-credentials: false. The fixtures are synthetic.

Two non-blocking notes:

  • An edit can mask a red check. Editing the description without changing the request runs the workflow again on the same SHA with profile = 'off'. The benchmark job is then skipped, and the PR's checks list shows the newest run, so an earlier failed smoke on that head would show as skipped. Skipping edited runs at the on: level isn't possible, but having request fail, or giving the ignored-edit path a differently named job, would keep the last real result visible.
  • The baseline pin needs moving by hand. The pinned baseline will need a manual bump after the next schema migration, or the automatic smoke on a later harness PR goes red again for the reason in point 1. For pull_request runs, defaulting to github.event.pull_request.base.sha would keep the smoke run an A/A run automatically, with the pin kept as the dispatch default.

Whether the maintainers want to own a harness this size is still their call. On the code itself I have nothing blocking.

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.

test: extract a standalone native SQLite performance harness

2 participants