Repository navigation
test(claude): cover claudesession env, staging, state script and worktrees - #1275
Merged
Merged
Conversation
…trees Adds tests that guard why each behavior matters: token mode fails loudly instead of falling back to /login, API keys survive sh sourcing exactly, secrets reach the box via a 0600 file and never ssh argv, the state script keeps box-side theme/keys and dedupes approvals, task names stay within the pattern that protects the unquoted worktree path, and worktrees need git and handle paths with spaces. claudesession.go coverage: 84.8% -> 97.0%. Claude-Session: https://claude.ai/code/session_01Ba6Vc66D5hH1xSTvJcCbVz
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1275 +/- ##
==========================================
+ Coverage 50.44% 50.64% +0.19%
==========================================
Files 83 83
Lines 9822 9822
==========================================
+ Hits 4955 4974 +19
+ Misses 4867 4848 -19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 27, 2026
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.
Adds 9 tests to
cmd/claudesession_test.go. Coverage ofclaudesession.gogoes from 84.8% to 97.0%.What they guard
onctl claude login. Auto mode falls back to/loginon the box. A fakesecuritykeeps the test away from the real Keychain.sh, and a key containing',$and backticks arrives unchanged, with surrounding whitespace trimmed. The approval suffix is the key's last 20 characters.stageClaudeEnvwrites them to a 0600 file. They never appear in ssh's arguments, and an empty env makes no ssh call.~/.claude.jsonand a directory name full of shell metacharacters. This test skips whenjqisn't installed.I deliberately broke
claudesession.go13 ways, one at a time, and each break made at least one new test fail.Known gaps (not addressed here)
claudesession_test.go:66-69only logs witht.Logf, so it can never fail.jqinstalled, the state-script tests skip.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ba6Vc66D5hH1xSTvJcCbVz