mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 04:32:42 +00:00
Taking the weekly preview from the writer dropped the schema check the old scanner ran at the end, so a copy that violates the schema was described as restorable. The collector now checks each section in its JSON form as the writer shows it, an array section and a bulk table one element at a time, plus the schema's one whole-document rule (a canonical copy names every measurement by id). A copy that fails gets no stored preview, and the preview route reads the copy itself, as it did before. Nothing is kept beyond one element. Measured on the preview memory test under --max-old-space-size=524: held after the producer 3 MB with and without the check, raw peak heapUsed 293 MB with it (335 MB without). The test now loads the backup schema before its baseline: a module loaded once per process, not memory that grows with the record.