Repository navigation
Cache fixed-shape lifecycle database queries - #8366
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
# Conflicts: # packages/db/test/prepared-queries.test.ts
The test compared a cold first disconnect against a warm second one, and a one-active-thread host against a multi-thread host. Those take different statement paths, so the counts only matched while every query on the path was uncached. Run an unmeasured disconnect first and give the small host two active threads so both measured hosts take the same path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
scowalt
pushed a commit
to scowalt/bb
that referenced
this pull request
Dec 1, 2026
🚨 **SLOP COP** 🚨 · `new-issue-autopilot` ## Human comments ## What was wrong Three synchronous lifecycle reads rebuilt their fixed-shape Drizzle queries and prepared SQLite statements on every call, unlike the existing cached lookups. Two clean checkouts reproduced ten extra SQL compilations and preparations for ten warm reads of each affected query. Report: https://get-bb.github.io/reports/issues/8365.html ## What changed Use stable builders, scalar placeholders, and the existing connection-scoped prepared-query cache for host lookup, thread-status lookup, and active-host thread listing. Preserve query filters, projections, signatures, and live database reads. Extend the existing prepared-query regression table and cover parameter rebinding, connection isolation, filtering, and updated database state. Scope: **157 changed text lines** (126 additions + 31 deletions), **3 files**, all in `@bb/db`. No dependencies, generated files, migrations, stored-data changes, public protocols, or public API changes. ## How you verified - Trusted base: `a8c32288cf24894fbe85cb3a9ca0469c7a997ed6`. - Before repair: `pnpm exec turbo run test --filter=@bb/db -- prepared-queries` fails the three affected cases in both clean checkouts; five existing cases pass. Each failed case makes ten warm SQL compilations and ten warm SQLite preparations. - After repair: the same focused regression passes all eight cases. - `pnpm exec turbo run test typecheck --filter=@bb/db`: 72 test files, 766 tests pass; typecheck passes. - Formatting check and `git diff --check` pass. Text-only diff, below the simple-fix size and file limits. - Exact reported timing ratios are not asserted; the regression measures repeated compilation and preparation directly. Fixes get-bb#8365 > AGENT GENERATED <!-- slopcop:rule=new-issue-autopilot run=run_zjs0pdu6mx27hkzp sha=issue-8365 kind=summary --> --------- Co-authored-by: SawyerHood <[email protected]> Co-authored-by: Michael Yong <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚨 SLOP COP 🚨 ·
new-issue-autopilotHuman comments
What was wrong
Three synchronous lifecycle reads rebuilt their fixed-shape Drizzle queries and prepared SQLite statements on every call, unlike the existing cached lookups. Two clean checkouts reproduced ten extra SQL compilations and preparations for ten warm reads of each affected query.
Report: https://get-bb.github.io/reports/issues/8365.html
What changed
Use stable builders, scalar placeholders, and the existing connection-scoped prepared-query cache for host lookup, thread-status lookup, and active-host thread listing. Preserve query filters, projections, signatures, and live database reads. Extend the existing prepared-query regression table and cover parameter rebinding, connection isolation, filtering, and updated database state.
Scope: 157 changed text lines (126 additions + 31 deletions), 3 files, all in
@bb/db. No dependencies, generated files, migrations, stored-data changes, public protocols, or public API changes.How you verified
b0ddaad731565d7e4de68d824120d802fc78f7d5.pnpm exec turbo run test --filter=@bb/db -- prepared-queriesfails the three affected cases in both clean checkouts; five existing cases pass. Each failed case makes ten warm SQL compilations and ten warm SQLite preparations.pnpm exec turbo run test typecheck --filter=@bb/db: 72 test files, 766 tests pass; typecheck passes.git diff --checkpass. Text-only diff, below the simple-fix size and file limits.Fixes #8365