From ee560a435cc4dd8a5bf7ba8c1f9b05e27aed6393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 14 May 2026 18:57:45 +0200 Subject: [PATCH] fix(medications): glp1 drift test self-skips when research file is absent The drift guard read `.planning/research/glp1-feature-inspiration.md` unconditionally and threw an ENOENT at collection time on CI, where `.planning/` is local-only. The hard-pin block (TS module vs cited EMA EPAR / psp4.13099 values) is the real production guarantee and keeps running everywhere; the soft-pin blocks that grep the research markdown now `describe.skipIf` when the file is missing. --- .../__tests__/glp1-knowledge-drift.test.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/medications/__tests__/glp1-knowledge-drift.test.ts b/src/lib/medications/__tests__/glp1-knowledge-drift.test.ts index c0eced312..f5f05b1a9 100644 --- a/src/lib/medications/__tests__/glp1-knowledge-drift.test.ts +++ b/src/lib/medications/__tests__/glp1-knowledge-drift.test.ts @@ -1,4 +1,4 @@ -import { readFileSync } from "node:fs"; +import { existsSync, readFileSync } from "node:fs"; import { join } from "node:path"; import { describe, expect, it } from "vitest"; @@ -27,6 +27,10 @@ import { GLP1_DRUGS } from "@/lib/medications/glp1-knowledge"; * a percent without a regulatory rationale fails the test before * it reaches production. The clinical reading layer (Coach, * inventory countdown, titration card) can trust the catalog. + * + * `.planning/` is untracked by design (local-only research artefacts), + * so the soft-pin block self-skips on CI where the file is absent. The + * hard pins always run and are the real production guarantee. */ const RESEARCH_PATH = join( @@ -34,7 +38,8 @@ const RESEARCH_PATH = join( "../../../../.planning/research/glp1-feature-inspiration.md", ); -const RESEARCH_TEXT = readFileSync(RESEARCH_PATH, "utf8"); +const RESEARCH_AVAILABLE = existsSync(RESEARCH_PATH); +const RESEARCH_TEXT = RESEARCH_AVAILABLE ? readFileSync(RESEARCH_PATH, "utf8") : ""; /** Hard pins — these are the exact values the research file cites * against EMA EPAR / psp4.13099. If you change the TS module, you @@ -155,7 +160,10 @@ describe("glp1-knowledge drift guard", () => { } }); - describe("research-file citation presence", () => { + // Local-only soft pins: the research markdown lives under `.planning/` + // which is untracked, so the block is a no-op on CI. Marc's local + // working copy keeps the file and the assertions run there. + describe.skipIf(!RESEARCH_AVAILABLE)("research-file citation presence", () => { it("references the EMA Mounjaro EPAR for tirzepatide", () => { expect(RESEARCH_TEXT).toMatch(/mounjaro-epar-product-information/); }); @@ -195,7 +203,7 @@ describe("glp1-knowledge drift guard", () => { }); }); - describe("research-file presence checks for module values", () => { + describe.skipIf(!RESEARCH_AVAILABLE)("research-file presence checks for module values", () => { it("agrees with the research file on tirzepatide half-life ≈ 5 days", () => { // Research file's §1.1 + §2.6 both say "≈ 5 days" / "5.4 days" // for tirzepatide. TS module pins 5.0. The numbers reconcile