Skip to content

test(cli): migrate curate_test.go os.Chdir to t.Chdir (ag-y4ac #curate-tchdir-w2)#786

Merged
boshu2 merged 2 commits into
mainfrom
test/ag-y4ac-curate-tchdir-w2
Jun 6, 2026
Merged

test(cli): migrate curate_test.go os.Chdir to t.Chdir (ag-y4ac #curate-tchdir-w2)#786
boshu2 merged 2 commits into
mainfrom
test/ag-y4ac-curate-tchdir-w2

Conversation

@boshu2
Copy link
Copy Markdown
Owner

@boshu2 boshu2 commented Jun 6, 2026

What

Collapse 7 identical os.Getwd() + os.Chdir(tmpDir) + t.Cleanup(restore) blocks in cli/cmd/ao/curate_test.go to t.Chdir(tmpDir). Bare downstream err = first-uses promoted to err := (the removed block held the only function-scope err).

Why

t.Chdir auto-restores cwd on cleanup and refuses to run under t.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

Verification

  • gofmt -l clean · go build ./... · go vet ./cmd/ao clean
  • go test ./cmd/ao -run TestCurate → 14 pass
  • scripts/check-test-isolation.sh → PASS (os.Chdir=149/163, os.Setenv=22/22)
  • scripts/pre-push-gate.sh --fast → passed

Closes-scenario: ag-y4ac#curate-tchdir-w2
Bounded-context: BC5-Runtime
Evidence: .ntm/bo-queue/2026-06-06-ag-y4ac-pr-curate-tchdir.md

…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
@github-actions github-actions Bot added the cli label Jun 6, 2026
@boshu2 boshu2 merged commit 5f69150 into main Jun 6, 2026
15 of 16 checks passed
@boshu2 boshu2 deleted the test/ag-y4ac-curate-tchdir-w2 branch June 6, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant