docs: sync from backend 4aa6ccb — auth postgres batching

This commit is contained in:
Siavash Sameni
2026-06-06 19:57:26 +04:00
parent 32e1acc5ef
commit 942e8d60a5
2 changed files with 13 additions and 0 deletions

View File

@@ -11,6 +11,16 @@ entries on top. Maintained by agents per the rule in `../AGENTS.md`.
--- ---
### 2026-06-06 — backend@4aa6ccb, frontend@1b86a45 — Auth-store Postgres batching and transaction safety
**Commits:** `4aa6ccb` `1b86a45`
**Touched:** backend `src/services/auth/authStore.ts`, `__tests__/auth-store-pg-query.test.ts`, `__tests__/setup.ts`, `package.json`, `package-lock.json`; frontend `package.json`; docs `09 - Audits/DB Query & Schema Audit - 2026-06-06.md`
**Why:** Address remaining DB audit findings for auth user hydration (`rowToUser` 1+3N queries), auth user save transaction safety, and token/passkey per-row insert loops.
**Verification:** backend `npm test -- --runTestsByPath __tests__/auth-store-pg-query.test.ts --runInBand`, `npm run typecheck`, `BASE_URL=https://dev.amn.gg bash scripts/smoke/auth-basic.sh`, `git diff --check`; frontend package bump diff check. Pushed to Forgejo; `origin` SSH port 222 was down during this session.
**Linked docs updated:** [[09 - Audits/DB Query & Schema Audit - 2026-06-06]]
---
## 2026-06-06 — DB Query & Schema Audit + Performance Fixes (v2.9.13) ## 2026-06-06 — DB Query & Schema Audit + Performance Fixes (v2.9.13)
**Commits:** backend `2484150` **Commits:** backend `2484150`

View File

@@ -17,6 +17,9 @@ updated: 2026-06-06
| Stats endpoint: 10 serial `findPurchaseRequests` queries → 1 `GROUP BY status` | `2484150` v2.9.13 | | Stats endpoint: 10 serial `findPurchaseRequests` queries → 1 `GROUP BY status` | `2484150` v2.9.13 |
| Offer filter: per-offer `sameUser()` calls (N×2 queries) → resolve-once + in-memory filter | `2484150` v2.9.13 | | Offer filter: per-offer `sameUser()` calls (N×2 queries) → resolve-once + in-memory filter | `2484150` v2.9.13 |
| Seller notification fan-out: in-JS filter + 100-row hard cap → SQL `watchedCategory` filter, no limit | `2484150` v2.9.13 | | Seller notification fan-out: in-JS filter + 100-row hard cap → SQL `watchedCategory` filter, no limit | `2484150` v2.9.13 |
| Auth user hydration: `rowToUser` child lookups per row → batched token/passkey/referrer hydration per result set | `4aa6ccb` v2.9.14 |
| Auth user save: users/tokens/passkeys independent writes → single `BEGIN`/`COMMIT` transaction with rollback | `4aa6ccb` v2.9.14 |
| Auth token/passkey save loops: one INSERT per child row → bulk token/passkey inserts inside the transaction | `4aa6ccb` v2.9.14 |
--- ---