Repository navigation
Bound the Lean build-lock wait by the request timeout; deflake the restage test - #22
Conversation
Replace the sleep-based ordering in the restage test with events so the edit and second request are guaranteed to land before the first compile reads its source, and add a test asserting that a request waiting on the project lock gives up at its own timeout rather than blocking. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The lock timeout test now issues the build from a worker thread while the main thread holds the project lock, so the request's own timeout is what ends the wait. The previous version measured elapsed time inside the locked section, which could pass or fail depending on scheduling rather than on the timeout being honoured. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The project lock is now acquired with a timeout instead of blocking indefinitely, so a request that cannot get the lock in time raises subprocess.TimeoutExpired rather than hanging. The build then runs with only the time remaining from the original timeout. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The watched stage wrapper now calls the underlying stage function before checking the compiling flag, so the restaged event is only set once the stage has actually run. This avoids a race where the event could be signalled before the stage result was produced. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): Bound the Lean build-lock wait by the request timeout; deflake the restage test. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Follow-up to #21, which merged before its two review threads were addressed. These are the fixes for those threads.
build_packagenow acquires the project lock withlock.acquire(timeout=timeout). If the lock isn't free in time it raisessubprocess.TimeoutExpired, whichrun_guardedalready maps to status"timeout". The build then gets only the time left after the wait. Before this, a request queued behind a long build could block well past its own timeout.build.stagereturns, before re-reading its source. With the lock in place, no restage can run in that window. Without it, one does, and the test fails. The timing can only make the test pass wrongly when the lock is missing, never fail wrongly when it is present.Public API / behaviour changes
A
/checkthat waits for another request's build of the same project now returnsstatus: "timeout"once its timeout is used up, instead of waiting indefinitely.Validation
test_a_request_waiting_for_the_lock_gives_up_at_its_timeout(new) failed on main (the request was still blocked after 3 s with a 0.3 s timeout), and passes now.test_a_restage_waits_for_the_build_in_progress(rewritten) failed 3 of 3 runs with the lock temporarily removed, and passes with it.python3 -I -W error -m unittest discover -s docker/lean: 39 tests OK, 3 of 3 runs.Refs #21
Co-authored-by: Medulla medulla@tinyhumans.ai
Summary by CodeRabbit