AntFleet

Disagreement · 748568f3-anthropic-2

`backfill-benchmark-flag.ts` script detection of direct execution is fragile under compiled / symlinked runs

solo Opus
repo e24ef98c·PR #9·reviewed 1 week ago

Opus finding

`backfill-benchmark-flag.ts` script detection of direct execution is fragile under compiled / symlinked runs

lowmaintainabilityhigh
  • apps/web/scripts/backfill-benchmark-flag.ts:196-204
The guard string-matches the `.ts` filename. If the script is ever compiled to `.js` (via tsc/esbuild) and run as e.g. `node dist/scripts/backfill-benchmark-flag.js`, the guard will not fire and main() will not run. Conversely, any other path ending in that exact filename (e.g. test fixtures named identically) would trigger main() during import. Since vitest config includes `**/*.test.ts` only, tests are safe today, but the heuristic is brittle.

Recommendation

Use `import.meta.url` compared against `pathToFileURL(process.argv[1]).href` for a robust entrypoint check, or invert: have a separate thin bin script that calls into the exported main().

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →

From the same review

These findings passed the unanimous gate on the same PR review. The disagreement above was filtered out; the findings below were posted.