feat(backup): carry a lab result's external identity through backup and restore

Both the disaster-recovery and the portable file now carry
lab_results.external_id, and a restore writes it back, so a restored
account still recognises a Health Records result when it arrives again
and a deleted one stays deleted. Older files restore unchanged.
This commit is contained in:
Marc-André Bombeck committed 2026-11-17 18:53:52 +01:00
1 parent 376102a71e
commit 72a05ea411
8 files changed
+44 -20

No files matched your search

@@ -902,8 +902,8 @@
"id": "<id:37>",
"biomarkerId": "<id:38>",
"noteEncrypted": "<sealed:v1:rt-LabResult-noteEncrypted>",
"createdAt": "2026-05-02T10:58:00.000Z",
"updatedAt": "2026-05-02T10:59:00.000Z",
"createdAt": "2026-05-02T10:59:00.000Z",
"updatedAt": "2026-05-02T11:00:00.000Z",
"deletedAt": null,
"note": null,
"panel": "rt-LabResult-panel",
@@ -920,14 +920,15 @@
"sourceUnit": "rt-LabResult-sourceUnit",
"takenAt": "2026-06-30T09:00:00.000Z",
"source": "rt-LabResult-source",
"externalId": "rt-LabResult-externalId",
"biomarkerName": "Ferritin"
},
{
"id": "<id:39>",
"biomarkerId": null,
"noteEncrypted": null,
"createdAt": "2026-05-02T10:58:01.000Z",
"updatedAt": "2026-05-02T10:59:01.000Z",
"createdAt": "2026-05-02T10:59:01.000Z",
"updatedAt": "2026-05-02T11:00:01.000Z",
"deletedAt": "<tombstone>",
"note": null,
"panel": null,
@@ -944,6 +945,7 @@
"sourceUnit": null,
"takenAt": "2026-05-30T09:00:00.000Z",
"source": "MANUAL",
"externalId": null,
"biomarkerName": null
}
],
@@ -3361,13 +3363,14 @@
"sourceUnit": "rt-LabResult-sourceUnit",
"takenAt": "2026-06-30T09:00:00.000Z",
"source": "rt-LabResult-source",
"externalId": "rt-LabResult-externalId",
"biomarkerName": "Ferritin",
"biomarkerId": "<id:38>",
"note": null,
"createdAt": "2026-05-02T10:58:00.000Z",
"createdAt": "2026-05-02T10:59:00.000Z",
"noteEncrypted": "<sealed:v1:rt-LabResult-noteEncrypted>",
"deletedAt": null,
"updatedAt": "2026-05-02T10:59:00.000Z"
"updatedAt": "2026-05-02T11:00:00.000Z"
},
{
"id": "<id:39>",
@@ -3385,13 +3388,14 @@
"sourceUnit": null,
"takenAt": "2026-05-30T09:00:00.000Z",
"source": "MANUAL",
"externalId": null,
"biomarkerName": null,
"biomarkerId": null,
"note": null,
"createdAt": "2026-05-02T10:58:01.000Z",
"createdAt": "2026-05-02T10:59:01.000Z",
"noteEncrypted": null,
"deletedAt": "<tombstone>",
"updatedAt": "2026-05-02T10:59:01.000Z"
"updatedAt": "2026-05-02T11:00:01.000Z"
}
],
"biomarkers": [
@@ -547,6 +547,7 @@
"sourceUnit": "rt-LabResult-sourceUnit",
"takenAt": "2026-06-30T09:00:00.000Z",
"source": "rt-LabResult-source",
"externalId": "rt-LabResult-externalId",
"biomarkerName": "Ferritin"
}
],
@@ -2216,6 +2217,7 @@
"sourceUnit": "rt-LabResult-sourceUnit",
"takenAt": "2026-06-30T09:00:00.000Z",
"source": "rt-LabResult-source",
"externalId": "rt-LabResult-externalId",
"biomarkerName": "Ferritin",
"note": "rt-LabResult-noteEncrypted"
}
@@ -962,9 +962,10 @@
"takenAt": "2026-06-30T09:00:00.000Z",
"biomarkerId": "<id:26>",
"source": "rt-LabResult-source",
"externalId": "rt-LabResult-externalId",
"noteEncrypted": "<sealed:v1:rt-LabResult-noteEncrypted>",
"createdAt": "2026-05-02T10:58:00.000Z",
"updatedAt": "2026-05-02T10:59:00.000Z",
"createdAt": "2026-05-02T10:59:00.000Z",
"updatedAt": "2026-05-02T11:00:00.000Z",
"deletedAt": null
},
{
@@ -985,9 +986,10 @@
"takenAt": "2026-05-30T09:00:00.000Z",
"biomarkerId": null,
"source": "MANUAL",
"externalId": null,
"noteEncrypted": null,
"createdAt": "2026-05-02T10:58:01.000Z",
"updatedAt": "2026-05-02T10:59:01.000Z",
"createdAt": "2026-05-02T10:59:01.000Z",
"updatedAt": "2026-05-02T11:00:01.000Z",
"deletedAt": "<tombstone>"
}
],
@@ -3824,8 +3826,8 @@
"id": "<id:37>",
"biomarkerId": "<id:38>",
"noteEncrypted": "<sealed:v1:rt-LabResult-noteEncrypted>",
"createdAt": "2026-05-02T10:58:00.000Z",
"updatedAt": "2026-05-02T10:59:00.000Z",
"createdAt": "2026-05-02T10:59:00.000Z",
"updatedAt": "2026-05-02T11:00:00.000Z",
"deletedAt": null,
"note": null,
"panel": "rt-LabResult-panel",
@@ -3842,14 +3844,15 @@
"sourceUnit": "rt-LabResult-sourceUnit",
"takenAt": "2026-06-30T09:00:00.000Z",
"source": "rt-LabResult-source",
"externalId": "rt-LabResult-externalId",
"biomarkerName": "Ferritin"
},
{
"id": "<id:39>",
"biomarkerId": null,
"noteEncrypted": null,
"createdAt": "2026-05-02T10:58:01.000Z",
"updatedAt": "2026-05-02T10:59:01.000Z",
"createdAt": "2026-05-02T10:59:01.000Z",
"updatedAt": "2026-05-02T11:00:01.000Z",
"deletedAt": "<tombstone>",
"note": null,
"panel": null,
@@ -3866,6 +3869,7 @@
"sourceUnit": null,
"takenAt": "2026-05-30T09:00:00.000Z",
"source": "MANUAL",
"externalId": null,
"biomarkerName": null
}
],
@@ -976,6 +976,7 @@
"takenAt": "2026-06-30T09:00:00.000Z",
"biomarkerId": "<id:23>",
"source": "rt-LabResult-source",
"externalId": "rt-LabResult-externalId",
"noteEncrypted": "<sealed:v2:rt-LabResult-noteEncrypted>",
"createdAt": "<now>",
"updatedAt": "<now>",
@@ -2963,6 +2964,7 @@
"sourceUnit": "rt-LabResult-sourceUnit",
"takenAt": "2026-06-30T09:00:00.000Z",
"source": "rt-LabResult-source",
"externalId": "rt-LabResult-externalId",
"biomarkerName": "Ferritin"
}
],
@@ -738,6 +738,7 @@
"takenAt": "2026-07-05T08:00:00.000Z",
"biomarkerId": "<id:14>",
"source": "MANUAL",
"externalId": null,
"noteEncrypted": "<sealed:v2:morning draw>",
"createdAt": "<now>",
"updatedAt": "<now>",
@@ -1635,6 +1636,7 @@
"sourceUnit": null,
"takenAt": "2026-07-05T08:00:00.000Z",
"source": "MANUAL",
"externalId": null,
"biomarkerName": "Ferritin"
}
],
@@ -557,9 +557,10 @@
"takenAt": "2026-06-30T09:00:00.000Z",
"biomarkerId": "<id:26>",
"source": "rt-LabResult-source",
"externalId": "rt-LabResult-externalId",
"noteEncrypted": "<sealed:v1:rt-LabResult-noteEncrypted>",
"createdAt": "2026-05-02T10:58:00.000Z",
"updatedAt": "2026-05-02T10:59:00.000Z",
"createdAt": "2026-05-02T10:59:00.000Z",
"updatedAt": "2026-05-02T11:00:00.000Z",
"deletedAt": null
},
{
@@ -580,9 +581,10 @@
"takenAt": "2026-05-30T09:00:00.000Z",
"biomarkerId": null,
"source": "MANUAL",
"externalId": null,
"noteEncrypted": null,
"createdAt": "2026-05-02T10:58:01.000Z",
"updatedAt": "2026-05-02T10:59:01.000Z",
"createdAt": "2026-05-02T10:59:01.000Z",
"updatedAt": "2026-05-02T11:00:01.000Z",
"deletedAt": "<tombstone>"
}
],