mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
Before the confirm step dated an undated value by its document, a lab value confirmed from a report that prints its collection date only in the header was stored with takenAt set to the moment of confirmation. The fix covers new confirms; the values already filed that way stay on the wrong day until something moves them. A one-shot maintenance job, sent at boot only while there is something to repair, moves exactly those values to the document's report date (else its filing date) at noon UTC, the same rule the confirm step now uses. A value qualifies only when the chain is certain: written by the document confirm path, named by exactly one approved observation fact, takenAt still within five seconds of its own createdAt, no calendar date of its own in the decrypted fact, and a document day that differs from the day the value is filed under in the owner's zone. A value re-dated since, one really taken on its confirmation day, or one whose document has no date is left alone. A moved value no longer sits at its creation moment, so the pass converges and a second run changes nothing. The job definition lives in a new registry file beside maintenance.ts so that file stays under the size ratchet.