fix(core): close contract edges in git/repomanager/workspace/targethasher (audit #14) - #262
Closed
sbalabanov wants to merge 1 commit into
Closed
fix(core): close contract edges in git/repomanager/workspace/targethasher (audit #14)#262sbalabanov wants to merge 1 commit into
sbalabanov wants to merge 1 commit into
Conversation
(a) Route RevParse, IsAncestor, GetCommitTimeSecond, and FileHashes through the same timeout+wrapError path as the other git.Interface methods so fatal exits (128/129) surface as errors.Is(err, ErrFatal) and the orchestrator's classifyGitError can tag them. (b) Wrap ErrPoolTimeout on both context.Canceled and context.DeadlineExceeded in repomanager.Lease, matching the godoc contract. (c) Make workspace.Release idempotent via sync.Once so double-release cannot push the same slot back into the pool twice. (d) Thread context.Context into targethasher's hashDir walk and check ctx.Err() every cancelCheckInterval files so large-tree hashing aborts promptly on request cancellation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
xytan0056
approved these changes
Jul 31, 2026
This was referenced Aug 3, 2026
Contributor
Author
|
This draft has been split into three independent, focused replacement PRs based on the latest
The Closing #262 as superseded by the PRs above. |
sbalabanov
pushed a commit
that referenced
this pull request
Aug 3, 2026
.1) Summary: Audit #14.1 extracts the git command contract fixes from #262. Intent: - Ensure read-only git commands honor the same timeout and error-classification contract as mutating commands. - Preserve conditional exit semantics for merge-base ancestry checks. Changes: - Apply the shared timeout and wrapError path to RevParse, IsAncestor, GetCommitTimeSecond, and FileHashes. - Cover fatal exits, deadline expiration, parent cancellation, and IsAncestor exit code 1.
sbalabanov
pushed a commit
that referenced
this pull request
Aug 3, 2026
….3) Summary: Audit #14.3 extracts targethasher cancellation propagation from #262. Intent: - Stop directory hashing promptly when graph computation is canceled. - Preserve cancellation causes through both target graph implementations. Changes: - Thread context through SourceHasher and all callers. - Check cancellation before and periodically during directory traversal. - Cover public hasher cancellation and context propagation through both graph paths.
sbalabanov
pushed a commit
that referenced
this pull request
Aug 4, 2026
Summary: Audit #14.2 extracts workspace release safety from #262. Intent: - Prevent repeated releases from returning the same workspace slot more than once. - Make the lifecycle contract safe under concurrent cleanup paths. Changes: - Guard the release callback with sync.Once. - Document the idempotent Release contract. - Cover sequential and concurrent repeated releases.
sbalabanov
pushed a commit
that referenced
this pull request
Aug 4, 2026
….3) Summary: Audit #14.3 extracts targethasher cancellation propagation from #262. Intent: - Stop directory hashing promptly when graph computation is canceled. - Preserve cancellation causes through both target graph implementations. Changes: - Thread context through SourceHasher and all callers. - Check cancellation before and periodically during directory traversal. - Cover public hasher cancellation and context propagation through both graph paths.
sbalabanov
pushed a commit
that referenced
this pull request
Aug 5, 2026
.1) Summary: Audit #14.1 extracts the git command contract fixes from #262. Intent: - Ensure read-only git commands honor the same timeout and error-classification contract as mutating commands. - Preserve conditional exit semantics for merge-base ancestry checks. Changes: - Apply the shared timeout and wrapError path to RevParse, IsAncestor, GetCommitTimeSecond, and FileHashes. - Cover fatal exits, deadline expiration, parent cancellation, and IsAncestor exit code 1.
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.
Summary
Four methods on
git.Interface(RevParse,IsAncestor,GetCommitTimeSecond,FileHashes) bypassed the timeout andwrapErrorpath, so fatal git exits never surfaced asErrFataland the orchestrator could not classify them. Additionally,repomanager.Leaseonly wrappedErrPoolTimeoutfor deadline exceeded (not plain cancellation),workspace.Releasewas not idempotent (double-release corrupted the pool), andtargethasher's directory walk ignored context cancellation._gitTimeout+wrapError, preservingIsAncestor's exit-code-1 →(false, nil)semantics.ErrPoolTimeouton bothcontext.Canceledandcontext.DeadlineExceeded, matching the sentinel's godoc.workspace.Releasewithsync.Onceso theonReleasecallback fires exactly once.context.ContextintohashDirand checkctx.Err()everycancelCheckIntervalfiles.Test plan
TestFatalExitCode_wrapsErrFatal— table-driven: fatal exit 128 from each of the four methods yieldserrors.Is(err, ErrFatal)TestLease_CtxCanceled— updated: plain cancellation now assertserrors.Is(err, ErrPoolTimeout)TestWorkspace_Release_Idempotent— channel-based: two Release calls, assert callback channel has exactly one entryTestHashDir_RespectsCtxCancellation— pre-cancelled ctx with >cancelCheckInterval files, asserterrors.Is(err, context.Canceled)go test ./core/... ./orchestrator/ ./controller/ ./graphrunner/ ./mapper/)🤖 Generated with Claude Code