From 109f8e446161684dce3efbeac538a8de0fec76aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=82CHES?= Date: Tue, 24 Mar 2026 23:55:36 -0600 Subject: [PATCH] fix(gsd): widen test search window for CRLF portability on Windows (#2458) The completed-units-metrics-sync source-scanning test used a 700-char window that was too small when Windows CRLF line endings inflated byte offsets, causing the archive keyword check to miss by ~2 chars. Widens the window to 1200 chars and lowercases the comparison so "Archive" and "cpSync" match regardless of case or line ending style. Co-authored-by: Claude Opus 4.6 (1M context) --- .../gsd/tests/completed-units-metrics-sync.test.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts b/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts index e2bfc550f..4c451bece 100644 --- a/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts +++ b/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts @@ -26,16 +26,17 @@ test("#2313: completed-units.json should not be blindly wiped to [] on milestone const completedUnitsIdx = phasesSrc.indexOf("completed-units", transitionIdx); assert.ok(completedUnitsIdx !== -1, "completed-units handling exists in transition"); - // Get a window around the completed-units handling - const windowStart = Math.max(0, completedUnitsIdx - 200); - const windowEnd = Math.min(phasesSrc.length, completedUnitsIdx + 500); - const window = phasesSrc.slice(windowStart, windowEnd); + // Get a window around the completed-units handling (1200 chars to + // accommodate CRLF line endings on Windows which inflate byte offsets). + const windowStart = Math.max(0, completedUnitsIdx - 300); + const windowEnd = Math.min(phasesSrc.length, completedUnitsIdx + 900); + const window = phasesSrc.slice(windowStart, windowEnd).toLowerCase(); // Should archive/rename the old file before resetting const hasArchive = window.includes("archive") || window.includes("rename") || - window.includes("cpSync") || - window.includes("safeCopy") || + window.includes("cpsync") || + window.includes("safecopy") || window.includes("completed-units-"); assert.ok(