testsAndMisc/docs/shared-checkout-safety.md
Krzysztof kuhy Rudnicki d740d1513f Retarget the handoff on verifiability; split out the shared-checkout doc
The suggested order sorted by line count, which is the wrong axis: two
"cheap" near-miss files (nvidia_troubleshoot.sh, install_usage_monitoring.sh)
turned out to write to /etc and $HOME by shell redirection, which no PATH
stub can intercept, so neither can be verified at all. Meanwhile the
easiest split of the session was a 421-line test suite that reports its
own pass count. The handoff now opens with a two-grep triage and orders
by what can be proved.

Also records that fresh-install/main.sh is not the easy one it looks like
(sudo -v at top level, a local -n nameref, and two cwd-relative reads),
and that a run must enter the code that moved -- lint_python.sh --quick
exits before the extracted block, so that comparison proved almost
nothing.

The concurrency section moves to docs/shared-checkout-safety.md: it is
general session hygiene, not refactor state, and the handoff was 288
lines -- over the cap it exists to enforce. 288 -> 248.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-16 23:10:25 +02:00

1.2 KiB

Working safely in a shared ~/testsAndMisc checkout

Split out of refactor_claude_todo_resume.md (which hit the 250-line cap it exists to enforce). Nothing here is specific to the file-length refactor -- it applies to any long session in this tree.

Check for another agent FIRST

A past session collided with a second Claude from ~/.claude/scripts/claude-autoresume.sh on the same tree: shared git index, so its files landed in the other's staging area, it won a commit race, then hung for 17 minutes on an API request with no read timeout. Run this before touching the index, and kill anything live (it commits in-flight work on the way out):

pgrep -af 'claude -p' | grep -v grep     # autoresume runs `claude -p ... --continue`
ps -o pid=,etime=,time= -p <pid>         # 7s CPU over 17min = not working
pgrep -P <pid> -a                        # only MCP servers = no command running
ss -tnp | grep <pid>                     # ESTAB to :443 with 0/0 queued = half-open

If the tree looks suspiciously clean, killing a process mid-pre-commit stranded the changes it stashed. Recover them, do not retype them: ls -lt ~/.cache/pre-commit/patch* | head then git apply the newest.