Skip to content

Commit 1473d5f

Browse files
authored
fix(dx): unblock claude worktree start and pre-push hooks (#7059)
* fix(claude): remove blocking WorktreeCreate yarn install hook The synchronous WorktreeCreate hook ran yarn install with a 120s timeout, blocking the Claude Code TUI when launched with `-w`. With puppeteer and playwright in deps, the install reliably exceeds the timeout. The async SessionStart hook already handles "first session in a new worktree" via its `[ ! -d node_modules ]` guard, so the WorktreeCreate hook is redundant. Also harden SessionStart: - Skip puppeteer/playwright browser downloads - Bump timeout 120 -> 300 * fix(lefthook): disable docker-dependent pre-push hooks Comment out pre-push hooks that require docker: - prune-legacy-containers - build-pytest-image - *-pytest code-block test tasks (cloud, cloud-dedicated, cloud-serverless, clustered, telegraf, v2) These blocked pushes for any change when docker was not running locally, even when the change had nothing to do with code blocks or container management. Replace prune-legacy-containers with list-legacy-containers, a fault-safe task that exits 0 when docker is unavailable and only warns about exited influxdata-docs containers when docker is running. Run code-block tests on demand via yarn test:codeblocks:*.
1 parent 20bfac6 commit 1473d5f

2 files changed

Lines changed: 82 additions & 64 deletions

File tree

.claude/settings.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,25 +107,13 @@
107107
]
108108
}
109109
],
110-
"WorktreeCreate": [
111-
{
112-
"hooks": [
113-
{
114-
"type": "command",
115-
"command": "CYPRESS_INSTALL_BINARY=0 yarn install --frozen-lockfile 2>&1 | tail -3",
116-
"timeout": 120,
117-
"statusMessage": "Installing dependencies in new worktree"
118-
}
119-
]
120-
}
121-
],
122110
"SessionStart": [
123111
{
124112
"hooks": [
125113
{
126114
"type": "command",
127-
"command": "[ ! -d node_modules ] && CYPRESS_INSTALL_BINARY=0 yarn install --frozen-lockfile 2>&1 | tail -3 || true",
128-
"timeout": 120,
115+
"command": "[ ! -d node_modules ] && CYPRESS_INSTALL_BINARY=0 PUPPETEER_SKIP_DOWNLOAD=1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --frozen-lockfile 2>&1 | tail -3 || true",
116+
"timeout": 300,
129117
"async": true,
130118
"statusMessage": "Checking dependencies"
131119
}

lefthook.yml

Lines changed: 80 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -175,56 +175,86 @@ pre-push:
175175
exit $?
176176
177177
# Manage Docker containers
178-
prune-legacy-containers:
179-
priority: 1
180-
tags: test
181-
run: '(docker container ls --format "{{.ID}}"
182-
--filter label=tag=influxdata-docs
183-
--filter status=exited | xargs docker rm)
184-
|| true'
185-
build-pytest-image:
178+
# Disabled: original task fails when docker is not installed or running.
179+
# Replaced by list-legacy-containers below, which exits 0 when docker
180+
# is unavailable so the push is not blocked.
181+
# prune-legacy-containers:
182+
# priority: 1
183+
# tags: test
184+
# run: '(docker container ls --format "{{.ID}}"
185+
# --filter label=tag=influxdata-docs
186+
# --filter status=exited | xargs docker rm)
187+
# || true'
188+
list-legacy-containers:
186189
tags: test
187-
run: yarn build:pytest:image
188-
189-
# Test code blocks in markdown files
190-
cloud-pytest:
191-
glob: content/influxdb/cloud/*.md
192-
tags: test,codeblocks,v2
193-
env:
194-
SERVICE: cloud-pytest
195-
run: yarn test:codeblocks:cloud '{staged_files}'
196-
197-
cloud-dedicated-pytest:
198-
tags: test,codeblocks,v3
199-
glob: content/influxdb3/cloud-dedicated/*.md
200190
run: |
201-
yarn test:codeblocks:cloud-dedicated '{staged_files}' &&
202-
./test/scripts/monitor-tests.sh stop cloud-dedicated-pytest
203-
204-
cloud-serverless-pytest:
205-
tags: test,codeblocks,v3
206-
glob: content/influxdb3/cloud-serverless/*.md
207-
env:
208-
SERVICE: cloud-serverless-pytest
209-
run: yarn test:codeblocks:cloud-serverless '{staged_files}'
210-
211-
clustered-pytest:
212-
tags: test,codeblocks,v3
213-
glob: content/influxdb3/clustered/*.md
214-
run: |
215-
yarn test:codeblocks:clustered '{staged_files}' &&
216-
./test/scripts/monitor-tests.sh stop clustered-pytest
217-
218-
telegraf-pytest:
219-
tags: test,codeblocks
220-
glob: content/telegraf/*.md
221-
env:
222-
SERVICE: telegraf-pytest
223-
run: yarn test:codeblocks:telegraf '{staged_files}'
191+
if ! command -v docker >/dev/null 2>&1; then
192+
exit 0
193+
fi
194+
if ! docker info >/dev/null 2>&1; then
195+
exit 0
196+
fi
197+
legacy=$(docker container ls -a \
198+
--format "{{.ID}} {{.Names}}" \
199+
--filter label=tag=influxdata-docs \
200+
--filter status=exited 2>/dev/null)
201+
if [ -n "$legacy" ]; then
202+
echo "Note: exited influxdata-docs containers found (push not blocked):"
203+
echo "$legacy" | sed 's/^/ /'
204+
echo "Prune with: docker container prune --filter label=tag=influxdata-docs"
205+
fi
206+
exit 0
207+
# Disabled: builds the pytest image used by the *-pytest tasks below.
208+
# Now that those tasks are disabled, this task is dead weight and fails
209+
# when docker is not installed. Run `yarn build:pytest:image` manually
210+
# before invoking `yarn test:codeblocks:*` if you need a fresh image.
211+
# build-pytest-image:
212+
# tags: test
213+
# run: yarn build:pytest:image
224214

225-
v2-pytest:
226-
tags: test,codeblocks,v2
227-
glob: content/influxdb/v2/*.md
228-
env:
229-
SERVICE: v2-pytest
230-
run: yarn test:codeblocks:v2 '{staged_files}'
215+
# Test code blocks in markdown files
216+
# Disabled: codeblock tests require docker and a configured product
217+
# environment. Run them on demand instead:
218+
# yarn test:codeblocks:all
219+
# yarn test:codeblocks:<product>
220+
# cloud-pytest:
221+
# glob: content/influxdb/cloud/*.md
222+
# tags: test,codeblocks,v2
223+
# env:
224+
# SERVICE: cloud-pytest
225+
# run: yarn test:codeblocks:cloud '{staged_files}'
226+
#
227+
# cloud-dedicated-pytest:
228+
# tags: test,codeblocks,v3
229+
# glob: content/influxdb3/cloud-dedicated/*.md
230+
# run: |
231+
# yarn test:codeblocks:cloud-dedicated '{staged_files}' &&
232+
# ./test/scripts/monitor-tests.sh stop cloud-dedicated-pytest
233+
#
234+
# cloud-serverless-pytest:
235+
# tags: test,codeblocks,v3
236+
# glob: content/influxdb3/cloud-serverless/*.md
237+
# env:
238+
# SERVICE: cloud-serverless-pytest
239+
# run: yarn test:codeblocks:cloud-serverless '{staged_files}'
240+
#
241+
# clustered-pytest:
242+
# tags: test,codeblocks,v3
243+
# glob: content/influxdb3/clustered/*.md
244+
# run: |
245+
# yarn test:codeblocks:clustered '{staged_files}' &&
246+
# ./test/scripts/monitor-tests.sh stop clustered-pytest
247+
#
248+
# telegraf-pytest:
249+
# tags: test,codeblocks
250+
# glob: content/telegraf/*.md
251+
# env:
252+
# SERVICE: telegraf-pytest
253+
# run: yarn test:codeblocks:telegraf '{staged_files}'
254+
#
255+
# v2-pytest:
256+
# tags: test,codeblocks,v2
257+
# glob: content/influxdb/v2/*.md
258+
# env:
259+
# SERVICE: v2-pytest
260+
# run: yarn test:codeblocks:v2 '{staged_files}'

0 commit comments

Comments
 (0)