Merge branch 'v143/dawarich' into release/v1.43.0

# Conflicts:
#	src/__tests__/contract-stub-inventory.test.ts
This commit is contained in:
Marc-André Bombeck committed 2026-10-16 02:51:02 +02:00
commit da860aeb3e
101 files changed
+5354 -216

No files matched your search

+3
View File
@@ -113,6 +113,8 @@ export interface BackupSummary {
environmentContexts: number;
/** Declared stretches spent away from home. */
environmentTravelLocations: number;
/** Local days of Dawarich movement values. */
dawarichDays: number;
/** ECG strips, with their rhythm verdict and their trace. */
ecgRecordings: number;
}
@@ -209,6 +211,7 @@ export function summarizeBackup(payload: BackupPayload): BackupSummary {
userAchievements: payload.userAchievements.length,
environmentContexts: payload.environmentContexts.length,
environmentTravelLocations: payload.environmentTravelLocations.length,
dawarichDays: payload.dawarichDays.length,
ecgRecordings: payload.ecgRecordings.length,
};
}
+34
View File
@@ -1651,6 +1651,37 @@ const environmentTravelLocationBackupSchema = z
})
.passthrough();
/**
* v1.43 — one local day of Dawarich movement values. Daily values only; the
* country rides readable (portable) or sealed (disaster recovery).
*/
const dawarichDayBackupSchema = z
.object({
date: environmentDayKey,
totalDistanceM: z.number().int().nonnegative().nullable().optional(),
drivingDistanceM: z.number().int().nonnegative().nullable().optional(),
trainDistanceM: z.number().int().nonnegative().nullable().optional(),
placesVisited: z.number().int().nonnegative().nullable().optional(),
awayFromHomeMinutes: z
.number()
.int()
.min(0)
.max(25 * 60)
.nullable()
.optional(),
countryCode: z
.string()
.regex(/^[A-Z]{2}$/)
.nullable()
.optional(),
countryCodeEncrypted: base64BytesSchema.nullable().optional(),
isTravelDay: z.boolean().nullable().optional(),
fetchedAt: isoDateTime.optional(),
createdAt: isoDateTime.optional(),
updatedAt: isoDateTime.optional(),
})
.passthrough();
/**
* A turn's stored tables, bounded at restore. The live path never stores more
* than `RESULTS_MAX_BYTES` of table JSON per turn (`fitResultsToStorage`), so
@@ -2293,6 +2324,9 @@ export const backupPayloadSchema = z
environmentTravelLocations: z
.array(environmentTravelLocationBackupSchema)
.default([]),
// v1.43 — the Dawarich movement days, restored with the environment
// section. A file written before them carries no key.
dawarichDays: z.array(dawarichDayBackupSchema).default([]),
// The ECG strips. Defaulted for the same reason as the sections above: a
// file written before the recordings travelled carries no key, and an
// account whose watch has never taken one writes [].