test(cli): migrate curate_test.go os.Chdir to t.Chdir (ag-y4ac #curate-tchdir-w2)#786
Merged
Conversation
…e-tchdir-w2) Collapse 7 identical os.Getwd()+os.Chdir()+t.Cleanup(restore) blocks in curate_test.go to t.Chdir(tmpDir), which auto-restores cwd on cleanup AND refuses to run under t.Parallel — pre-empting the process-global-cwd flake class (cf. ag-jfzs). Bare downstream 'err =' first-uses promoted to ':=' since the removed block held the only function-scope err declaration. os.Chdir sites in _test.go: 163 -> 149 (-14). os.Setenv untouched (owned by the in-flight setenv ratchet PR #772). BASELINE_CHDIR intentionally NOT lowered to avoid a merge collision with in-flight PRs #772/#773 on that shared ratchet line; the gate stays green (149 <= 163, count-below-baseline is a NOTE). A later wave locks the baseline once the in-flight ratchet PRs settle. One wave of the ag-k38x/ag-y4ac test-isolation sweep; non-overlapping with PR #772 (rpi setenv) and PR #773 (dedup_test.go os.Chdir). Closes-scenario: ag-y4ac#curate-tchdir-w2 Bounded-context: BC5-Runtime Evidence: .ntm/bo-queue/2026-06-06-ag-y4ac-pr-curate-tchdir.md
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.
What
Collapse 7 identical
os.Getwd()+os.Chdir(tmpDir)+t.Cleanup(restore)blocks incli/cmd/ao/curate_test.gotot.Chdir(tmpDir). Bare downstreamerr =first-uses promoted toerr :=(the removed block held the only function-scopeerr).Why
t.Chdirauto-restores cwd on cleanup and refuses to run undert.Parallel— pre-empting the process-global-cwd flake class (cf. ag-jfzs). This is one wave of the ag-k38x / ag-y4ac test-isolation sweep (finish-the-job: ~133 sites already use the safe idiom).Scope / collision-safety
os.Chdirin_test.go: 163 → 149 (-14).os.Setenvuntouched (owned by in-flight setenv ratchet PR chore(test): migrate redundant os.Setenv to t.Setenv; lower isolation ratchet 22->12 (ag-k38x #bulk-migration-setenv) #772).BASELINE_CHDIRintentionally NOT lowered — that single line is the contention point with in-flight PR chore(test): migrate redundant os.Setenv to t.Setenv; lower isolation ratchet 22->12 (ag-k38x #bulk-migration-setenv) #772/test(cli): migrate dedup_test.go to t.Chdir + lock isolation ratchet 163->151 (ag-4nif #dedup-tchdir) #773; the ratchet stays green because count-below-baseline is a NOTE, not a failure (149 <= 163). A later wave locks the baseline once those settle.Verification
gofmt -lclean ·go build ./...·go vet ./cmd/aocleango test ./cmd/ao -run TestCurate→ 14 passscripts/check-test-isolation.sh→ PASS (os.Chdir=149/163, os.Setenv=22/22)scripts/pre-push-gate.sh --fast→ passedCloses-scenario: ag-y4ac#curate-tchdir-w2
Bounded-context: BC5-Runtime
Evidence: .ntm/bo-queue/2026-06-06-ag-y4ac-pr-curate-tchdir.md