Skip to content

fix(db): avoid maintenance scans in inference settings reads - #16037

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.52from
insoln:fix/inference-settings-scans
Oct 10, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.52from
insoln:fix/inference-settings-scans

Conversation

@insoln

@insoln insoln commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace the full diagnostic getDatabaseSettings() reader with getUserDatabaseSettings() in semantic-cache configuration and embeddings, rerank, audio transcriptions, and audio translations combo dispatch.
  • Avoid synchronous table counts, dbstat page scans and PRAGMA quick_check during inference settings reads, including cold semantic-cache initialization with the vector layer disabled.
  • Preserve operator settings and provider dispatch. Administrative settings/statistics/integrity-check endpoints remain unchanged.

Related Issues

Closes #16036

⚠️ base-red inherited: #15306

Validation

  • Change type: DB / routing.
  • Seven new regression cases reproduced diagnostic scans before the fix and pass after it, using a disposable real SQLite database and mocked upstream HTTP responses.
  • Focused Node suite: 60 tests passed, 0 failed, 0 skipped, including existing cache opt-in, database maintenance, modality combo resolution and dbstat compatibility tests.
  • ESLint passed for all seven changed TypeScript files with the repository suppression baseline. Normal pre-commit gates passed; no hook bypasses.
  • npm run check:migration-numbering, npm run check:db-rules, and npm run check:changelog-integrity passed.
  • Full npm run lint: five react-hooks/immutability errors in untouched UI hook tests (use-improve-prompt, use-presets, use-stream-metrics, use-structured-output, use-tools-builder) and one unused-disable warning in untouched FeatureFlagsGrid.tsx. Focused lint on changed files passes.
  • npm run typecheck:core: 11 diagnostics involving installed omniglyph/sharp types. The untouched base at f9989a1 produces byte-identical diagnostic output using the same local dependencies.
  • npm run test:vitest: fails before executing tests with builtin:vite-wasm-fallback / BindingBuiltinPluginName. Reproduced on the untouched base with the same local dependencies.
  • Full unit suite, production build and coverage not run locally. Ready for review; CI/full validation is still required before merge. This is not a claim that all release gates pass.

Tests Added Or Updated

  • tests/unit/semantic-cache-settings-no-maintenance.test.ts: master/vector toggle matrix, TTL/capacity/threshold preservation, and no database-wide maintenance during config resolution.
  • tests/unit/inference-combo-settings-no-maintenance.test.ts: successful synthetic dispatch through all four modality combo handlers without diagnostic scans.

Coverage Notes

The new tests exercise all five changed readers through the real DB bridge or handlers. Existing administrative database-maintenance tests still pass. No coverage percentage claim is made; CI will measure coverage.

Reviewer Notes

No migrations, new settings, dependencies, changes to cache defaults, or disabled integrity checks. All reproductions use synthetic local data and mocked providers; no production data or infrastructure details are included.

Review readiness update

Marked ready for review to enable the full PR validation workflows. Draft PRs skip the substantive CI jobs, and the aggregate gates explicitly reject draft readiness. Existing validation limitations and the base-red warning above remain applicable; this status change does not assert a green full suite or authorize merging.

@insoln
insoln marked this pull request as ready for review October 9, 2026 13:48
@insoln
insoln requested a review from diegosouzapw as a code owner October 9, 2026 13:48
@diegosouzapw
diegosouzapw merged commit 853e6a2 into cheaper-inference:release/v3.8.52 Oct 10, 2026
74 of 154 checks passed
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks @insoln — inference and semantic-cache reads use per-user database settings and skip the database-wide integrity scan. This is in the upcoming release.

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.

fix(backend): avoid database-wide scans during inference settings reads

2 participants