fix: classify fileset resource files with script extensions correctly (#8851)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-04-16 14:17:39 +00:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 88e4120e96
commit b1aeb33ade
3 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -1986,7 +1986,7 @@ interface ChangeTracker {
}
async function addToChangedIfNotExists(p: string, tracker: ChangeTracker) {
const isScript = exts.some((e) => p.endsWith(e));
const isScript = exts.some((e) => p.endsWith(e)) && !isFileResource(p) && !isFilesetResource(p);
if (isScript) {
if (isFlowPath(p)) {
const folder = extractFolderPath(p, "flow")!;
+3 -3
View File
@@ -286,6 +286,9 @@ export function getTypeStrFromPath(
if (p.startsWith("dependencies" + SEP)) {
return "workspace_dependencies";
}
if (isFileResource(p) || isFilesetResource(p)) {
return "resource";
}
const parsed = path.parse(p);
if (
parsed.ext == ".go" ||
@@ -349,9 +352,6 @@ export function getTypeStrFromPath(
) {
return typeEnding;
} else {
if (isFileResource(p) || isFilesetResource(p)) {
return "resource";
}
throw new Error("Could not infer type of path " + JSON.stringify(parsed));
}
}
+4
View File
@@ -270,6 +270,10 @@ describe("getTypeStrFromPath", () => {
test("detects fileset resource files as resource type", () => {
expect(getTypeStrFromPath("f/test/my_config.fileset/config.yaml")).toBe("resource");
expect(getTypeStrFromPath("u/admin/templates.fileset/path/to/file.txt")).toBe("resource");
// fileset files with script-like extensions should still be detected as resource
expect(getTypeStrFromPath("f/test/my_queries.fileset/query.sql")).toBe("resource");
expect(getTypeStrFromPath("f/test/my_queries.fileset/script.py")).toBe("resource");
expect(getTypeStrFromPath("f/test/my_queries.fileset/nested/dir/file.ts")).toBe("resource");
});
test("throws for unknown type", () => {