[Refactor] Загружать banking page relations ограниченным batch #68

Closed
opened 2026-10-11 21:47:21 +03:00 by codex-bot · 1 comment
Owner

Problem

History/purchase picker reuse operationView loader: page cost 3+Σ(1+t+s+c+r) Prisma model reads, одни card/category/refund families читаются повторно. Embedded SQLite не имеет remote RTT; практическая latency выгода не измерена.

Expected Behavior

Page projection сохраняет exact DTO/ownership/refund semantics при bounded distinct relation reads; если gain не оправдывает maintenance, допустим evidence-backed KEEP.

Evidence

Audit date 2026-10-11; 07. IDs FLOW-005, TA-F11. Revision 0ad84ff4f0b4712abc7e69dc299856f14af6eadd; Confidence High structure/Medium benefit; Verification status static.
Affected: bank-operations.service.ts:333–369, :41–91; bank-cards.repository.ts:62–72; test/bank-cards.e2e-spec.ts:424–462,550–580,779–791.

Scope

In scope

Page-only bounded cards/source expenses/categories/refunds reads и controlled cost trace.

Out of scope

Изменение write/single-operation path, снятие transaction/CAS/replay, новый cache/BFF/index без profile.

Proposed Approach

Сохранить read transaction, batch distinct relations и existing projection; пустая page не loads relations. Refund availableRefund исключает текущую row, expense — нет.

Acceptance Criteria

  • Mixed income/transfer/expense/refund-family DTO равно baseline, включая archived/deleted/foreign cases и exact bigint totals.
  • Relation query count не увеличивается на отдельный loader каждой row; owner predicate есть в каждом batch.
  • Isolated before/after query/duration trace записан; принят narrow batch либо explicit KEEP при neutral gain/лишней сложности.

Verification

Existing bank-cards SQLite cases, controlled 10/100-row pages и query trace; final backend gates при коде. Не заявлять include=один SQL без actual trace.

Dependencies

Нет; тестовые prerequisites T13 полезны, но не технический blocker.

Traceability

Campaign WealthLedger/main#23 . Findings FLOW-005, TA-F11. WealthLedger/backend; T17.

<!-- wealthledger-audit:2026-10-11:banking-page-reads --> ## Problem History/purchase picker reuse operationView loader: page cost 3+Σ(1+t+s+c+r) Prisma model reads, одни card/category/refund families читаются повторно. Embedded SQLite не имеет remote RTT; практическая latency выгода не измерена. ## Expected Behavior Page projection сохраняет exact DTO/ownership/refund semantics при bounded distinct relation reads; если gain не оправдывает maintenance, допустим evidence-backed KEEP. ## Evidence Audit date `2026-10-11`; [07](https://git.personal.ksv741.ru/WealthLedger/main/src/commit/d07fbfabb1295780952a554185989d2d5b5c8349/audits/2026-10-11/reports/07-api-and-data-flow-efficiency-report.md). IDs FLOW-005, TA-F11. Revision `0ad84ff4f0b4712abc7e69dc299856f14af6eadd`; Confidence High structure/Medium benefit; Verification status static. Affected: [bank-operations.service.ts:333–369](https://git.personal.ksv741.ru/WealthLedger/backend/src/commit/0ad84ff4f0b4712abc7e69dc299856f14af6eadd/src/modules/banking/bank-cards/application/bank-operations.service.ts#L333-L369), :41–91; bank-cards.repository.ts:62–72; test/bank-cards.e2e-spec.ts:424–462,550–580,779–791. ## Scope ### In scope Page-only bounded cards/source expenses/categories/refunds reads и controlled cost trace. ### Out of scope Изменение write/single-operation path, снятие transaction/CAS/replay, новый cache/BFF/index без profile. ## Proposed Approach Сохранить read transaction, batch distinct relations и existing projection; пустая page не loads relations. Refund availableRefund исключает текущую row, expense — нет. ## Acceptance Criteria - [ ] Mixed income/transfer/expense/refund-family DTO равно baseline, включая archived/deleted/foreign cases и exact bigint totals. - [ ] Relation query count не увеличивается на отдельный loader каждой row; owner predicate есть в каждом batch. - [ ] Isolated before/after query/duration trace записан; принят narrow batch либо explicit KEEP при neutral gain/лишней сложности. ## Verification Existing bank-cards SQLite cases, controlled 10/100-row pages и query trace; final backend gates при коде. Не заявлять include=один SQL без actual trace. ## Dependencies Нет; тестовые prerequisites T13 полезны, но не технический blocker. ## Traceability Campaign https://git.personal.ksv741.ru/WealthLedger/main/issues/23 . Findings FLOW-005, TA-F11. WealthLedger/backend; T17.
codex-bot added this to the Technical Audit Remediation — 2026-10-11 milestone 2026-10-11 21:47:21 +03:00
codex-bot added the Kind/Enhancement
Priority
Medium
3
audit/2026-10-11
labels 2026-10-11 21:47:21 +03:00
codex-bot was assigned by hermes-agent 2026-10-12 00:04:21 +03:00
hermes-agent added this to the WealthLedger — Delivery Board project 2026-10-12 00:04:21 +03:00
hermes-agent added Kind/Refactor and removed Kind/Enhancement labels 2026-10-12 00:04:21 +03:00
Author
Owner

Implemented and merged via #86 (285dd08).

Page projection now batches owner-scoped cards, source expenses, categories, and refunds in the existing read transaction. Singleton/create/update paths remain unchanged. Verified by lint, application/test typechecks, build, and bank-cards.e2e-spec.ts.

Implemented and merged via #86 (`285dd08`). Page projection now batches owner-scoped cards, source expenses, categories, and refunds in the existing read transaction. Singleton/create/update paths remain unchanged. Verified by lint, application/test typechecks, build, and `bank-cards.e2e-spec.ts`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: WealthLedger/backend#68