GPT-5 finding
formatClosureReceipt assumes originalCommentUrl is non-undefined and accesses .length directly
lowapi-contracthigh
- apps/web/lib/pr-comment.ts:112-114
The type is string | null, but if the function is ever called from untyped code and originalCommentUrl is undefined (e.g., missing field in parsed JSON), accessing .length will throw at runtime. Defensive checks prevent hard-to-debug crashes in automation paths.
Recommendation
Coerce and guard: const link = args.originalCommentUrl; if (typeof link === "string" && link.length > 0) { ... } else { fallback }.