Skip to content

refactor(workflow): S11 branch group workflow subgraphs#1584

Open
gsxdsm wants to merge 5 commits into
feature/workflow-owned-merge-s10-self-healing-recovery-eventsfrom
feature/workflow-owned-merge-s11-branch-group-subgraphs
Open

refactor(workflow): S11 branch group workflow subgraphs#1584
gsxdsm wants to merge 5 commits into
feature/workflow-owned-merge-s10-self-healing-recovery-eventsfrom
feature/workflow-owned-merge-s11-branch-group-subgraphs

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Stack Slice

  • Slice: S11
  • Milestone: Branch Groups
  • Base branch: feature/workflow-owned-merge-s10-self-healing-recovery-events
  • Full plan: docs/plans/2026-06-09-003-refactor-workflow-owned-merge-full-migration-slices-plan.md

Goal

Move branch-group member integration and group promotion into workflow-owned merge subgraphs.

Dependency

S6 merge capabilities, S8 merge processing, and S10 recovery events.

Expected Scope

group merge coordinator, merge trait, integration worktree, built-in IR, shared branch-group workflow tests.

Expected Tests

Member integration with autoMerge exception, blocked group promotion, conflict routing, final promotion guards.

Exit Gate

Branch-group coordinator no longer owns task lifecycle independent of workflow runtime.

Status

Draft stack placeholder. This PR reserves ordering and review context; implementation should replace or extend the handoff artifact before this slice is marked ready.

Implementation Added

  • Added branch-group workflow routing helpers for member integration and group promotion.\n- Covered the shared-member integration exception and global/group promotion gates in tests.

Summary by CodeRabbit

  • New Features

    • Added branch group merge workflow decision capabilities with configurable auto-merge controls at global and group levels.
  • Documentation

    • Added planning documentation for branch group workflow subgraph functionality.
  • Tests

    • Added comprehensive test coverage for branch group merge workflow decision behaviors.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 94738c76-3230-42ad-b364-686b9bbd0d0e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/workflow-owned-merge-s11-branch-group-subgraphs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch from 30ef86b to f1badbe Compare June 9, 2026 20:30
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from c807552 to d117765 Compare June 9, 2026 20:31
@gsxdsm gsxdsm marked this pull request as ready for review June 9, 2026 20:35
@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR delivers the S11 slice of the workflow-owned merge migration, adding decideBranchGroupMemberIntegration and decideBranchGroupPromotion as pure decision functions for branch-group subgraph routing. All three previously-flagged logic issues have been resolved: the FN-5819 shared-member exception is correctly scoped to bypass only the global settings.autoMerge gate, non-shared members now return manual-required when global auto-merge is disabled, and task.autoMerge no longer gates group promotion.

  • decideBranchGroupMemberIntegration: shared members always proceed (FN-5819 exception); non-shared members are gated by settings.autoMerge only, matching FN-5147.
  • decideBranchGroupPromotion: gated exclusively by settings.autoMerge and groupAutoMerge; the third test case with task.autoMerge: false confirms task-level auto-merge is intentionally excluded from the promotion gate.
  • Exports: both functions and their types are added to the engine's public surface in index.ts.

Confidence Score: 5/5

Safe to merge — pure decision functions with no side effects, spec-aligned logic, and all three prior concerns addressed.

The two new functions are pure and isolated; they touch no shared state, no persistence layer, and no lifecycle mutations. The core invariants from FN-5147 and FN-5819 are correctly implemented and directly tested. The only findings here are a duplicate return path (style) and a missing happy-path test case.

No files require special attention; the implementation is self-contained in workflow-branch-group-merge.ts.

Important Files Changed

