Files
vigilcare-records/docs/plans/phase-22-plan.md
T
Trent a17bc2b734
CI / changes (push) Successful in 17s
dotnet8-ci / build-and-test (push) Successful in 8m23s
CI / backend (push) Successful in 8m24s
node-ci / build (push) Failing after 2m1s
CI / frontend (push) Failing after 2m2s
Harden API memory and CPU usage across Phases 19–22.
Bound list/PDF payloads, stream MinIO I/O with cancellation, paginate history and FHIR $everything, tighten OCR lifetimes/buffers, and add phase tracking docs.
2026-11-30 23:55:56 +08:00

3.0 KiB
Raw Blame History

Phase 22 — Polish and Ops

What exists

Requires Phase 21. Tracker: performance-hardening-overview.md.

What needs to be built

Long-running / edge-case hardening and ops documentation. Do not raise the container memory limit with invented numbers — document how to measure with dotnet-counters and only change the limit if justified by measured peak.


Step 1 — Cap fuzzy same-DOB candidates

  • Before Levenshtein, .Take(50) (or equivalent) on same-DOB projection.
  • Keep warning logs for near-misses within the capped set.

Step 2 — Seed MinIO loop + CT

  • Honor CancellationToken through seed document storage.
  • Reduce N+1 pressure: skip exists checks when unnecessary, or batch/limit work; bootstrap must still succeed on empty and re-run environments.

Step 3 — PromoteAsync CancellationToken

  • Add CT to IPromotionService.PromoteAsync and pass from PromotionRetryService.
  • Propagate into EF calls inside promote where practical.

Step 4 — Ops notes + user directory clamp

  • Add a short comment near the 1 G limit in docker-compose.prod.yml pointing at counters workflow in the overview (do not invent a new limit).
  • Clamp UserDirectoryService.ListByRoleAsync with a sane max (e.g. 500) or document intentional unbounded small directories — prefer clamp for safety.

Success criteria

  • Same-DOB fuzzy path never loads more than the configured Take cap
  • Seed bootstrap respects CT and does not regress empty-DB seed
  • Promotion retry still promotes with CT plumbed
  • User directory list is capped
  • Overview + this plan checklists updated; gap-analysis matrix rows 26–31 marked Done when Phases 19–22 complete
  • dotnet test passes

Out of scope

  • Premature GC mode changes
  • Raising memory limit without measured peak evidence
  • Frontend redesign

Verification

  1. dotnet test VigilCareRecordsAPI.Tests/VigilCareRecordsAPI.Tests.csproj
  2. Smoke bootstrap against local compose
  3. Mark overview Phase 22 + findings 9, 14, 15 → Done; mark Phases 19–22 complete in PRD / plans README when all merge

Gate

Performance hardening stream complete when this phase and overview checklists are Done.