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) <noreply@anthropic.com>
This commit is contained in:
parent
c77148632b
commit
109f8e4461
1 changed files with 7 additions and 6 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue