diff --git a/cli/src/commands/sync/sync.ts b/cli/src/commands/sync/sync.ts index fbf152942a..eba891ce1d 100644 --- a/cli/src/commands/sync/sync.ts +++ b/cli/src/commands/sync/sync.ts @@ -2801,9 +2801,32 @@ export async function push( } } for (const folderName of folderNames) { - try { - await stat(path.join("f", folderName, "folder.meta.yaml")); - } catch { + const basePath = path.join("f", folderName, "folder.meta.yaml"); + const branchPath = getBranchSpecificPath( + `f/${folderName}/folder.meta.yaml`, + specificItems, + opts.branch, + ); + let found = false; + // Check branch-specific variant first (e.g. folder.dev.meta.yaml) + if (branchPath) { + try { + await stat(branchPath); + found = true; + } catch { + // fall through to base path check + } + } + // Then check base path + if (!found) { + try { + await stat(basePath); + found = true; + } catch { + // not found + } + } + if (!found) { missingFolders.push(folderName); } } diff --git a/cli/test/folder_missing_meta.test.ts b/cli/test/folder_missing_meta.test.ts index 0c95a9ef4f..429ef83b94 100644 --- a/cli/test/folder_missing_meta.test.ts +++ b/cli/test/folder_missing_meta.test.ts @@ -397,4 +397,39 @@ describe("sync push missing folder detection", () => { expect(output).not.toContain("Missing folder.meta.yaml"); }); }); + + test("no warning when branch-specific folder.meta.yaml exists", async () => { + await withIsolatedWorkspace(async ({ tempDir, runCLICommand }) => { + const uniqueId = Date.now(); + const folderName = `branchmeta${uniqueId}`; + + // wmill.yaml with branch-specific folders configured + await writeFile( + join(tempDir, "wmill.yaml"), + `defaultTs: bun\nincludes:\n - "**"\nexcludes: []\ngitBranches:\n dev:\n specificItems:\n folders:\n - "f/${folderName}"\n`, + "utf-8" + ); + + // Create folder with branch-specific meta only (no base folder.meta.yaml) + await mkdir(join(tempDir, "f", folderName), { recursive: true }); + await writeFile( + join(tempDir, "f", folderName, "folder.dev.meta.yaml"), + `summary: ""\ndisplay_name: "${folderName}"\nowners: []\nextra_perms: {}\n`, + "utf-8" + ); + await writeFile( + join(tempDir, "f", folderName, "test_script.ts"), + 'export async function main() { return "hello"; }', + "utf-8" + ); + + const result = await runCLICommand( + ["sync", "push", "--yes", "--branch", "dev", "--includes", `f/${folderName}/**`], + ); + + expect(result.code).toEqual(0); + const output = result.stdout + result.stderr; + expect(output).not.toContain("Missing folder.meta.yaml"); + }); + }); });