infra
infra copied to clipboard
Add the 'early-return' linter, pass more ctx
Also tweak some integration tests to try and make them less flaky. Success?
[!NOTE] Enable the early-return linter and refactor code and tests to use early returns while stabilizing integration tests with EventuallyWithT and longer timeouts.
- Linting:
- Enable
reviveruleearly-returnin.golangci.yml.- Client Proxy (
packages/client-proxy/main.go):
- Simplify Redis and secure-Redis initialization with early-return on errors; warn and fallback to in-memory catalog when Redis is disabled.
- Orchestrator NBD (
packages/orchestrator/internal/sandbox/nbd/dispatch.go):
- Refactor request parsing loop to early-break on incomplete headers and flatten command handling.
- Gate
cmdRead/cmdWritewith early shutdown checks and movependingResponses.Add(1)accordingly.- Template Build (
.../template/build/phases/steps/builder.go):
- Early-return when layer is cached; otherwise log and proceed to build.
- Storage Lock (
packages/shared/pkg/storage/lock/file_lock.go):
- Streamline TTL check: return
ErrLockAlreadyHeldwhen fresh; otherwise clean up stale lock before acquiring.- Integration Tests:
- Replace
require.Eventuallywithrequire.EventuallyWithT, increase timeouts/poll intervals, reusectx, and add retrying teardown to reduce flakiness.Written by Cursor Bugbot for commit 46746c1e618ff2510c70af2cc18000c5ef633fa7. This will update automatically on new commits. Configure here.
Feel free to cancel my review, I can't do it when there's merge conflict