Opus finding
Script entrypoint guard is fragile under bundling/symlinks
lowmaintainabilitymedium
- apps/web/scripts/backfill-benchmark-flag.ts:195-204
The guard fires only when argv[1] ends with the literal '.ts'. Under bundling, compile-to-JS, or invocation via a wrapper that resolves to a different basename (e.g. tsx with a temp file), main() will not run. Also, importing this module from a sibling .ts file would still satisfy the suffix if a test ever runs the file directly via tsx. Not a correctness bug today but brittle.
Recommendation
Use `import.meta.url === pathToFileURL(process.argv[1]).href` (ESM equivalent of require.main === module).