os-backlog tests inject env instead of mutating ENV; Backlog::CLI threads env to ProjectIndex and Wakeup::State (#634a) #707
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#707
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Global ENV mutation in
plugins/os-backlogtest helpers blocks parallel test runs.Backlog::CLIdoes not thread anenv:keyword down toProjectIndex/Wakeup::State, so tests mutateENV["CC_OS_HOME"]and interpolatePATHinto a backtick string instead of passing an env hash.Observed
plugins/os-backlog/tests/support/cli_test_helpers.rb:19-20ENV["CC_OS_HOME"] = homeinwith_isolated_project_index(5 callers).plugins/os-backlog/tests/support/labels_cli_helpers.rb:49-50buildspath = fakebin ? "#{fakebin}:#{ENV['PATH']}" : ENV["PATH"]then runs a backtickPATH=#{path} ruby #{BIN} #{args} 2>&1(3 callers).plugins/os-backlog/lib/backlog/project_index.rb:9def self.default_path(env: ENV);plugins/os-backlog/lib/backlog/wakeup/state.rb:8same pattern;plugins/os-backlog/lib/backlog/cli.rb:20-26Backlog::CLI.start(given_args = ARGV, config = {})threads no env to either..sdlc/project.yaml:ruby plugins/os-backlog/tests/all.rb.plugins/os-sdlc/tests/test_helper.rb:166-168parallelize_me!plus aSerializedChdirmonitor (ADR-0205).Reproduce
Approach
Required work:
Backlog::CLI.startacceptsenv:(defaultENV) and passes it to everyProjectIndex/Wakeup::Stateconstruction reached from CLI commands — check:grep -rn "default_path$\|default_path)" plugins/os-backlog/libshows env passedcli_test_helperspassesenv: {"CC_OS_HOME" => home}toBacklog::CLI.start, noENVwrite — check:grep -rn 'ENV\[.*\] *=' plugins/os-backlog/testsemptylabels_cli_helpersspawns viaOpen3.capture2e({"PATH" => path}, "ruby", BIN, *args, chdir: dir)— check:grep -n 'PATH=#' plugins/os-backlog/testsemptyDir.chdiror wrap it in aSerializedChdirmonitor copied from os-sdlc — check:grep -rn "Dir.chdir" plugins/os-backlog/testsonly inside the monitor helperparallelize_me!inplugins/os-backlog/tests/test_helper.rb, suite green 3 consecutive runs — check:for i in 1 2 3; do ruby plugins/os-backlog/tests/all.rb || exit 1; doneRejected: tests-only change (the in-process CLI reads ENV; the fix must thread env through lib, not just rewrite test helpers).
VERDICT: CREATE
Acceptance criteria
Backlog::CLI.startwith anenv:keyword, when that call reachesProjectIndexorWakeup::State, then those objects receive the supplied env hash instead of reading globalENV.ENV[...] =or a backtick-interpolatedPATH=, then no matches remain.plugins/os-backlog/tests/test_helper.rbdeclaresparallelize_me!, when the suite is run three consecutive times, then all three runs pass with no flakes.Owner sketch
Non-goals
plugins/osworktree/finish env threading (tracked as #634b).Origin
Trigger: split of #634.
Improvised this session: no.
Chain ending at DESIGN ADR-0205.
Root candidate "#634 (split 2026-09-24, session 082c3e8b)".
Where: plugins/os-backlog.
Session: 082c3e8b-5598-4c69-9ea6-b717e9c8afb2.
Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/082c3e8b-5598-4c69-9ea6-b717e9c8afb2.jsonl.
Work started in session 082c3e8b on branch ticket-707 via /os-sdlc:implement.
Resolution
Done: Backlog::CLI.start(argv, config, env:) stores env thread-locally (CliEnvContext) and threads it to ConfigWriteCommand and ProjectsCommand, which build ProjectIndex from ProjectIndex.default_path(env:). Test helpers no longer write ENV: with_isolated_project_index yields a home dir the test passes as env; labels_cli_helpers spawns via Open3.capture2e with a PATH hash; Dir.chdir is serialized by a Monitor (SerializedChdir); tests/test_helper.rb enables parallelize_me!.
Evidence: Pipeline implementation 36, 15 dispatches, implementation_complete. Suite green 3 consecutive runs (249 runs, 0 failures). Checks: no ENV assignment in plugins/os-backlog/tests, no PATH interpolation. rubocop clean on 10 changed files. CLI command bodies moved to Backlog::CliCommandHelpers to satisfy the class-length cop. Commit on branch ticket-707.
Follow-ups: ADR-0205 amendment extending affected-components to os and os-backlog is owed after #708 ships (owner: this session, VERDICT: CREATE).