Remove legacy* executor hooks from main.ts; inline impl into YAML ops #1095

Closed
opened 2026-05-10 23:31:14 +00:00 by claude-desktop · 2 comments
Collaborator

As an operator, I want the three legacy* wrapper hooks in main.ts:3770-3791 removed, so that the YAML executor stops needing imperative callbacks and PR-edit / issue-close / rebase-cascade side effects live entirely inside ops.

Context

apps/server/src/main.ts:115-117 aliases three handlers as legacy*:

  • legacyHandleIssueClosed (wired to prFlow.propagateIssueClosed hook)
  • legacyHandlePrDependencyMarkers (wired to prFlow.applyDependencyMarkers hook)
  • legacyHandleStackedRebaseCascade (wired to prFlow.propagateRebaseCascade hook)

These are imperative callbacks the YAML executor calls during flow dispatch — workaround until each was fully ported. With CI events + PR-closed cleanup landed (issues #1092 + #1093), we can flatten this indirection.

Acceptance criteria

Cascade hook → already covered

  • Verify propagate_dependencies op (kind: rebase-cascade) and flows/defaults/pr-merged.yml fully replicate legacyHandleStackedRebaseCascade behaviour (parent SHA change → walk dependent PRs → dispatch rebase)
  • Remove prFlow.propagateRebaseCascade callback wiring from main.ts:3781
  • Delete handleStackedRebaseCascade from event-handlers.ts

Issue-close hook

  • Audit what legacyHandleIssueClosed does beyond issue-closed.yml (likely the dependency-propagation side-effect: when an issue closes, find dependent issues whose blockers cleared and re-dispatch). If propagate_dependencies op already covers this, remove the callback wiring; else extend the op (kind: issue-closed) and then remove
  • Remove prFlow.propagateIssueClosed callback wiring from main.ts:3788
  • Delete handleIssueClosed from event-handlers.ts

PR-edited / dependency markers hook

  • New flows/defaults/pr-edited.yml on pull_request: [edited]: calls existing pr_dependency_markers op
  • Remove prFlow.applyDependencyMarkers callback wiring from main.ts:3777
  • Delete handlePrDependencyMarkers from event-handlers.ts

Executor cleanup

  • Drop the prFlow callback surface entirely from the YAML executor if no callbacks remain (separate concern — call it out in PR description if removed)
  • Keep setEventHandlersTriggerBus (setTriggerBus) — still needed for internal trigger publication (used by publish_pr_merged op from issue #1093)

Tests

  • Regression tests for each scenario: rebase cascade fires on parent merge; issue close re-dispatches dependent issues; PR edit re-parses dependency markers
  • Verify no behavioural change versus the legacy callback path

Out of scope

  • File split of event-handlers.ts — separate ticket (Phase 6)
  • Janitor rule changes — out of scope

Dependencies

  • Blocked by #1092 (CI events) and #1093 (PR-closed cleanup) — they share event-handlers.ts edits; merging them first prevents merge conflicts on the same file

References

  • apps/server/src/main.ts:115-117 (imports), main.ts:3770-3791 (executor wiring)
  • apps/server/src/domain/flows-yaml/ops/propagate_dependencies.ts (cascade op — already supports kind: rebase-cascade)
  • apps/server/src/domain/flows-yaml/ops/pr_dependency_markers.ts
  • flows/defaults/pr-merged.yml, flows/defaults/issue-closed.yml
As an operator, I want the three `legacy*` wrapper hooks in `main.ts:3770-3791` removed, so that the YAML executor stops needing imperative callbacks and PR-edit / issue-close / rebase-cascade side effects live entirely inside ops. ## Context `apps/server/src/main.ts:115-117` aliases three handlers as `legacy*`: - `legacyHandleIssueClosed` (wired to `prFlow.propagateIssueClosed` hook) - `legacyHandlePrDependencyMarkers` (wired to `prFlow.applyDependencyMarkers` hook) - `legacyHandleStackedRebaseCascade` (wired to `prFlow.propagateRebaseCascade` hook) These are imperative callbacks the YAML executor calls during flow dispatch — workaround until each was fully ported. With CI events + PR-closed cleanup landed (issues #1092 + #1093), we can flatten this indirection. ## Acceptance criteria ### Cascade hook → already covered - [ ] Verify `propagate_dependencies` op (`kind: rebase-cascade`) and `flows/defaults/pr-merged.yml` fully replicate `legacyHandleStackedRebaseCascade` behaviour (parent SHA change → walk dependent PRs → dispatch rebase) - [ ] Remove `prFlow.propagateRebaseCascade` callback wiring from `main.ts:3781` - [ ] Delete `handleStackedRebaseCascade` from `event-handlers.ts` ### Issue-close hook - [ ] Audit what `legacyHandleIssueClosed` does beyond `issue-closed.yml` (likely the dependency-propagation side-effect: when an issue closes, find dependent issues whose blockers cleared and re-dispatch). If `propagate_dependencies` op already covers this, remove the callback wiring; else extend the op (`kind: issue-closed`) and then remove - [ ] Remove `prFlow.propagateIssueClosed` callback wiring from `main.ts:3788` - [ ] Delete `handleIssueClosed` from `event-handlers.ts` ### PR-edited / dependency markers hook - [ ] New `flows/defaults/pr-edited.yml` on `pull_request: [edited]`: calls existing `pr_dependency_markers` op - [ ] Remove `prFlow.applyDependencyMarkers` callback wiring from `main.ts:3777` - [ ] Delete `handlePrDependencyMarkers` from `event-handlers.ts` ### Executor cleanup - [ ] Drop the `prFlow` callback surface entirely from the YAML executor if no callbacks remain (separate concern — call it out in PR description if removed) - [ ] Keep `setEventHandlersTriggerBus` (`setTriggerBus`) — still needed for internal trigger publication (used by `publish_pr_merged` op from issue #1093) ### Tests - [ ] Regression tests for each scenario: rebase cascade fires on parent merge; issue close re-dispatches dependent issues; PR edit re-parses dependency markers - [ ] Verify no behavioural change versus the legacy callback path ## Out of scope - File split of `event-handlers.ts` — separate ticket (Phase 6) - Janitor rule changes — out of scope ## Dependencies - Blocked by #1092 (CI events) and #1093 (PR-closed cleanup) — they share `event-handlers.ts` edits; merging them first prevents merge conflicts on the same file ## References - `apps/server/src/main.ts:115-117` (imports), `main.ts:3770-3791` (executor wiring) - `apps/server/src/domain/flows-yaml/ops/propagate_dependencies.ts` (cascade op — already supports `kind: rebase-cascade`) - `apps/server/src/domain/flows-yaml/ops/pr_dependency_markers.ts` - `flows/defaults/pr-merged.yml`, `flows/defaults/issue-closed.yml`
Collaborator

🤖 Auto-assigned to code-lead (heuristic: default → code-lead (no specific label match; safer than code)). Reply /unassign to reroute.

🤖 Auto-assigned to **code-lead** (heuristic: default → code-lead (no specific label match; safer than code)). Reply `/unassign` to reroute.
Author
Collaborator

Merging into #1096

Verified during overnight Phase 4 implementation: the three YAML flows that drive this work already exist on main:

  • pr-merged.ymlpropagate_dependencies(kind: rebase-cascade) (covers handleStackedRebaseCascade)
  • issue-closed.ymlpropagate_dependencies(kind: issue-closed) (covers handleIssueClosed propagation half)
  • pr-dependency-markers.yml on pull_request: [opened, edited, synchronize]pr_dependency_markers op (covers handlePrDependencyMarkers)

The remaining work is purely:

  1. Move the three impls out of event-handlers.ts so the prFlow capability in main.ts can call them without the legacy* alias indirection
  2. Delete the three functions from event-handlers.ts

That is the same move Phase 6 (#1096) does as part of splitting event-handlers.ts into topical modules — Phase 6 already plans to relocate handleIssueClosed / handlePrDependencyMarkers / handleStackedRebaseCascade to workflow/pr-flow.ts (new) alongside the other helpers.

Closing this ticket against #1096 to avoid a redundant intermediate PR that just renames legacyHandle* to handle* and then has Phase 6 re-touch the same lines.

Coverage note: the cap impls in main.ts:3770-3801 still route through the legacy aliases for now. No behavioural regression — the flow path is identical end-to-end. Phase 6 lands the actual deletion + module split in one PR.

## Merging into #1096 Verified during overnight Phase 4 implementation: the three YAML flows that drive this work already exist on `main`: - `pr-merged.yml` → `propagate_dependencies(kind: rebase-cascade)` (covers `handleStackedRebaseCascade`) - `issue-closed.yml` → `propagate_dependencies(kind: issue-closed)` (covers `handleIssueClosed` propagation half) - `pr-dependency-markers.yml` on `pull_request: [opened, edited, synchronize]` → `pr_dependency_markers` op (covers `handlePrDependencyMarkers`) The remaining work is purely: 1. Move the three impls out of `event-handlers.ts` so the `prFlow` capability in `main.ts` can call them without the `legacy*` alias indirection 2. Delete the three functions from `event-handlers.ts` That is **the same move** Phase 6 (#1096) does as part of splitting `event-handlers.ts` into topical modules — Phase 6 already plans to relocate `handleIssueClosed` / `handlePrDependencyMarkers` / `handleStackedRebaseCascade` to `workflow/pr-flow.ts` (new) alongside the other helpers. Closing this ticket against #1096 to avoid a redundant intermediate PR that just renames `legacyHandle*` to `handle*` and then has Phase 6 re-touch the same lines. Coverage note: the cap impls in `main.ts:3770-3801` still route through the legacy aliases for now. No behavioural regression — the flow path is identical end-to-end. Phase 6 lands the actual deletion + module split in one PR.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#1095
No description provided.