Plugin code finds the home directory in 16 files: resolve known locations once at each entry #1650

Open
opened 2026-11-09 17:54:20 +00:00 by jared · 0 comments
Owner

Problem

16 files in 6 plugins read the home directory themselves (Etc.getpwuid.dir, Dir.home, ENV["HOME"]). They use it to find ~/.claude, ~/dev, transcripts, and repo links. Jared ruled on 2026-11-09 that paths are data, configured once in the codebase. Scattered lookups make the code brittle across machines. The file repo_root_link.rb exists three times (plugins/os, os-adr, os-backlog). Two more files, os_git_link.rb and handoff.rb, use the same fallback path.

Observed

The command grep -rn "Etc.getpwuid.dir\|Dir.home\|ENV\[.HOME.\]" plugins/*/lib plugins/*/bin plugins/*/hooks found these lines on 2026-11-09.

plugins/os-adr/lib/adr/repo_root_link.rb:7
plugins/os-backlog/lib/backlog/repo_root_link.rb:7
plugins/os-aidd-lint/lib/aidd_lint/os_git_link.rb:7
plugins/os/lib/handoff.rb:6
plugins/os/lib/os_hooks/context.rb:10
plugins/os/lib/handoff/worktree.rb:21
plugins/os/lib/os_hooks/repo_root_link.rb:7
plugins/os-me/lib/os_me/cli.rb:11
plugins/os-me/lib/os_me/cli.rb:12
plugins/os-sdlc/lib/os_sdlc/agent/transcript_path.rb:16
plugins/os-sdlc/lib/os_sdlc/project/root_search.rb:6
plugins/os-sdlc/lib/os_sdlc/project/root_search.rb:8
plugins/os-sdlc/lib/os_sdlc/project/root_search.rb:10
plugins/os-backlog/bin/wakeup-poll:18
plugins/os-backlog/bin/os-backlog:15
plugins/os-me/hooks/extract_moments.rb:7
plugins/os-me/hooks/one_thing.rb:6
plugins/os-me/hooks/record_prediction.rb:9
plugins/os-me/hooks/log_invocation.rb:8

A review of the os-sdlc lint slice (commit 15964b911) found a recorded fixture that held /home/jared paths.

Reproduce

n/a: design ticket. The grep above shows the problem.

Approach

The environment is external input (.claude/rules/ruby-external-calls.md, ruling 88). Each entry (hook script, bin/ script, CLI class) reads the home directory and the known locations once. It passes them in. Library code does not look them up.

Required work: none beyond the acceptance criteria.

Orchestrator work: decide under ADR-0279 whether the three repo_root_link.rb copies move into a shared gem owned by the domain owner.

Non-goals: Gemfiles are out of scope. ADR-0310 covers gem sources.

Acceptance criteria

  1. Given plugins/*/lib, when searched for Etc.getpwuid.dir, Dir.home, and ENV["HOME"], then none is found.
  2. Given each plugin's suite, when it runs with HOME set to an empty temp dir, then it is green.
  3. Given the repo, when searched for repo_root_link.rb, then one owner exists or a recorded ruling keeps the copies.

Origin

  • Trigger: review of the os-sdlc lint slice (commit 15964b911), where a recorded fixture held /home/jared paths
  • Improvised this session: none
  • Chain: fixture holds machine paths ← library code looks up the home directory ← DESIGN (.claude/rules/ruby-external-calls.md, ruling 88)
  • Root candidate: none found; searched Dir.home, getpwuid, home directory, repo_root_link, os_git_link, /home/jared, ruling 88, ruby-external-calls
  • Where: plugins/os/lib/os_hooks/repo_root_link.rb, plugins/os-adr/lib/adr/repo_root_link.rb, plugins/os-backlog/lib/backlog/repo_root_link.rb
  • Session: bc5ad309-36b7-4fe5-a67f-1d90187242eb
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os-plugins-os-sdlc/bc5ad309-36b7-4fe5-a67f-1d90187242eb.jsonl

VERDICT: CREATE (ticket-skeptic, 2026-11-09): no open ticket covers home-directory lookups in plugin lib, bin, or hook code.

