From b09208a7adc0ae7dd67adc9a81d81b21fae95178 Mon Sep 17 00:00:00 2001 From: isihussain <35667459+isihussain@users.noreply.github.com> Date: Fri, 13 Nov 2026 11:24:08 +0300 Subject: [PATCH] fix(pulse): normalize parentheticals containing dashes in headingKey (#2786) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PulseHealth sectionDrift was failing to match template headings that end in a parenthetical containing a dash (e.g. 'Key Numbers (Sample Panel — 2026-01-01)'). Because the dash suffix was stripped before the parenthetical, the unclosed parenthesis failed to match the trailing bracket pattern, causing template sections to permanently report as missing against user files with plain headings. Dropping the trailing parenthetical both before and after the dash strip ensures correct normalization for both template sample dates and user sections. Fixes #2786 Signed-off-by: isihussain --- LifeOS/Tools/PulseHealth.ts | 3 ++- LifeOS/install/skills/LifeOS/Tools/PulseHealth.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/LifeOS/Tools/PulseHealth.ts b/LifeOS/Tools/PulseHealth.ts index f51fcef219..2c5a33482b 100644 --- a/LifeOS/Tools/PulseHealth.ts +++ b/LifeOS/Tools/PulseHealth.ts @@ -69,7 +69,8 @@ export function h2Headings(text: string): string[] { } /** GenerateTelosSummary's section key: dash suffix and trailing parentheticals dropped, lowercased, plural-tolerant. */ -const headingKey = (h: string): string => h.replace(/\s*[—–-].*$/, "").replace(/\s*\(.*\)\s*$/, "").trim().toLowerCase().replace(/s$/, ""); +const headingKey = (h: string): string => + h.replace(/\s*\(.*\)\s*$/, "").replace(/\s*[—–-].*$/, "").replace(/\s*\(.*\)\s*$/, "").trim().toLowerCase().replace(/s$/, ""); /** * Template sections a USER file lacks: for every `*.md` in the template tree (recursively, symlinks skipped) whose USER diff --git a/LifeOS/install/skills/LifeOS/Tools/PulseHealth.ts b/LifeOS/install/skills/LifeOS/Tools/PulseHealth.ts index f51fcef219..2c5a33482b 100644 --- a/LifeOS/install/skills/LifeOS/Tools/PulseHealth.ts +++ b/LifeOS/install/skills/LifeOS/Tools/PulseHealth.ts @@ -69,7 +69,8 @@ export function h2Headings(text: string): string[] { } /** GenerateTelosSummary's section key: dash suffix and trailing parentheticals dropped, lowercased, plural-tolerant. */ -const headingKey = (h: string): string => h.replace(/\s*[—–-].*$/, "").replace(/\s*\(.*\)\s*$/, "").trim().toLowerCase().replace(/s$/, ""); +const headingKey = (h: string): string => + h.replace(/\s*\(.*\)\s*$/, "").replace(/\s*[—–-].*$/, "").replace(/\s*\(.*\)\s*$/, "").trim().toLowerCase().replace(/s$/, ""); /** * Template sections a USER file lacks: for every `*.md` in the template tree (recursively, symlinks skipped) whose USER