Skip to content

fix(db): skip integrity scans during health polling - #13149

Merged
diegosouzapw merged 7 commits into
cheaper-inference:release/v3.8.51from
cryptiklemur:fix/health-poll-skip-integrity
Sep 17, 2026
Merged

diegosouzapw merged 7 commits into
cheaper-inference:release/v3.8.51from
cryptiklemur:fix/health-poll-skip-integrity

Conversation

@cryptiklemur

Copy link
Copy Markdown
Contributor

health dashboard polling calls runManagedDbHealthCheck() every 15 seconds. that path runs SQLite quick_check synchronously, blocking the request-serving event loop while it scans the database.

this change skips integrity scans for authenticated GET /api/db/health requests. the shared wrapper also honors the existing OMNIROUTE_SKIP_DB_HEALTHCHECK=1 setting. explicit repair requests retain integrity checks when that setting is off.

the other reference and state checks remain enabled. this does not make every database diagnostic asynchronous or claim to fix all dashboard stalls.

tested with node --import tsx/esm --test tests/unit/db-health-poll-nonblocking.test.mjs tests/unit/db-health-route.test.ts tests/unit/db-health-check.test.ts tests/unit/db-health-driver.test.ts tests/unit/db-core-extended.test.ts.

the regression test covers repeated polling, the environment override, explicit repair, and unauthenticated requests.

base-red inherited: #12732. no deployment settings or user data are included.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Clean, well-scoped fix — skipping the synchronous integrity scan on the 15s
dashboard poll while keeping it for explicit repair and startup is the right
tradeoff, and reusing healthCheck.ts's existing skipIntegrityCheck option
instead of inventing something new is a nice touch. Ran your test file at this
PR's head: 4/4 pass. Only ask before merge: could you add a changelog.d/fixes/
fragment (repo convention, missing from this diff)?

@cryptiklemur

Copy link
Copy Markdown
Contributor Author

Added

diegosouzapw and others added 2 commits September 17, 2026 18:17
# Conflicts:
#	src/app/api/db/health/route.ts
#	src/lib/db/core.ts
#	tests/unit/rule12-error-sanitization-sweep.test.ts
…heaper-inference#13717 managed health check

Merge fallout only: runManagedDbHealthCheck moved behind the health
coordinator on the release tip, so the per-call skipIntegrityCheck now
travels through it. A waived integrity scan is part of the job identity,
so it is never replayed from the 60s diagnosis cache to a caller that
asked for the full scan.

Co-authored-by: cryptiklemur <cryptiklemur@users.noreply.github.com>
@diegosouzapw
diegosouzapw merged commit 7d69b02 into cheaper-inference:release/v3.8.51 Sep 17, 2026
3 of 7 checks passed
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…e#13149)

* fix(db): skip integrity scans during health polling

* test(db): update health error fixture for scan-free polling

* docs(changelog): add fragment for health poll integrity skip

* fix(db): keep the cheaper-inference#13149 dashboard skip inside the cheaper-inference#13717 managed health check

Merge fallout only: runManagedDbHealthCheck moved behind the health
coordinator on the release tip, so the per-call skipIntegrityCheck now
travels through it. A waived integrity scan is part of the job identity,
so it is never replayed from the 60s diagnosis cache to a caller that
asked for the full scan.

Co-authored-by: cryptiklemur <cryptiklemur@users.noreply.github.com>

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: cryptiklemur <cryptiklemur@users.noreply.github.com>
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.

2 participants