Hash session+branch for sidecar dedup (FACT-176)#330
Conversation
c95fa6d to
0a51546
Compare
0a51546 to
916d4f6
Compare
|
Two things from claude:
{"sess-1", "main", "sidecar.sess-1-" + hashFor("sess-1", "main") + ".json"},Regressions become immediately visible without having to parse the filename apart. |
schurchleycci
left a comment
There was a problem hiding this comment.
The comments from Claude seem worth addressing, but otherwise this looks good!
- Sidecar state files are now named sidecar.<sessionID>-<hash8>.json where hash8 = sha256(sessionID+":"+branch)[:4], isolating concurrent sessions and branches without exposing raw branch names in filenames. - Auto-named sidecars use the same <base>-<sessionID>-<hash8> scheme; falls back to sanitised branch name when no session ID is present. - Export sidecar.CurrentBranch so cmd/validate.go can reuse it instead of duplicating the git invocation inline. - Pin hash assertions in tests with hashFor() instead of structural checks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7d735f7 to
da8fa2d
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
sidecar.<sessionID>-<hash8>.jsonwherehash8 = sha256(sessionID + ":" + branch)[:4], so concurrent sessions and different branches each get isolated state without the raw branch name appearing in the filename.chunk validatewhen no active sidecar exists) now use the same<base>-<sessionID>-<hash8>scheme instead of embedding the raw branch string directly. Falls back to the sanitised branch name when no session ID is present.Test plan
go test -race ./internal/sidecar/...— unit tests forsidecarFileNamehash stability and per-branch uniquenessgo test -race ./internal/cmd/...— unit tests forsidecarAutoNamewith/without session IDTestValidateHookMode_SessionIsolationverifies two concurrent sessions see separate state files🤖 Generated with Claude Code