ECC/tests/hooks
Taro Kawakami a35b2d125d fix(hooks): isolate session-end.js filename using transcript_path UUID
When session-end.js runs and CLAUDE_SESSION_ID is unset, getSessionIdShort()
falls back to the project/worktree name. If any other Stop-hook in the chain
spawns a claude subprocess (e.g. an AI-summary generator using 'claude -p'),
the subprocess also fires the full Stop chain and writes to the same project-
name-based filename, clobbering the parent's valid session summary with a
summary of the summarization prompt itself.

Fix: when stdin JSON (or CLAUDE_TRANSCRIPT_PATH) provides a transcript_path,
extract the first 8 hex chars of the session UUID from the filename and use
that as shortId. Falls back to the original getSessionIdShort() when no
transcript_path is available, so existing behavior is preserved for all
callers that do not set it.

Adds a regression test in tests/hooks/hooks.test.js.

Refs #1494
2026-04-19 11:37:32 +09:00
..
auto-tmux-dev.test.js feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
bash-hook-dispatcher.test.js fix: consolidate bash hooks without fork storms 2026-04-14 21:23:57 -07:00
block-no-verify.test.js fix: address PR review comments on block-no-verify hook 2026-04-12 20:29:01 -05:00
check-hook-enabled.test.js feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
config-protection.test.js fix: finish blocker lane hook and install regressions 2026-03-25 04:00:50 -04:00
cost-tracker.test.js feat: sync ecc2 cost tracker metrics 2026-04-09 06:22:20 -07:00
design-quality-check.test.js feat: add web frontend rules and design quality hook 2026-04-02 17:33:17 -07:00
detect-project-worktree.test.js fix(tests): resolve Windows CI test failures (#701) 2026-03-20 03:37:21 -07:00
doc-file-warning.test.js refactor: address reviewer feedback 2026-03-29 10:09:02 +08:00
evaluate-session.test.js fix: remove unused execFileSync import (no-unused-vars ESLint) 2026-02-18 07:15:53 +05:30
gateguard-fact-force.test.js fix: harden urgent install and gateguard patch 2026-04-14 19:44:08 -07:00
governance-capture.test.js fix: resolve blocker PR validation regressions 2026-03-25 01:34:29 -04:00
hook-flags.test.js feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
hooks.test.js fix(hooks): isolate session-end.js filename using transcript_path UUID 2026-04-19 11:37:32 +09:00
mcp-health-check.test.js test: wait for http mcp fixtures to accept connections 2026-04-12 23:38:46 -07:00
observe-subdirectory-detection.test.js fix(clv2): resolve cwd to git root before project detection 2026-03-30 04:46:31 -04:00
observer-memory.test.js fix: harden windows observer prompt handling 2026-04-06 14:05:38 -07:00
post-bash-hooks.test.js feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
pre-bash-commit-quality.test.js fix(hooks): make pre-commit quality checks enforce staged state 2026-03-29 00:07:18 -04:00
pre-bash-dev-server-block.test.js feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
pre-bash-reminders.test.js feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
quality-gate.test.js feat: add C++ language support and hook tests (#539) 2026-03-16 14:31:49 -07:00
session-activity-tracker.test.js fix: detach ecc2 background session runners (#1387) 2026-04-12 22:29:05 -07:00
stop-format-typecheck.test.js perf(hooks): batch format+typecheck at Stop instead of per Edit (#746) 2026-03-31 14:12:12 -07:00
suggest-compact.test.js test: isolate suggest-compact counter fixtures 2026-03-25 03:51:15 -04:00