Filename Overview
packages/engine/src/workflow-branch-group-merge.ts New decision module for branch-group member integration and group promotion; all three previously-flagged logic issues (task.autoMerge gates, dead non-shared branch) have been addressed and the spec is faithfully implemented.
packages/engine/src/tests/workflow-branch-group-merge.test.ts Covers the three spec-critical paths (shared-member FN-5819 exception, non-shared gate, task.autoMerge excluded from promotion gate); missing the non-shared happy path and groupAutoMerge-undefined cases.
packages/engine/src/index.ts Exports the two new decision functions and their TypeScript types; no issues found.
docs/plans/workflow-owned-merge-stack/s11-branch-group-subgraphs.md Planning doc for the S11 slice; documentation only, no code changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[decideBranchGroupMemberIntegration] --> B{assignmentMode\n=== 'shared'?}
    B -- Yes --> C[allowed: true\noutcome: success\nFN-5819 exception]
    B -- No --> D{settings.autoMerge\n=== false?}
    D -- Yes --> E[allowed: false\noutcome: manual-required\nreason: global-auto-merge-disabled]
    D -- No --> F[allowed: true\noutcome: success]

    G[decideBranchGroupPromotion] --> H{settings.autoMerge\n=== false?}
    H -- Yes --> I[allowed: false\noutcome: manual-required\nreason: global-auto-merge-disabled]
    H -- No --> J{groupAutoMerge\n=== false?}
    J -- Yes --> K[allowed: false\noutcome: manual-required\nreason: group-auto-merge-disabled]
    J -- No / undefined --> L[allowed: true\noutcome: success]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[decideBranchGroupMemberIntegration] --> B{assignmentMode\n=== 'shared'?}
    B -- Yes --> C[allowed: true\noutcome: success\nFN-5819 exception]
    B -- No --> D{settings.autoMerge\n=== false?}
    D -- Yes --> E[allowed: false\noutcome: manual-required\nreason: global-auto-merge-disabled]
    D -- No --> F[allowed: true\noutcome: success]

    G[decideBranchGroupPromotion] --> H{settings.autoMerge\n=== false?}
    H -- Yes --> I[allowed: false\noutcome: manual-required\nreason: global-auto-merge-disabled]
    H -- No --> J{groupAutoMerge\n=== false?}
    J -- Yes --> K[allowed: false\noutcome: manual-required\nreason: group-auto-merge-disabled]
    J -- No / undefined --> L[allowed: true\noutcome: success]
Loading

Reviews (10): Last reviewed commit: "fix(FN-000): address PR review feedback ..." | Re-trigger Greptile

@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch from f1badbe to cbdbe87 Compare June 9, 2026 20:38
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from d117765 to 57dca58 Compare June 9, 2026 20:38
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch from cbdbe87 to 6451e39 Compare June 9, 2026 20:48
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from 57dca58 to 9f59559 Compare June 9, 2026 20:48
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch from 6451e39 to 2e67ef0 Compare June 9, 2026 23:31
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from 9f59559 to 8df8f05 Compare June 9, 2026 23:32
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch from 2e67ef0 to eacaa0f Compare June 10, 2026 00:23
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from 8df8f05 to 3fcc5af Compare June 10, 2026 00:23
Comment thread packages/engine/src/workflow-branch-group-merge.ts Outdated
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch from eacaa0f to 11687a5 Compare June 10, 2026 03:48
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from 3fcc5af to 2734b50 Compare June 10, 2026 03:48
Comment thread packages/engine/src/workflow-branch-group-merge.ts Outdated
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch from 11687a5 to 082995d Compare June 11, 2026 15:25
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from 2734b50 to 18b620e Compare June 11, 2026 15:25
Comment thread packages/engine/src/workflow-branch-group-merge.ts
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from 18b620e to e42a519 Compare June 11, 2026 15:35
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch from 082995d to d0d7fb7 Compare June 11, 2026 15:35
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from e42a519 to d0ae3da Compare June 11, 2026 15:39
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch 2 times, most recently from 46ef418 to 3d1e5a9 Compare June 11, 2026 15:44
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from d0ae3da to 2a66eff Compare June 11, 2026 15:44
gsxdsm added 3 commits June 11, 2026 08:48
Address PR #1584 feedback by keeping shared-member integration and group promotion gated by the scoped FN-5819 group/global policy, not individual task autoMerge flags.
Address PR #1584 feedback by keeping the FN-5819 auto-merge-off exception scoped to shared branch members only.
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s10-self-healing-recovery-events branch from 3d1e5a9 to b16d22e Compare June 11, 2026 15:49
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s11-branch-group-subgraphs branch from 2a66eff to dd36403 Compare June 11, 2026 15:49
@gsxdsm

