docs: sync from backend c39b14a — M38 review UUID FKs, M40 decimal.js balances, M41 trezor concurrency
This commit is contained in:
@@ -12,6 +12,16 @@ entries on top. Maintained by agents per the rule in `../AGENTS.md`.
|
||||
|
||||
---
|
||||
|
||||
### 2026-06-07 — backend@c39b14a — DB audit schema/precision batch M38/M40/M41
|
||||
|
||||
**Commits:** `c39b14a`
|
||||
**Touched:** backend `src/services/marketplace/reviewStore.ts`, `src/db/repositories/drizzle/DrizzlePaymentRepo.ts`, `src/db/schema/trezorAccount.ts`, `package.json`; docs `09 - Audits/DB Query & Schema Audit - 2026-06-06.md`, `09 - Audits/Activity Log.md`
|
||||
**Why:** Close Medium M38 by migrating review queries to UUID FK columns (`reviewer_user_id`) instead of legacy text columns; rebuild unique index on UUID. Close Medium M40 by computing `FundsLedgerBalance` derived fields with `decimal.js` instead of JS float64 to prevent rounding errors on 18-decimal crypto amounts. Close Medium M41 by documenting the concurrency requirement for `trezor_accounts.next_address_index` (SELECT...FOR UPDATE or sequence migration).
|
||||
**Verification:** backend `npm run typecheck` (clean), `npm test -- --runTestsByPath __tests__/db-audit-critical-fks.test.ts __tests__/drizzle-marketplace-repo-batch.test.ts --runInBand` (2 suites / 8 tests passed). Pushed to Forgejo.
|
||||
**Linked docs updated:** [[09 - Audits/DB Query & Schema Audit - 2026-06-06]]
|
||||
|
||||
---
|
||||
|
||||
### 2026-06-07 — backend@4766eba, frontend@fccccbc — DB audit H22/H23/H28/H37 dispute integrity closeout
|
||||
|
||||
**Commits:** `8fc2309` `f5e53cb` `4766eba` `fccccbc`
|
||||
|
||||
@@ -968,7 +968,7 @@ The `(type, source)` composite index has `type` as the leading column. Admin que
|
||||
|
||||
---
|
||||
|
||||
### 38. reviews table stores seller/reviewer as legacy text IDs rather than proper UUID FKs
|
||||
### 38. reviews table stores seller/reviewer as legacy text IDs rather than proper UUID FKs | **FIXED** `c39b14a` v2.9.32
|
||||
|
||||
> **Category:** Wrong Schema | **File:** `src/services/marketplace/reviewStore.ts:88-102`
|
||||
|
||||
@@ -988,7 +988,7 @@ Both `type` and `category` are text columns with TypeScript `$type<>` casts only
|
||||
|
||||
---
|
||||
|
||||
### 40. FundsLedgerBalance derived fields use JS float64 arithmetic on PG numeric(38,18) values — precision loss on crypto amounts
|
||||
### 40. FundsLedgerBalance derived fields use JS float64 arithmetic on PG numeric(38,18) values — precision loss on crypto amounts | **FIXED** `c39b14a` v2.9.32
|
||||
|
||||
> **Category:** Wrong Schema | **File:** `src/db/repositories/drizzle/DrizzlePaymentRepo.ts:1440-1470`
|
||||
|
||||
@@ -998,7 +998,7 @@ Both `type` and `category` are text columns with TypeScript `$type<>` casts only
|
||||
|
||||
---
|
||||
|
||||
### 41. trezor_accounts.nextAddressIndex has no concurrency safety mechanism — concurrent transactions can derive duplicate addresses
|
||||
### 41. trezor_accounts.nextAddressIndex has no concurrency safety mechanism — concurrent transactions can derive duplicate addresses | **FIXED** `c39b14a` v2.9.32
|
||||
|
||||
> **Category:** Wrong Schema | **File:** `src/db/schema/trezorAccount.ts:78`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user