chore(release): v1.4.25

Largest feature delta in the v1.4.x line. Insights expands into seven dedicated metric sub-pages; GLP-1 medication tracking lands end-to-end (drug-level chart with Research Mode acknowledgment, EMA titration ladder, cadence + compliance, side-effect taxonomy, pen/vial inventory); cross-source priority becomes a two-axis resolver; per-user timezone threads through ten analytics surfaces; Withings activity + sleep v2 sync; onboarding rebuilt as a nested-route wizard; Personal Records ship end-to-end; Health Score provenance accordion; Coach runs native first-party prompts across six locales with a 1800-assertion refusal-probe matrix; OpenAPI drift gate hard-fails; multi-arch GHCR image. Migrations 0043 through 0060 are additive and forward-only. PROMPT_VERSION 4.24.0 → 4.25.0 with GROUND RULE 9 (refuses dose recommendations) and GROUND RULE 15 (refuses drug-level estimates with MDR + MDCG 2021-24 cites).

See CHANGELOG.md for the full per-section delta.
This commit is contained in:
Marc-André Bombeck authored and GitHub committed 2026-05-14 23:49:32 +02:00
1 parent de0689e419
commit 17b8d8d2c2
528 files changed
+104033 -6524

No files matched your search

+12 -5
View File
@@ -120,11 +120,18 @@ test.describe("chart overlay controls", () => {
await expect(targetRangeToggle).toBeVisible({ timeout: 5_000 });
// Toggle target-range on. Radix Switch is a button[role=switch].
// Force the click — `scrollIntoViewIfNeeded()` on the portalled
// dropdown content is a no-op (the Radix portal sits at the body
// root, outside the page scroll container) so we bypass Playwright's
// viewport check directly.
await targetRangeToggle.click({ force: true });
// The Radix dropdown content portals to the body root and can land
// below the viewport on a 393×851 Pixel 5 (or near the bottom edge
// on the 1280×720 desktop profile). Playwright's `click({force:true})`
// still computes the element's bbox against the viewport and refuses
// to dispatch the click when it falls outside, so neither
// `scrollIntoViewIfNeeded()` on the portalled content nor `force`
// can rescue the action. `dispatchEvent('click')` synthesises a DOM
// click on the element without any viewport / actionability check,
// which is exactly the semantic we want for an off-screen portalled
// Radix Switch — and it still fires the onCheckedChange handler that
// the surface listens for.
await targetRangeToggle.dispatchEvent("click");
// The PUT fires once for the toggle change.
await expect.poll(() => putRequestCount).toBeGreaterThan(0);
+39 -19
View File
@@ -211,29 +211,49 @@ test.describe("charts — mobile-viewport regression", () => {
await firstChartCard.waitFor({ state: "visible", timeout: 10_000 });
await firstChartCard.scrollIntoViewIfNeeded();
// After scroll, give the chart a beat to lay out under the new
// measured size before counting ticks.
// measured size before counting ticks. The chart card on Pixel-5
// is taller than the 851-px viewport, so `scrollIntoViewIfNeeded`
// brings the card's TOP into view but the bottom-anchored x-axis
// labels can remain below the fold — `state: "attached"` is
// sufficient and stable against viewport overflow.
//
// Recharts 3.x DOM shift (v1.4.25): tick labels are no longer
// nested inside `.recharts-xAxis`. They render in a separate
// ZIndexLayer container `.recharts-xAxis-tick-labels` that sits
// as a sibling of the axis-line layer. Each label is a
// `.recharts-cartesian-axis-tick-label` <g> wrapping a
// <text class="recharts-text recharts-cartesian-axis-tick-value">.
// Wait on the label container's text node so the assertion is
// class-position-independent.
await page
.locator(".recharts-xAxis .recharts-cartesian-axis-tick text")
.locator(".recharts-xAxis-tick-labels text")
.first()
.waitFor({ state: "visible", timeout: 10_000 });
.waitFor({ state: "attached", timeout: 10_000 });
// Recharts lays its visible tick labels under
// `.recharts-xAxis .recharts-cartesian-axis-tick`. Count the ones
// that actually have rendered text (the helper also produces minor
// structural ticks without text labels, which we don't care about
// for legibility).
// Count rendered x-axis tick labels per wrapper. We scope to
// `.recharts-wrapper` so each chart is counted once, and read
// labels from `.recharts-xAxis-tick-labels` — the new (3.x)
// sibling container that holds the visible tick text. Empty
// structural ticks live in `.recharts-xAxis-tick-lines` and
// never carry text, so the labels-container is the right axis
// for legibility.
const tickCounts = await page.evaluate(() => {
const charts = Array.from(document.querySelectorAll(".recharts-xAxis"));
return charts.map((axis) => {
const ticks = Array.from(
axis.querySelectorAll(".recharts-cartesian-axis-tick"),
);
const visibleTicks = ticks.filter(
(t) =>
(t.querySelector("text")?.textContent?.trim() ?? "").length > 0,
);
return visibleTicks.length;
});
const wrappers = Array.from(
document.querySelectorAll(".recharts-wrapper"),
);
return wrappers
.map((wrapper) => {
const labels = Array.from(
wrapper.querySelectorAll(
".recharts-xAxis-tick-labels .recharts-cartesian-axis-tick-label",
),
);
const visibleLabels = labels.filter(
(l) => (l.textContent?.trim() ?? "").length > 0,
);
return visibleLabels.length;
})
.filter((n) => n > 0);
});
expect(tickCounts.length, "no recharts axes detected").toBeGreaterThan(0);
+78 -12
View File
@@ -110,20 +110,78 @@ test.describe("authenticated dashboard render", () => {
});
});
// The general-status insight card on /insights drives the "AI insight
// card" assertion. We mock its endpoint with a connected, populated
// payload so the card resolves to a real text body instead of the
// "Connect ChatGPT to enable" empty-state.
await page.route("**/api/insights/general-status*", (route) =>
// The /insights mother page gates the InsightAdvisorCard on
// `/api/insights/comprehensive` returning a non-null payload
// (`totalMeasurements` is the gate). Mock it so the page renders
// the card surface instead of the EmptyState CTA.
await page.route("**/api/insights/comprehensive", (route) =>
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
data: {
hasProvider: true,
text: "Your blood-pressure trend is stable. Continue current routine.",
cached: false,
updatedAt: new Date().toISOString(),
summaries: {},
bmi: 24.2,
bmiClassification: null,
bpClassification: null,
bpPctInTarget: 78,
bpTargets: { sysLow: 120, sysHigh: 140, diaLow: 80, diaHigh: 90 },
weightBpCorrelation: null,
scatterData: [],
bpMedicationCorrelation: null,
bpMedicationScatterData: [],
medications: [],
alerts: [],
hasOpenAiKey: true,
dataSpanDays: 90,
totalMeasurements: 25,
moodSummary: null,
moodBpCorrelation: null,
moodBpScatterData: [],
moodWeightCorrelation: null,
moodWeightScatterData: [],
moodPulseCorrelation: null,
moodPulseScatterData: [],
},
error: null,
}),
}),
);
// InsightAdvisorCard reads `/api/insights/generate` (a POST that
// doubles as cache-aware read). Mock a minimal-but-valid
// InsightResult so the card renders the populated body branch with
// the `data-slot="insight-summary"` container the assertion below
// pins on. The exact prose is intentionally NOT asserted — AI
// Insights are HealthLog's differentiator and the rendered text
// depends on provider + cache state. The contract under test is
// "an insight card with a populated body is visible", not "the
// string X is on screen".
await page.route("**/api/insights/generate", (route) =>
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
data: {
insights: {
insightType: "general",
summary: "Blood-pressure trend is stable; continue routine.",
classification: "gut",
classificationLabel: "Good",
findings: [],
correlations: [],
primaryRecommendation: "Keep up the current routine.",
recommendations: [],
dataQuality: {
coverage: "good",
gaps: [],
confidence: "hoch",
},
disclaimer: "Not medical advice.",
},
cached: true,
cachedAt: new Date().toISOString(),
legacyPayload: false,
},
error: null,
}),
@@ -161,11 +219,19 @@ test.describe("authenticated dashboard render", () => {
page.locator(".recharts-wrapper, .recharts-surface").first(),
).toBeVisible({ timeout: 10_000 });
// AI insight card: visit the dedicated /insights page (which is the
// only surface that mounts the general-status card by default).
// AI insight card: visit the dedicated /insights page (the
// mother surface that mounts the InsightAdvisorCard). We assert
// on the populated-card's stable structural hook
// (`data-slot="insight-summary"`) rather than a literal piece of
// AI prose. AI Insights are evidence-grounded and dynamic by
// design — the rendered text changes per provider + cache state
// and never repeats verbatim, so pinning a literal substring is
// brittle and contradicts the differentiator. The contract under
// test is "the insight card mounts its summary body when the
// payload arrives", which is exactly what the slot signals.
await page.goto("/insights", { waitUntil: "domcontentloaded" });
await expect(
page.getByText("Your blood-pressure trend is stable", { exact: false }),
page.locator('[data-slot="insight-summary"]'),
).toBeVisible({ timeout: 10_000 });
// Filter out a small set of known-noise messages — we care about
+1 -1
View File
@@ -23,7 +23,7 @@ test.describe("locale switch", () => {
test.info().project.use.baseURL ?? "http://localhost:3000";
await context.addCookies([
{
name: "healthlog_locale",
name: "healthlog-locale",
value: locale,
url: baseURL,
},