Repository navigation
test(forge): prove cancelled pushes and clones clean up, and SIGTERM drains transfers - #332
Merged
Merged
Conversation
…RM drains (#316) A push cancelled mid-pack moves no ref and leaves no ref lock; its quarantine can survive git's SIGTERM-then-SIGKILL cleanup, and maintenance reclaims it. A delete during a clone, or a SIGTERM drain deadline, cuts the response without its terminating chunk, and no git process group outlives the server; a clone that finishes within the drain completes. The client-disconnect path is bounded by a short idle timeout because the body read sometimes misses the EOF (recorded in the threat model).
Codex Review Summary: ✅ CompletedThis 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. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
tonibergholm
approved these changes
Nov 9, 2026
5 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#316 listed two gaps with no test behind them: whether cancelled git transfers clean up after themselves, and what happens to a transfer in flight when the server gets SIGTERM. These tests cover both against real git, and record two findings.
Tests
a_push_cancelled_while_holding_its_ref_lock_releases_it: a testreference-transactionhook holds a real push inpreparedwhilerefs/heads/main.lockexists. The test cancels the transport the way a delete or shutdown does. The lock is removed,maindoesn't move, and the client fails.a_push_cancelled_mid_pack_moves_no_ref_and_its_quarantine_is_reclaimed: a raw receive-pack request sends half of a real pack, then disconnects. No ref moves and no lock survives. A maintenance pass removes any quarantine left behind once it is old enough.deleting_a_repository_during_a_clone_fails_the_clone: a raw upload-pack request reads only the response head, then the repository is deleted. The response ends without its terminating chunk, so the client gets an error rather than a clean but truncated pack. A control read of the same request ends cleanly.sigterm_lets_a_clone_in_flight_finish_within_the_drainandsigterm_cancels_a_clone_still_running_at_the_drain_deadlinerun a realsc-forge serveprocess. A clone that finishes within--shutdown-timeoutcompletes. A clone still running at the deadline is cut after the server has waited the full drain, and no git process group outlives the server.Findings (both recorded in
docs/THREAT-MODEL.md, neither fixed here)objects/tmp_objdir-incoming-*behind even though the server sends SIGTERM first. Maintenance's stale sweep removes it.cgi.rsPump::rundoesn't see a client's EOF mid-body. The transport then ends only at--git-idle-timeout(default 120 s). Cleanup is the same, just later. The cancelled-push test uses a 5 s idle timeout to keep its run time bounded. A fix belongs in its own transport PR.No product code changes.
Proof: each new test passed 5 runs in a row locally (macOS), with fmt, clippy (
-D warnings) andcargo test -p scl-forgegreen. I reproduced the missed EOF with trace lines in the body pump, then removed them.Reviewed with sol-loop: 3 rounds with gpt-6.1-sol on high. Sol verdict: approved
Created with Claude Opus 5.5 in T3 Code (Claude Code harness), with gpt-6-luna drafting the first version of the tests.