Bound list/PDF payloads, stream MinIO I/O with cancellation, paginate history and FHIR $everything, tighten OCR lifetimes/buffers, and add phase tracking docs.
3.0 KiB
3.0 KiB
Phase 22 — Polish and Ops
What exists
PromotionServiceloads all same-DOB patients for Levenshtein logging before creating a new patient.SeedDocumentStorageStatObject/Put per batch on bootstrap.PromoteAsync/ seed paths used by hosted services omitCancellationToken.docker-compose.prod.ymlsets APImemory: 1Gwith no measured guidance comment.UserDirectoryService.ListByRoleAsyncis unbounded.
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
CancellationTokenthrough 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.PromoteAsyncand pass fromPromotionRetryService. - 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.ymlpointing at counters workflow in the overview (do not invent a new limit). - Clamp
UserDirectoryService.ListByRoleAsyncwith 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 testpasses
Out of scope
- Premature GC mode changes
- Raising memory limit without measured peak evidence
- Frontend redesign
Verification
dotnet test VigilCareRecordsAPI.Tests/VigilCareRecordsAPI.Tests.csproj- Smoke bootstrap against local compose
- 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.