fix(code-runtime-python): restore per-file branch coverage on the reap poll

The group-reap poll's deadline arm (Date.now() >= deadline) is a backstop that
SIGKILL emptying the reachable group never reaches, leaving one uncovered branch
under the per-file 100% gate. Mark it v8-ignore with the reason and drop the
always-true graceTimer-defined guard inside pollGroup (it runs only when killing
is set, so kill() has armed the timer).
This commit is contained in:
Chinesezjc
2026-08-31 14:21:57 +08:00
committed by Tianyi Cui
parent ecdb79824b
commit b1ce014035
@@ -1082,8 +1082,15 @@ export class PythonCodeRuntime extends CodeRuntime {
}
const deadline = Date.now() + this.config.graceMs + CLOSE_REAP_MARGIN_MS
const pollGroup = (): void => {
// The deadline is a backstop: the group is reachable by `kill(-pid)`
// and SIGKILL is uncatchable, so it always empties within graceMs — the
// `Date.now() >= deadline` arm exists only so a probe that never sees
// ESRCH (a kernel quirk) cannot hang disposal forever.
/* v8 ignore next -- SIGKILL always empties the reachable group before the deadline. */
if (groupEmpty() || Date.now() >= deadline) {
if (graceTimer !== undefined) clearTimeout(graceTimer)
// graceTimer is always defined here: pollGroup runs only when
// `killing` is set, and kill() arms graceTimer before any settle.
clearTimeout(graceTimer)
finalize()
return
}