Skip to content

v2.9274 — Bids and the Dashboard open with far fewer requests - #10767

Merged
realrobertdouglas merged 1 commit into
mainfrom
claude/bid-audits-one-read
Dec 3, 2026
Merged

realrobertdouglas merged 1 commit into
mainfrom
claude/bid-audits-one-read

Conversation

@realrobertdouglas

Copy link
Copy Markdown
Contributor

What was wrong

A teammate reported the live app as nearly too slow to use, worst on the Bid Board. Read on prod on 2026-12-03, reads only.

useBidAuditsPendingCount asked the server once for each bid with a pending robot audit, all at once, on every open of the Bids page and of every screen that reads Needs you.

  • 74 bids had a pending audit, so each open sent 74 HEAD counts on bids_count_rows.
  • In pg_stat_statements that statement had 170,191 calls at 80 ms mean over nine and a half days: 8.1% of all database time, the largest of any statement the app sends.
  • The loop is from v2.2796 (2026-09-04). No merge of this week started it.

What changed

  • One read of the pending bids, each with at most one of its count rows, answers for all of them (PENDING_PRICED_SELECT, the limit set on the embedded table, chunks of 100).
  • The relationship is named, because bids reaches bids_count_rows two ways and PostgREST refuses an unnamed embed (PGRST201). Tried against prod's API as a signed-out caller: the named shape is accepted, the unnamed one is refused.
  • The count is the same: a count row is read through its bid (the row policy of bids_count_rows), so a bid the person cannot read counted 0 before and reads as unpriced now. A failed read leaves every pending audit counted, as before.

Client only. No migration, no function change, nothing owed on prod.

Not shown

That this burst is what the teammate felt. It is the largest load the Bids page put on the database and it lands as the board opens. Not in this change: the jobs_ledger row policies (every read of that table costs 0.2 to 0.6 s), which is a migration of its own.

Checks

  • src/lib/bids/bidAudits.test.ts (24 tests) and src/lib/releaseNotes.test.ts pass.
  • eslint on the changed files, check:layers, check:error-words pass.
  • Owes a look on the live site after the deploy: Bids opens, the Audits tab's count is unchanged, and the network panel shows one bids?select=id,bids_count_rows... request where 74 counts were.

🤖 Generated with Claude Code

The pending-audits gate asked the server once for each bid with a pending
robot audit: 74 HEAD counts at once on every open of Bids and of Needs you,
8.1% of all database time. One read of the pending bids, each with at most
one of its count rows, now answers for all of them. Client only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@realrobertdouglas
realrobertdouglas added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit d1cd32c Dec 3, 2026
7 checks passed
@realrobertdouglas
realrobertdouglas deleted the claude/bid-audits-one-read branch December 3, 2026 06:59
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.

1 participant