fix(web-app-docs): give every build subprocess a deadline

Twelve jobs of run 37865281419 failed on the docs language spec:

    tests/test-languages.js:25:7 the deployed working tree is published in de
    with a language switcher (54.6m)
    Error: Expected the de site of the deployed working tree to be built

The spec polls /deployed/de/ until the suite budget runs out, so a build that
hangs is reported as a spec timeout with nothing to read. None of the five
subprocess calls the build makes carried a timeout, so any of them could hold
the queue open forever:

  library.py  _git()     rev-parse, tag --list and remote update --prune
  library.py  fetch()    git clone --mirror
  i18n.py                each generator of generate_commands
  i18n.py                sphinx -b gettext
  builder.py  _run()     the sphinx build of one version

The two git paths reach the network, which is where an unbounded call hangs
without failing.

`_run` streams its child's output into the build state, so it cannot take
`communicate(timeout=)` without losing the progress that `_append_log` and
`_save_state` record, and Popen has no timeout of its own. A threading.Timer
kills the child instead. The kill lands in the existing returncode branch, so
the build is reported through `_failed`, which already writes the log tail into
the state file.

RUN_TIMEOUT_SECONDS is set to catch a hang, not to beat the spec's clock: no
measurement of a successful de build exists, so a tighter value risks turning a
slow build into a failing one. With one, the value belongs below the poll
window the spec scales to.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-10-09 22:50:14 +02:00
1 parent d3610af31f
commit a289dac85b
4 files changed
+39 -7

No files matched your search

@@ -7,6 +7,8 @@ through :class:`Library`, on the fixture its sibling module owns.
from __future__ import annotations
import os
import subprocess
import sys
import unittest
from unittest.mock import patch
@@ -16,6 +18,18 @@ from .test_library import LibraryFixture, _commit, builder, library
class TestBuilder(LibraryFixture, unittest.TestCase):
def test_a_run_that_emits_nothing_is_killed_at_the_deadline(self) -> None:
state: dict = {"log": [], "progress": 0}
command = [sys.executable, "-c", "import time; time.sleep(60)"]
with (
patch.object(builder, "RUN_TIMEOUT_SECONDS", 0.2),
self.assertRaises(subprocess.CalledProcessError),
):
self.library._run(
"latest", state, command, dict(os.environ), str(self.data)
)
def test_latest_is_built_from_the_last_commit(self) -> None:
self.library.build("latest")