## Problem 16 files in 6 plugins read the home directory themselves (`Etc.getpwuid.dir`, `Dir.home`, `ENV["HOME"]`). They use it to find `~/.claude`, `~/dev`, transcripts, and repo links. Jared ruled on 2026-11-09 that paths are data, configured once in the codebase. Scattered lookups make the code brittle across machines. The file `repo_root_link.rb` exists three times (plugins/os, os-adr, os-backlog). Two more files, `os_git_link.rb` and `handoff.rb`, use the same fallback path. ## Observed The command `grep -rn "Etc.getpwuid.dir\|Dir.home\|ENV\[.HOME.\]" plugins/*/lib plugins/*/bin plugins/*/hooks` found these lines on 2026-11-09. ``` plugins/os-adr/lib/adr/repo_root_link.rb:7 plugins/os-backlog/lib/backlog/repo_root_link.rb:7 plugins/os-aidd-lint/lib/aidd_lint/os_git_link.rb:7 plugins/os/lib/handoff.rb:6 plugins/os/lib/os_hooks/context.rb:10 plugins/os/lib/handoff/worktree.rb:21 plugins/os/lib/os_hooks/repo_root_link.rb:7 plugins/os-me/lib/os_me/cli.rb:11 plugins/os-me/lib/os_me/cli.rb:12 plugins/os-sdlc/lib/os_sdlc/agent/transcript_path.rb:16 plugins/os-sdlc/lib/os_sdlc/project/root_search.rb:6 plugins/os-sdlc/lib/os_sdlc/project/root_search.rb:8 plugins/os-sdlc/lib/os_sdlc/project/root_search.rb:10 plugins/os-backlog/bin/wakeup-poll:18 plugins/os-backlog/bin/os-backlog:15 plugins/os-me/hooks/extract_moments.rb:7 plugins/os-me/hooks/one_thing.rb:6 plugins/os-me/hooks/record_prediction.rb:9 plugins/os-me/hooks/log_invocation.rb:8 ``` A review of the os-sdlc lint slice (commit 15964b911) found a recorded fixture that held `/home/jared` paths. ## Reproduce n/a: design ticket. The grep above shows the problem. ## Approach The environment is external input (`.claude/rules/ruby-external-calls.md`, ruling 88). Each entry (hook script, `bin/` script, CLI class) reads the home directory and the known locations once. It passes them in. Library code does not look them up. Required work: none beyond the acceptance criteria. Orchestrator work: decide under ADR-0279 whether the three `repo_root_link.rb` copies move into a shared gem owned by the domain owner. Non-goals: Gemfiles are out of scope. ADR-0310 covers gem sources. ## Acceptance criteria 1. Given plugins/*/lib, when searched for `Etc.getpwuid.dir`, `Dir.home`, and `ENV["HOME"]`, then none is found. 2. Given each plugin's suite, when it runs with HOME set to an empty temp dir, then it is green. 3. Given the repo, when searched for `repo_root_link.rb`, then one owner exists or a recorded ruling keeps the copies. ## Origin - Trigger: review of the os-sdlc lint slice (commit 15964b911), where a recorded fixture held `/home/jared` paths - Improvised this session: none - Chain: fixture holds machine paths ← library code looks up the home directory ← DESIGN (`.claude/rules/ruby-external-calls.md`, ruling 88) - Root candidate: none found; searched Dir.home, getpwuid, home directory, repo_root_link, os_git_link, /home/jared, ruling 88, ruby-external-calls - Where: `plugins/os/lib/os_hooks/repo_root_link.rb`, `plugins/os-adr/lib/adr/repo_root_link.rb`, `plugins/os-backlog/lib/backlog/repo_root_link.rb` - Session: bc5ad309-36b7-4fe5-a67f-1d90187242eb - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os-plugins-os-sdlc/bc5ad309-36b7-4fe5-a67f-1d90187242eb.jsonl VERDICT: CREATE (ticket-skeptic, 2026-11-09): no open ticket covers home-directory lookups in plugin lib, bin, or hook code.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#1650
No description provided.