docs(selfhost): verify + document the shared backend's concurrency model#8141
docs(selfhost): verify + document the shared backend's concurrency model#8141joaovictor91123 wants to merge 1 commit into
Conversation
Verifies the SQLite and Postgres SelfHostD1Database adapters' actual concurrency guarantees against the real seam post-JSONbored#7175, instead of assuming the old two-local-process design still silently holds, and pins each claim to a deterministic in-process test (SQLite) or a PG_TEST_URL-gated live-Postgres test. Closes JSONbored#4942
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-23 01:42:45 UTC
Review summary Nits — 5 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests (3), validate-tests (2), validate-tests (1))). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
|
For whoever reviews this closed PR later: the CI failure here isn't a defect in the diff — it's a reproducible gap in `SCOPED_TEST_SELECTION`'s `vitest run --changed=origin/main` (ci.yml, ~line 991/1009). `git diff --name-only origin/main ` correctly lists all 3 changed files, including the brand-new `test/unit/selfhost-d1-concurrency.test.ts`. But vitest's own `--changed` selection never picked that file up in any of the 3 shards — the run log only ever mentions the one modified file (`test/integration/selfhost-pg.test.ts`, 13/13 tests skipped since no `PG_TEST_URL` in CI), never the new one. Net result: zero tests actually ran, so `coverage/lcov.info` came out empty and `Verify coverage report exists` hard-failed — a false negative, not a real defect (the AI review itself found no blockers). This exact shape has now closed 5 separate attempts at #4942 across 3 different contributor accounts (#8002, #8003, #8071, #8072, and this one) — every one a docs+test-only PR whose ENTIRE diff is new/modified test files with no accompanying `src/**` logic change for `--changed` to anchor a reverse-dependency walk on. `--changed` appears to reliably pick up a modified test file but miss a brand-new one, so any PR shaped like #4942's own scope (verification/docs work, no production code) is structurally unable to pass CI under scoped selection regardless of code quality. I don't have permission to open a new issue directly on this repo (read-only), so flagging it here since closed PRs are apparently reviewed later. Happy to resubmit once this is fixed, or if there's a workaround I'm missing for triggering the full (non-scoped) suite on a test-only PR. |
Summary
Verifies the SQLite and Postgres
SelfHostD1Databaseadapters' actual concurrency guarantees against the real shared seam (src/selfhost/backend-contracts.ts, #4010) post-#7175's migration offnode:sqlite-directly, and documents them explicitly instead of assuming the old two-local-process design still silently holds.src/selfhost/backend-concurrency-model.md— what each backend guarantees (atomic single statements, all-or-nothingbatch()) and what it doesn't (non-atomic read-modify-write loses updates on either backend).test/unit/selfhost-d1-concurrency.test.ts— deterministic, in-process SQLite guarantees (matches the backend's real single-process/single-connection topology, perinstallation-concurrency-admission.ts's own documented posture): N concurrent atomic increments lose no updates, a failingbatch()rolls back cleanly, a committed batch applies in order, an interleaved read never observes a rolled-back intermediate state, and the boundary case (non-atomic read-modify-write losing updates) is pinned as expected/documented behavior, not a bug.test/integration/selfhost-pg.test.ts— extended with twoPG_TEST_URL-gated cases exercising the same guarantees against a real Postgres pool (batch rollback on its own connection; N concurrent atomic increments across the pool).No production code changes — verification + documentation only, against the already-migrated (#7175, closed) shared backend, using the existing test-double SQLite setup and the already-established
PG_TEST_URL-gated integration pattern.Test plan
npm run typecheckclean (no new errors beyond the pre-existing baseline)npm run docs:drift-checkcleangit diff --checkclean (no whitespace/conflict markers)test:coverage(SQLite suite runs in every CI pass) and the Postgres integration jobCloses #4942