mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
v1.4.36 — perf, charts, AI payload trim, UX punch
Heavy-aggregate skip on the rollup-fresh + fully-covered path, daily chart fetches opt into rollup buckets via source=rollup, Insights extractFeatures swap drops the prompt payload from double-digit MB to the low hundreds of kB on power-user accounts, page-level isLoading gate replaced with per-section early-skeleton paint, trends-row chart slot pinned for CLS, IntakeHistoryListV2 restored on the medication detail page, About card folded into the Admin Console with an auto-checking update badge, cumulative metric tiles read the day's running sum, IP-whois fallback surfaces city + country when the ASN lookup misses. Migration 0068 adds an additive users.insights_exclude_metrics column. Unit suite 4354 passing; typecheck + lint clean.
This commit is contained in:
1 parent
5a3ca330ac
commit
0e2a99f8e7
70 files changed
+4982
-810
No files matched your search
@@ -56,7 +56,9 @@ describe("coachPrefsSchema", () => {
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it("caps excludeMetrics at 9 entries", () => {
|
||||
it("caps excludeMetrics at 11 entries", () => {
|
||||
// v1.4.36 W3 T2 — cap raised from 9 to 11 to admit the two new
|
||||
// optional-context toggles (medications, anthropometrics).
|
||||
const result = coachPrefsSchema.safeParse({
|
||||
excludeMetrics: [
|
||||
"bp",
|
||||
@@ -68,11 +70,20 @@ describe("coachPrefsSchema", () => {
|
||||
"sleep",
|
||||
"resting_hr",
|
||||
"steps",
|
||||
"medications",
|
||||
"anthropometrics",
|
||||
"bp",
|
||||
],
|
||||
});
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it("accepts the new medications + anthropometrics tokens", () => {
|
||||
const out = coachPrefsSchema.parse({
|
||||
excludeMetrics: ["medications", "anthropometrics"],
|
||||
});
|
||||
expect(out.excludeMetrics).toEqual(["medications", "anthropometrics"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseCoachPrefs", () => {
|
||||
|
||||
@@ -55,6 +55,14 @@ export const coachExcludeMetricEnum = z.enum([
|
||||
"sleep",
|
||||
"resting_hr",
|
||||
"steps",
|
||||
// v1.4.36 W3 T2 — optional context blocks the user can opt out of.
|
||||
// `medications` covers the snapshot's compliance + GLP-1 weeklyContext;
|
||||
// `anthropometrics` covers height / age / gender on `context`. Each
|
||||
// gates a single labelled block at the snapshot/feature layer, so an
|
||||
// excluded block never lands in the prompt at all (not even as a
|
||||
// labelled-empty key).
|
||||
"medications",
|
||||
"anthropometrics",
|
||||
]);
|
||||
export type CoachExcludeMetric = z.infer<typeof coachExcludeMetricEnum>;
|
||||
|
||||
@@ -83,7 +91,7 @@ export type CoachDefaultWindow = z.infer<typeof coachDefaultWindowEnum>;
|
||||
export const coachPrefsSchema = z.object({
|
||||
tone: coachToneEnum.default("warm"),
|
||||
verbosity: coachVerbosityEnum.default("default"),
|
||||
excludeMetrics: z.array(coachExcludeMetricEnum).max(9).default([]),
|
||||
excludeMetrics: z.array(coachExcludeMetricEnum).max(11).default([]),
|
||||
showEvidenceByDefault: z.boolean().default(false),
|
||||
defaultWindow: coachDefaultWindowEnum.default("allTime"),
|
||||
});
|
||||
|
||||
@@ -262,6 +262,16 @@ export const listMeasurementsSchema = z.object({
|
||||
// Omitting `aggregate` keeps the raw wire shape (iOS contract); the
|
||||
// chart-data client must opt in explicitly.
|
||||
aggregate: z.enum(["raw", "daily", "weekly", "monthly"]).optional(),
|
||||
// v1.4.36 W1 — opt-in source switch for daily-aggregate reads. When
|
||||
// `source=rollup` + `aggregate=daily`, the route reads from the
|
||||
// persistent `measurement_rollups` DAY buckets instead of running a
|
||||
// live `date_trunc` GROUP BY scan over the raw `measurements` table.
|
||||
// The chart-data client opts in for the trends-row strip + every
|
||||
// sub-page chart so the three parallel daily-aggregate requests stop
|
||||
// burning a full table scan each. The route falls back to live SQL
|
||||
// when the rollup bucket set is empty for the requested window so
|
||||
// brand-new accounts still see correct data on their first chart.
|
||||
source: z.enum(["rollup"]).optional(),
|
||||
});
|
||||
|
||||
export const createBatchMeasurementSchema = z.object({
|
||||
|
||||
Reference in new issue
Block a user