fix: todos scan task ballooned to 2.5MB and analysis produced no output
The todos pre-scan walked .output/ (Nitro) and .vercel/ (Vercel) build dirs, flagging 119 of 124 candidates inside minified bundles (single lines up to 162KB). buildTodosScanTask embedded full candidate lines in the task prompt, producing a 2.5MB prompt on freno-dev; the analysis agent settled with ok:true + empty text + no findings.md, verify failed, and resume re-ran the same oversized prompt and failed identically. - scope: exclude .output/.vercel/.netlify (shared by all checks) - todos: truncate candidate code at 160 chars in the prompt + fallback - agent-runner: a session settling with no text and no observed message/ tool events now fails the run loudly instead of reporting ok:true - agent prompts: add the three dirs to each skip list - tests: excluded-dir scan, prompt truncation, emptySessionError cases
This commit is contained in:
@@ -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("…");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user