diff --git a/.github/workflows/daily-choice-test.lock.yml b/.github/workflows/daily-choice-test.lock.yml index 1cbb37ed40..d3ec2d747e 100644 --- a/.github/workflows/daily-choice-test.lock.yml +++ b/.github/workflows/daily-choice-test.lock.yml @@ -278,8 +278,8 @@ jobs: } }, "required": [ - "environment", - "test_type" + "test_type", + "environment" ], "type": "object" }, diff --git a/actions/setup/js/push_repo_memory.cjs b/actions/setup/js/push_repo_memory.cjs index 33236ab3b1..5c3899126f 100644 --- a/actions/setup/js/push_repo_memory.cjs +++ b/actions/setup/js/push_repo_memory.cjs @@ -307,15 +307,15 @@ async function main() { }); if (!matchResults.some(m => m)) { - core.error(`File does not match allowed patterns: ${normalizedRelPath}`); - core.error(`Allowed patterns: ${fileGlobFilter}`); - core.error(`Pattern test results:`); + core.warning(`Skipping file that does not match allowed patterns: ${normalizedRelPath}`); + core.debug(`Allowed patterns: ${fileGlobFilter}`); + core.debug(`Pattern test results:`); const patternStrs = fileGlobFilter.trim().split(/\s+/).filter(Boolean); patterns.forEach((pattern, idx) => { - core.error(` ${patternStrs[idx]} -> regex: ${pattern.source} -> ${matchResults[idx] ? "MATCH" : "NO MATCH"}`); + core.debug(` ${patternStrs[idx]} -> regex: ${pattern.source} -> ${matchResults[idx] ? "MATCH" : "NO MATCH"}`); }); - core.setFailed("File pattern validation failed"); - throw new Error("File pattern validation failed"); + // Skip this file instead of failing - it may be from a previous run with different patterns + return; } } diff --git a/actions/setup/js/push_repo_memory.test.cjs b/actions/setup/js/push_repo_memory.test.cjs index b3e68bddeb..d38c1e551d 100644 --- a/actions/setup/js/push_repo_memory.test.cjs +++ b/actions/setup/js/push_repo_memory.test.cjs @@ -981,5 +981,24 @@ describe("push_repo_memory.cjs - glob pattern security tests", () => { expect(matches).toBe(shouldMatch); } }); + + it("should allow filtering out legacy files from previous runs", () => { + // Real-world scenario: The memory/campaigns branch had old files with incorrect + // nesting (memory/default/...) from before a bug fix. When cloning this branch, + // these old files are present alongside new correctly-structured files. + // The glob filter should match only the new files, allowing old files to be skipped. + const currentPattern = globPatternToRegex("go-file-size-reduction-project64/**"); + + // New files (should match) + expect(currentPattern.test("go-file-size-reduction-project64/cursor.json")).toBe(true); + expect(currentPattern.test("go-file-size-reduction-project64/metrics/2025-12-31.json")).toBe(true); + + // Legacy files with incorrect nesting (should not match) + expect(currentPattern.test("memory/default/go-file-size-reduction-20610415309/metrics/2025-12-31.json")).toBe(false); + expect(currentPattern.test("memory/campaigns/go-file-size-reduction-project64/cursor.json")).toBe(false); + + // This behavior allows push_repo_memory.cjs to skip legacy files instead of failing, + // enabling gradual migration from old to new structure without manual branch cleanup. + }); }); });