Skip to content

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

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

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.
  • Regenerate the split on current main and retain hook process-tree containment, observer EOF handling, and the Windows EOF regression coverage.

Closes #4082.

Verification

  • cargo test -p codewhale-tui hooks:: --locked (65 passed)
  • cargo fmt --all -- --check
  • cargo clippy -p codewhale-tui --bin codewhale-tui --locked -- -A clippy::collapsible_match -D warnings (the strict form is currently capped by an unrelated existing UI lint)
  • git diff --check
  • Confirmed hooks/config.rs has no subprocess imports; decision-JSON and timeout coverage remain unchanged.

@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

Signed-off-by: cyq <15000851237@163.com>
@cyq1017
cyq1017 force-pushed the codex/codewhale-4082-hooks-split branch from 4590065 to 6d38efd Compare July 22, 2026 23:45
@cyq1017
cyq1017 marked this pull request as ready for review July 22, 2026 23:45
@cyq1017
cyq1017 requested a review from Hmbown as a code owner July 22, 2026 23:45
@Hmbown

Hmbown commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Status update from the v0.9.2 maintainer pass, @cyq1017 — deferring to v0.9.3, with one concrete blocker.

The refactor itself reads well: splitting hooks into config and executor modules is the right seam, and it is the kind of structural change that gets harder to land the longer it waits.

The blocker is that Test (windows-latest) is red on this branch. That is not a formality — hooks touch process spawning, and Windows is where that path diverges most. It needs triage before the merge window rather than during it.

If you can reproduce and fix the Windows failure, this becomes an easy merge. If you'd like, say so and I'll take a look at the failure specifically — I don't want a structural cleanup to rot because of one platform job.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks @cyq1017 — your contribution landed in 935cb206e07f on main:

refactor(hooks): split config and executor modules

Closing this PR now that the code is on main. Credit lives in the commit message and (where applicable) the CHANGELOG.md entry for the next release. Apologies for not closing this at the time of the merge — the auto-close workflow is new in v0.8.31.

If you want to land more work and would prefer your future PRs merge cleanly without a harvest step, the CONTRIBUTING.md doc has a short note on what makes a contribution mergeable as-is.

@github-actions github-actions Bot closed this Jul 26, 2026
pull Bot pushed a commit to dolfly/DeepSeek-TUI that referenced this pull request Jul 26, 2026
Move data-only hook configuration into hooks/config.rs and process execution, timeout, and decision parsing into hooks/executor.rs while preserving crate::hooks re-exports.

Closes Hmbown#4082.

Harvested from PR Hmbown#4087 by @cyq1017

Co-authored-by: cyq1017 <61975706+cyq1017@users.noreply.github.com>
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