-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Problem
internal/zip/zip.go:RepoZip (line 152) accepts a context.Context but only passes it to buildGitFileSet (line 163, for the git ls-files subprocess). The filepath.Walk on line 165 has no context awareness — it runs to completion regardless of whether the context is cancelled or timed out.
In cmd/run.go:166, the caller creates a 10-minute timeout context:
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
zipData, skipReport, err := zip.RepoZip(ctx, proj.RootDir)If the context deadline fires while the walk is in progress (e.g. on a very large repository), the walk continues to completion and the timeout is silently ignored for this phase. The first place the cancellation is actually observed is the subsequent API call.
Fix
Check ctx.Done() inside the filepath.Walk callback in internal/zip/zip.go at the top of the walk function, returning ctx.Err() when cancelled:
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
select {
case <-ctx.Done():
return ctx.Err()
default:
}
// ... rest of walk
})Then propagate the context error from RepoZip back to the caller so it can distinguish timeout vs other walk errors.
Files
internal/zip/zip.go:165—filepath.Walkcall with no context check inside callbackcmd/run.go:166— context with 10-minute timeout passed toRepoZip
@claude please implement this