mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
docs(jobs): correct two migration citations and the import dedup contract
The retention-purge comments still cite migration 0277 for indexes that landed in 0276 — the renumbering moved the directories and left the prose behind. The schema is trustworthy because its comments are, so a wrong number is not cosmetic. The import worker's `already_recorded` reason claimed the skip covers a dose recorded on any other intake surface. It does not: `source` is part of the live-row unique, so a hand-logged dose and an imported one at the same slot are different keys and both are written. Say what the mechanism actually does, and say plainly that cross-surface dedup is not there.
This commit is contained in:
1 parent
1a6e523b29
commit
1c05bba56c
3 files changed
+9
-4
No files matched your search
@@ -37,7 +37,7 @@ export function getAuditLogRetentionDays(): number {
|
||||
* on every removed row. Past the 60-second `statement_timeout` that aborts and
|
||||
* rolls back, and the next night repeats it against the same rows — a
|
||||
* retention window that can never close on an instance that has accumulated
|
||||
* enough of them. Migration 0277 adds the `created_at` index; the batching
|
||||
* enough of them. Migration 0276 adds the `created_at` index; the batching
|
||||
* keeps any single statement bounded regardless.
|
||||
*/
|
||||
export async function cleanupOldAuditLogs(
|
||||
|
||||
@@ -38,7 +38,7 @@ function tombstoneCutoff(now: Date): Date {
|
||||
* the transaction rolled back, and the next night ran the identical statement
|
||||
* against the same rows. `measurements` is the densest table in the schema and
|
||||
* a bulk source delete can tombstone a six-figure row count in one action, so
|
||||
* this is the one most likely to have been stuck. Migration 0277 adds the
|
||||
* this is the one most likely to have been stuck. Migration 0276 adds the
|
||||
* partial index the predicate needs.
|
||||
*/
|
||||
export async function cleanupExpiredMeasurementTombstones(
|
||||
|
||||
@@ -58,8 +58,13 @@ export interface MedicationImportPayload {
|
||||
*
|
||||
* `duplicate_in_file` — two rows of the same submission resolve to the same
|
||||
* medication and slot, so only one can be written.
|
||||
* `already_recorded` — the dose is already on the ledger for that slot, from an
|
||||
* earlier import or from any other intake surface.
|
||||
* `already_recorded` — the dose is already on the ledger for that slot from an
|
||||
* earlier import. `source` is part of the live-row unique
|
||||
* `(user_id, medication_id, scheduled_for, source)`, so this does NOT cover a
|
||||
* dose the person logged by hand at the same slot on another surface: that row
|
||||
* and the imported one are distinct keys and both are written. Cross-surface
|
||||
* dedup is a slot-window question, not a unique-key one, and it does not exist
|
||||
* yet — do not read this reason as though it did.
|
||||
*
|
||||
* Those two used to be one `skippedDuplicates` number, which is how a file whose
|
||||
* every row collapsed onto one key could report "27 duplicates skipped" about 27
|
||||
|
||||
Reference in new issue
Block a user