Skip to content

fix: silence hooks when Node is unavailable - #712

Open
ousamabenyounes wants to merge 1 commit into
DietrichGebert:mainfrom
ousamabenyounes:fix/issue-708
Open

fix: silence hooks when Node is unavailable#712
ousamabenyounes wants to merge 1 commit into
DietrichGebert:mainfrom
ousamabenyounes:fix/issue-708

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Route Claude and Codex lifecycle hooks through a cross-platform launcher that exits quietly when Node is unavailable while preserving normal hook behavior.

Test verification (RED → GREEN)

With the fix reverted, the new test fails (RED):

TAP version 13
# Subtest: shared hooks exit quietly when node is unavailable (\#708)
not ok 1 - shared hooks exit quietly when node is unavailable (\#708)
  ---
  duration_ms: 6.557026
  type: 'test'
  location: '/home/ousama/www/public/ousamabenyounes/ponytail/tests/hooks-windows.test.js:57:1'
  failureType: 'testCodeFailure'
  error: |-
    hook failed without node: /bin/sh: 1: node: not found
    
    
    127 !== 0
    
  code: 'ERR_ASSERTION'
  name: 'AssertionError'
  expected: 0
  actual: 127
  operator: 'strictEqual'
  stack: |-
    TestContext.<anonymous> (/home/ousama/www/public/ousamabenyounes/ponytail/tests/hooks-windows.test.js:64:12)
    Test.runInAsyncScope (node:async_hooks:214:14)
    Test.run (node:internal/test_runner/test:1047:25)
    Test.start (node:internal/test_runner/test:944:17)
    startSubtestAfterBootstrap (node:internal/test_runner/harness:296:17)
  ...
1..1
# tests 1
# suites 0
# pass 0
# fail 1
# cancelled 0
# skipped 0
# todo 0
# duration_ms 96.191256

With the fix applied, the test passes (GREEN):

TAP version 13
# Subtest: shared hooks exit quietly when node is unavailable (\#708)
ok 1 - shared hooks exit quietly when node is unavailable (\#708)
  ---
  duration_ms: 16.748734
  type: 'test'
  ...
1..1
# tests 1
# suites 0
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 115.226943

Full local suite

Command: node scripts/check-rule-copies.js && node scripts/check-versions.js && npm test

# tests 23
# suites 0
# pass 23
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 130.213113

> ponytail-mcp@4.9.0 test
> node --test ./test/*.test.js

TAP version 13
# Subtest: resolveMode keeps valid intensities
ok 1 - resolveMode keeps valid intensities
  ---
  duration_ms: 2.766971
  type: 'test'
  ...
# Subtest: resolveMode falls back to a runtime intensity for off/unknown/empty
ok 2 - resolveMode falls back to a runtime intensity for off/unknown/empty
  ---
  duration_ms: 1.007104
  type: 'test'
  ...
# Subtest: buildInstructions returns the ruleset tagged with the resolved mode
ok 3 - buildInstructions returns the ruleset tagged with the resolved mode
  ---
  duration_ms: 0.933625
  type: 'test'
  ...
1..3
# tests 3
# suites 0
# pass 3
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 89.781739

Fix #708

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.

Hook error on missing Node (macOS native Claude install)

1 participant