fix(hooks): match the post-checkout log prefix in the timeout fallback

The post-checkout body logs with [graphify] throughout, but the new
non-SIGALRM fallback used [graphify hook], so the same timeout read
differently depending on the platform. The post-commit body does use
[graphify hook] everywhere, so only the checkout copy was wrong.

Assert each body uses a single log prefix so this cannot drift again.
This commit is contained in:
Rishet Mehra
2026-07-24 23:37:14 +01:00
committed by safishamsi
parent ca3113ac7b
commit 0da6929e57
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ try:
signal.alarm(_timeout)
else:
def _bail():
print(f'[graphify hook] graphify rebuild exceeded {_timeout}s', flush=True)
print(f'[graphify] graphify rebuild exceeded {_timeout}s', flush=True)
os._exit(1)
_watchdog = threading.Timer(_timeout, _bail)
_watchdog.daemon = True
+5
View File
@@ -348,6 +348,11 @@ def test_rebuild_bodies_arm_a_timeout_without_sigalrm(name, body):
dumped = "".join(ast.dump(stmt) for stmt in fallbacks[0])
assert "attr='Timer'" in dumped, f"{name} fallback does not arm a threading.Timer (#2148)"
assert "attr='_exit'" in dumped, f"{name} fallback does not kill the stuck rebuild (#2148)"
# The fallback logs the timeout itself, because os._exit skips the except
# handler that reports it on the SIGALRM path. Its prefix has to match the
# rest of the body, or the same event reads differently per platform.
prefixes = set(re.findall(r"print\(f'\[([a-z ]+)\]", body))
assert len(prefixes) == 1, f"{name} mixes log prefixes {sorted(prefixes)} (#2148)"
def test_detached_launch_targets_graphify_python():