This commit is contained in:
omp-port
2026-08-11 12:34:26 -04:00
parent 5b7796043e
commit 4742f11d35
10 changed files with 212 additions and 22 deletions

View File

@@ -205,6 +205,30 @@ describe("detectTodoStubs", () => {
loud.some((h) => h.path.endsWith("fetch.rs") && h.snippet === "todo!("),
).toBe(true);
});
it("never descends into build/deploy output directories", async () => {
// Generated bundles under framework build dirs must not feed the
// pre-scan: they dominate candidate counts with minified noise (the
// freno-dev failure flagged 119 of 124 candidates inside
// `.output`/`.vercel` bundles, ballooning the scan task to 2.5 MB).
for (const rel of [
join(".output", "public", "bundle.js"),
join(".vercel", "output", "static", "app.js"),
join(".netlify", "functions", "bundle.js"),
]) {
const full = join(dir, rel);
await mkdir(join(full, ".."), { recursive: true });
await writeFile(
full,
"// TODO: bundle placeholder\nfunction f(){ return 0; }\nthrow new Error('not implemented');\n",
"utf8",
);
}
const hits = await detectTodoStubs(dir);
expect(
hits.filter((h) => /(?:\.output|\.vercel|\.netlify)[/\\]/.test(h.path)),
).toHaveLength(0);
});
});
describe("todos check", () => {
@@ -334,4 +358,25 @@ describe("todos check", () => {
);
expect(task).toContain("| new: 0 | resolved: 4 |");
});
it("truncates giant single-line candidates so the task prompt stays bounded", async () => {
// A minified/generated single line can be hundreds of KB; embedding it
// wholesale ballooned the freno-dev task to 2.5 MB and choked the
// analysis agent. The task must carry a truncated prefix, never the
// full line.
const long = `// TODO: ${"x".repeat(400)}`;
await writeFile(
join(cwd, "huge.ts"),
`${long}\nexport function f() { return 0; }\n`,
"utf8",
);
const task = await buildTodosScanTask(cwd, {
cwd,
target: cwd,
fix: false,
rest: [],
});
expect(task).not.toContain("x".repeat(400));
expect(task).toContain("…");
});
});