gsxdsm commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

Non-shared branch group members [can] bypass the global auto-merge gate.

Addressed: shared member integration keeps the scoped auto-merge exception, while non-shared member integration now respects settings.autoMerge: false. Promotion gating remains covered separately.

@stage-review

stage-review Bot commented Jun 16, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 4 individual chapters for you:

Title
1 Document branch group workflow subgraph plan
2 Implement branch group merge decision logic
3 Export workflow decision helpers and types
4 Verify branch group merge workflow behaviors
Open in Stage

Chapters generated by Stage for commit e9d47a3 on Jun 17, 2026 2:48pm UTC.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/plans/workflow-owned-merge-stack/s11-branch-group-subgraphs.md`:
- Around line 16-18: Update the description in lines 16-18 to accurately reflect
the current state of the PR. Replace the text that characterizes this as
"intentionally a handoff artifact, not the completed implementation" with
wording that reflects the actual content - that this slice includes shipped
decision logic and tests along with the S11 review slot reservation. This
ensures the documentation accurately describes what is actually delivered in
this PR stack.

In `@packages/engine/src/__tests__/workflow-branch-group-merge.test.ts`:
- Line 10: Remove the `as any` type assertions from the branchContext object
across all test fixtures and replace any invalid assignmentMode values with the
correct contract. The TaskBranchAssignmentMode type only accepts "shared" or
"per-task-derived", so at file
packages/engine/src/__tests__/workflow-branch-group-merge.test.ts, line 10 can
keep "shared" but remove `as any`, line 21 must replace the invalid "exclusive"
value with either "shared" or "per-task-derived" and remove `as any`, and lines
33 and 49 should similarly use only valid assignmentMode values and remove `as
any`. This ensures the test fixtures are properly typed and the regression
surface is not weakened by type escaping.

In `@packages/engine/src/workflow-branch-group-merge.ts`:
- Around line 18-53: Add FNXC policy documentation comments to both workflow
gate functions to comply with coding guidelines. For both
decideBranchGroupMemberIntegration and decideBranchGroupPromotion functions, add
a concise FNXC:Branch-Groups JSDoc or inline comment that documents the
requirement date and rationale for the merge policy decisions being encoded in
each function. Follow the format "FNXC:Area-of-product" with the specific area
being "Branch-Groups" and ensure the comment explains the user-facing
branch-group merge policy requirement that each decision function implements.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e7bb47b-df7d-4468-a326-c441355178aa

📥 Commits

Reviewing files that changed from the base of the PR and between b16d22e and dd36403.

📒 Files selected for processing (4)
  • docs/plans/workflow-owned-merge-stack/s11-branch-group-subgraphs.md
  • packages/engine/src/__tests__/workflow-branch-group-merge.test.ts
  • packages/engine/src/index.ts
  • packages/engine/src/workflow-branch-group-merge.ts

Comment thread docs/plans/workflow-owned-merge-stack/s11-branch-group-subgraphs.md Outdated
Comment thread packages/engine/src/__tests__/workflow-branch-group-merge.test.ts Outdated
Comment thread packages/engine/src/workflow-branch-group-merge.ts
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 3 file(s) based on 3 unresolved review comments.

Files modified:

  • docs/plans/workflow-owned-merge-stack/s11-branch-group-subgraphs.md
  • packages/engine/src/__tests__/workflow-branch-group-merge.test.ts
  • packages/engine/src/workflow-branch-group-merge.ts

Commit: 04c9b238c678b7086fe31ffafc791f882ba233e7

The changes have been pushed to the feature/workflow-owned-merge-s11-branch-group-subgraphs branch.

Time taken: 5m 49s

coderabbitai Bot and others added 2 commits June 17, 2026 14:00
Fixed 3 file(s) based on 3 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
- Refresh s11 plan doc Stack Role wording to reflect shipped branch-group decision logic
- Normalize FNXC:Branch-Groups policy comments to canonical yyyy-MM-dd-hh:mm JSDoc format

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant