Skip to content

refactor(hooks): split config and executor modules#4087

Draft
cyq1017 wants to merge 1 commit into
Hmbown:mainfrom
cyq1017:codex/codewhale-4082-hooks-split
Draft

refactor(hooks): split config and executor modules#4087
cyq1017 wants to merge 1 commit into
Hmbown:mainfrom
cyq1017:codex/codewhale-4082-hooks-split

Conversation

@cyq1017

@cyq1017 cyq1017 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Problem

crates/tui/src/hooks.rs mixed hook config definitions with executor runtime behavior in one large module, which made hooks policy changes harder to review.

Change

  • Move hook events, conditions, hook definitions, and HooksConfig into hooks/config.rs.
  • Move HookExecutor, subprocess execution, timeout handling, stdout parsing, payload helpers, and tests into hooks/executor.rs.
  • Keep the existing root crate::hooks::* API available through re-exports.

Closes #4082.

Verification

  • cargo test -p codewhale-tui hooks:: --locked -- --nocapture
  • RUSTFLAGS='-Dwarnings' cargo test -p codewhale-tui hooks:: --locked -- --nocapture
  • cargo fmt --all -- --check
  • git diff --check

@Hmbown Hmbown added this to the v0.8.68 milestone Jul 7, 2026 — with ChatGPT Codex Connector
@Hmbown Hmbown added the v0.8.69 label Jul 7, 2026
@Hmbown Hmbown modified the milestones: v0.8.68, v0.8.69 Jul 7, 2026
@Hmbown Hmbown added v0.9.1 Targeting v0.9.1 and removed v0.8.69 labels Jul 16, 2026
@cyq1017
cyq1017 force-pushed the codex/codewhale-4082-hooks-split branch from 20528e1 to 4590065 Compare July 16, 2026 19:32
@Hmbown Hmbown removed this from the v0.9.1 milestone Jul 16, 2026
@Hmbown Hmbown removed the v0.9.1 Targeting v0.9.1 label Jul 16, 2026
@Hmbown Hmbown added this to the v0.9.3 milestone Jul 16, 2026
@Hmbown Hmbown added the v0.9.3 Targeting v0.9.3 label Jul 16, 2026

Hmbown commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Thanks — this is the split #4082 asks for, done cleanly: hooks/config.rs holds the event/matcher/HooksConfig types with no subprocess dependencies, hooks/executor.rs owns HookExecutor, spawn/wait/timeout, and stdout-decision parsing along with the 56 moved tests, and the nine-line hooks.rs shim keeps crate::hooks::* stable. The head also has a fully green matrix (ubuntu/macos/windows tests, lint, DCO) from July 16 — appreciated.

Where it stands: #4082 is on the v0.9.3 milestone, behind the v0.9.1 freeze and the active v0.9.2 lane, so there is runway — but the branch is stale in the one way that matters for a file move. Main's hooks.rs picked up three fixes on July 17-18 (ee8b6db process-tree containment, b8258fc observer EOF via closed pipe, 525ef8a Windows EOF regression test) and now sits at 3,018 lines versus 2,593 at the cut, so the move will conflict and a naive resolution could drop those fixes.

Path to land:

  1. Regenerate the split on current main rather than doing conflict surgery — re-apply the same module boundaries so the new executor fixes end up inside hooks/executor.rs.
  2. Re-run cargo fmt and cargo test -p codewhale-tui hooks::, and note in the body that the v0.9.3 refactor(hooks): split config types from HookExecutor #4082 acceptance criteria hold (config module free of subprocess imports; decision-JSON and timeout tests unchanged).
  3. Mark the PR ready for review.

If you would rather not redo the move, say so — it is small enough to regenerate maintainer-side and land with your credit (Co-authored-by plus Harvested from PR #4087 by @cyq1017). Closing #4082 stays attached to your work either way.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v0.9.3 Targeting v0.9.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.9.3 refactor(hooks): split config types from HookExecutor

2 participants