Files
zeekay 10e6fec4c0 debrand: the brand token is INSIGHTS_, and a wrong one stops the container
The rule table mapped HOG_ -> FN_ ahead of any POSTHOG rule, so POSTHOG_FOO
split into POST + HOG_ and came out POSTFN_FOO. Nothing sets that. The live
pods set INSIGHTS_SKIP_MIGRATION_CHECKS, which bin/migrate-check reads on the
container entrypoint, so the misspelling does not degrade a feature -- it runs
migrate --check against a database whose history this tree does not share and
the container never starts.

Both replacements are measured against the shipped tree rather than chosen:
every HOG_ name with a counterpart there is spelled INSIGHTS_ (HOG_QL ->
INSIGHTS_QL, HOG_FUNCTION_TEMPLATES -> INSIGHTS_FUNCTION_TEMPLATES, 12 of 12
determinate cases), and FN_ appears in it nowhere. Upstream carries 95 HOG_
tokens and zero FN_ ones, so repairing FN_ back out is exactly the inverse of
the bad rule and cannot collide with an upstream name.

The rule is fixed for the next convergence, and the tree it already produced is
repaired in the same commit -- the codemod is idempotent against its own output,
so it cannot undo this itself.
2026-08-01 17:42:28 -07:00

34 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
[ -f "$(dirname "$0")/_/husky.sh" ] && . "$(dirname "$0")/_/husky.sh"
# Args: $1=prev_ref, $2=new_ref, $3=1 if branch checkout, 0 if file checkout
[ "$3" = "1" ] || exit 0
# Detect worktree: .git is a file (not a directory) pointing to the main repo
[ -f .git ] || exit 0
# Borrow node_modules from the main clone when lockfiles match, so a freshly
# created worktree doesn't need its own pnpm install at all. Resolve the
# helper relative to this hook file, not cwd: core.hooksPath may be absolute
# (hook file lives in the main clone) or relative (worktree's own checkout),
# and cwd is always the active worktree, which may not contain the helper.
HOOK_DIR="$(cd "$(dirname "$0")" && pwd)"
if [ -f "$HOOK_DIR/../bin/helpers/worktree-borrow.sh" ]; then
. "$HOOK_DIR/../bin/helpers/worktree-borrow.sh"
insights_worktree_borrow node
fi
if [ "$INSIGHTS_BORROW_NODE" = "1" ]; then
echo "husky: worktree detected, borrowing node_modules from main clone"
else
if ! command -v pnpm > /dev/null 2>&1; then
echo "husky: pnpm not found, skipping worktree bootstrap"
exit 0
fi
if [ ! -d node_modules/.pnpm ]; then
echo "husky: worktree detected, bootstrapping with pnpm install ..."
pnpm install --frozen-lockfile --filter=.
fi
fi