Files
improvise/.claude
Claude 3fd775d3c6 fix(hooks): guard mktemp so a failure cannot stage at the filesystem root
Review of #7: `TMP="$(mktemp -d)"` was unchecked. With TMP empty,
"$TMP/$DB_NAME" is not a relative path under a temp directory — it is
`/improvise`, an absolute path at the filesystem root, which the hook
then creates and clones into. The cleanup at the end degrades to
`rm -rf ""`, so the real temp directory, if any, leaks too.

The mktemp now sits in the condition that guards the whole block, so a
failure skips the sync with a warning instead of proceeding with a broken
path, and no temp directory is created at all when there is no origin to
sync from. Putting it in the condition also avoids reindenting the body,
which keeps this diff to the thing it fixes.

Verified by stubbing mktemp to fail: the warning is printed, the sync is
skipped, and nothing appears at /improvise. The normal path still syncs
169 issues with the repo clean.

This is the fourth finding in this family on this branch — unchecked
status on an operation whose failure produces a plausible-looking wrong
value rather than an error. The others were bd init leaving an empty
database behind, the unchecked mv that nested the new tracker inside the
old one, and jq's status being swallowed by a process substitution.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DyHK7L8S1XDX3EihTnSKaX
2026-09-19 07:37:24 +00:00
..