helper sync overwrites hook-handler.cjs test surface (require.main guard + exports) — make the sync preserve it or test it
- Dominant language
- TypeScript
- Stars
- 72.7k
- Forks
- 8.6k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 83
Description
**Observed (2026-09-05 mission review, verified):** `a5f86ad0a` ("chore: sync repo dogfood helpers to 3.23.0", 2026-07-04) replaced both copies of `hook-handler.cjs` (repo `.claude/helpers/` and `v3/@claude-flow/cli/.claude/helpers/`) with the packaged build and silently dropped what `cb1e93e8d` (2026-06-15) had added for `tests/hook-handler-runwithtimeout.test.cjs`: the `if (require.main === module)` guard around `main()` and `module.exports = { runWithTimeout, INTELLIGENCE_TIMEOUT_MS }`. Requiring the helper from a test then ran `main()` (stdin read + `process.exit`) and exposed nothing — `runWithTimeout is not a function`.
Nobody noticed for two months because the Test Suite job could not run: root `npm ci` died at `ETARGET` on `@claude-flow/mcp@3.0.0-alpha.10` from 2026-08-22 until #3203. The failure surfaced on the first PR runs after that fix (#3177, #3184) and is restored in #3204.
**Ask:** whichever path produces the "sync dogfood helpers" commits (release tooling or a manual copy) must either (a) carry the guard + exports in the packaged source so a sync cannot drop them, or (b) run `node --test tests/hook-handler-runwithtimeout.test.cjs` as part of the sync/release gate so a regression fails before commit. (a) is already true after #3204 if the packaged copy is the source of the next sync; this issue tracks confirming that and adding (b).
🤖 Generated with [RuFlo](https://github.com/ruvnet/ruflo)
https://claude.ai/code/session_019xHM4rAH4aaShb4DTr1n6s
Contributor guide
Research direction
Compare .claude/helpers/hook-handler.cjs with v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs and inspect the packaged source or sync entry point that produces them. Run node --test tests/hook-handler-runwithtimeout.test.cjs first. Done means synchronization preserves the require.main guard and exports, and the test runs in the sync or release gate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- build-system, release, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100