Skip to content

chore(hooks): add Claude Code session hooks + drift-guard (P4)#70

Merged
silversurfer562 merged 2 commits into
mainfrom
chore/claude-session-hooks
Jun 17, 2026
Merged

chore(hooks): add Claude Code session hooks + drift-guard (P4)#70
silversurfer562 merged 2 commits into
mainfrom
chore/claude-session-hooks

Conversation

@silversurfer562

Copy link
Copy Markdown
Member

What

Vendor attune-ai's canonical Claude Code session hooks into attune-gui — P4, the final layer of specs/sibling-claude-hooks (P1 rag #151, P2 author #59/#68, P3 help #13).

Vendors the current 8-file canonical (includes _sdk_gate.py, the SDK-subprocess-isolation fix) — no re-sync debt.

Changes

  • .claude/hooks/ — 8 hooks byte-identical from attune-ai/plugin/hooks/ (verified 8/8)
  • .canonical-sha256 (8 entries); sync-hooks target merged into the existing Makefile alongside regen-all (not overwritten)
  • .claude/settings.json hooks block; .gitattributes LF pin; .gitignore tracks .claude/hooks/ + settings.json
  • sidecar/tests/test_claude_hooks_{drift,behavior}.py — gui tests live under sidecar/tests/, so the path uses parents[2]

gui-specific notes

  • Tests placed in sidecar/tests/ so testpaths + CI's pytest sidecar/tests/ pick them up
  • CI's ruff check sidecar/ lints the test files (not the hooks) — behavior test # noqa: S603 (trusted subprocess: sys.executable + a vendored hook path)
  • No SPECS_DIR divergence: P0 discovery probes both specs/ and docs/specs/, and gui has both

Verification

  • pytest: 17 passed
  • ruff check sidecar/tests/... under gui config: clean

🤖 Generated with Claude Code

silversurfer562 and others added 2 commits June 17, 2026 04:29
Vendor attune-ai's canonical Claude Code session hooks into attune-gui,
completing the sibling-claude-hooks rollout (P1 rag, P2 author, P3 help).
Vendors the current 8-file closure (includes _sdk_gate.py / the
SDK-subprocess fix), so no re-sync is needed.

- .claude/hooks/: 8 hooks byte-identical from attune-ai/plugin/hooks
- .canonical-sha256 manifest (8 entries); sync-hooks target merged into
  the existing Makefile alongside regen-all (ATTUNE_AI_ROOT default ../attune-ai)
- .claude/settings.json hooks block
- .gitattributes pins LF on the hook tree
- .gitignore: track .claude/hooks/ + settings.json, ignore the rest
- sidecar/tests/: drift-guard + behavior smoke tests (parents[2] — gui
  tests live under sidecar/tests/). Behavior test noqa's S603 (trusted
  subprocess: sys.executable + a vendored hook path)

Refs specs/sibling-claude-hooks (P4).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The behavior tests spawn `python .claude/hooks/<hook>.py` subprocesses.
Under `--cov` (gui coverage uses branch=true), pytest-cov's COV_CORE_*
env vars make those children auto-start *statement* coverage, whose
data file can't combine with the parent's branch data at finish() —
"Can't combine statement coverage data with branch data" (574 passed,
then coverage combine crashes the run).

Strip COV_CORE_*/COVERAGE_PROCESS_START in _run_hook so the spawned
hooks never start coverage. Zero coverage loss: the hooks live in
.claude/hooks/, outside source=["sidecar/attune_gui"].

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@silversurfer562 silversurfer562 merged commit 9205ca5 into main Jun 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant