feat(web): add interactive feature reparenting and auto-rebase on parent completion#538
Open
feat(web): add interactive feature reparenting and auto-rebase on parent completion#538
Conversation
…rebase Thorough analysis of the existing dependency system (spec 041), canvas architecture, rebase infrastructure, and graph state management. Identifies affected areas across all four clean architecture layers, documents existing infrastructure to build on, and defines success criteria for interactive reparenting and auto-rebase capabilities. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ncy rebase 14 tasks across 4 phases: core use case with validation, git rebaseOnBranch infrastructure, auto-rebase orchestration in CheckAndUnblockFeaturesUseCase, and canvas interaction with drag-to-connect and optimistic UI. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ycle adjustment Introduces ReparentFeatureUseCase with cycle detection, same-repo check, lifecycle guards (block Maintain/Archived/Deleting), lifecycle state adjustment based on new parent, and CheckAndUnblock integration. Includes 19 unit tests covering all validation and adjustment paths. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Registers ReparentFeatureUseCase with class token + string alias 'ReparentFeatureUseCase' in the DI container. Adds server action at app/actions/reparent-feature.ts following the established pattern. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add rebaseOnBranch(cwd, featureBranch, targetBranch) to IGitPrService interface and implement in GitPrService. This method rebases a feature branch onto an arbitrary target branch (origin/<targetBranch>) instead of only the default branch. Key differences from rebaseOnMain: explicit git fetch of the target branch before rebase since it may not be locally available. Same conflict detection pattern (REBASE_CONFLICT error code). Includes unit tests covering success path, conflict detection, fetch failure, dirty worktree, branch not found, and execution order. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…res use case Add IGitPrService, IWorktreeService, ConflictResolutionService, IAgentRunRepository, and IPhaseTimingRepository to the constructor following the same injection pattern as RebaseFeatureOnMainUseCase. Update test fixtures to provide the new mocks. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ures use case Insert rebase orchestration between lifecycle transition (Blocked -> Started) and agent spawn. For each blocked child: create agent run + phase timing, resolve CWD via worktree service, stash uncommitted changes, rebase child branch onto parent branch via rebaseOnBranch, delegate conflicts to ConflictResolutionService, restore stash in finally block, record timing. Failures are isolated per-child and recorded in activity timeline. Agent spawns regardless of rebase outcome. Skip rebase if child has active running agent run (NFR-3). 5-minute timeout per child. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add interactive reparenting via React Flow drag-to-connect on the features canvas. Users can now drag from a parent feature source handle to a child feature target handle to establish a dependency. Dependency edges show a hover delete button for unparenting. - Add reparentFeature optimistic mutation to useGraphState with rollback - Add handleConnect with validation (same-repo, non-terminal, no self) - Add handleEdgesDelete for dependency edge removal (unparenting) - Enable connections and element selection on FeaturesCanvas - Enhance DependencyEdge with hover X button via EdgeLabelRenderer - Always render feature node handles with isConnectable=true - Set showHandles=true for feature nodes in deriveGraph - Add 10 integration tests covering connect and edge delete flows Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Storybook build was failing because use-graph-state.ts imports the reparent-feature server action but no corresponding mock exists. Add the mock following the established pattern.
25bf3fb to
4f84518
Compare
Contributor
Dev Release Published
|
4f84518 to
68a28ff
Compare
Contributor
Dev Release Published
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the feature dependency system (spec 041) with two capabilities:
Spec:
specs/084-feature-dependency-rebase/Changes
Domain & Application Layer
ReparentFeatureUseCase— new use case validating same-repo, cycle detection, and lifecycle guards (rejects Done/Archived). Adjusts child lifecycle to Blocked when reparented under a pre-implementation parent, and unblocks when parent is post-implementation.CheckAndUnblockFeaturesUseCase— extended to orchestrate auto-rebase of unblocked children onto the parent branch before agent spawn. Each child rebase is independent; failures are isolated and recorded in the activity timeline.IGitPrService.rebaseOnBranch(cwd, featureBranch, targetBranch)— new interface method for rebasing onto an arbitrary branch (parent feature branch), implemented in the git PR service.Presentation Layer (Web)
FeaturesCanvas— enablesnodesConnectable={true}, implementsonConnectfor reparenting andonEdgesDeletefor unparenting, with toast feedback for validation errors.useGraphState— newreparentFeature()mutation with optimistic update +beginMutation/endMutationguards.DependencyEdge— selectable, deletable edges with hover delete affordance and keyboard support.reparent-featureserver action — callsReparentFeatureUseCasevia DI string token alias.DI Container
ReparentFeatureUseCaseclass token +'ReparentFeatureUseCase'string alias for web server action access.CheckAndUnblockFeaturesUseCase.Test Plan
ReparentFeatureUseCase(19 tests): success, cycle detection, cross-repo rejection, lifecycle guards, unparent, lifecycle state adjustmentGitPrService.rebaseOnBranch(13 tests)CheckAndUnblockFeaturesUseCaseauto-rebase orchestration (16 tests)feature-parent.repository,sqlite-feature-repository.find-by-branch, andgit-pr.service.rebase-syncEvidence
App screenshots (running dev server, port 3001)
Full canvas view — feature nodes (Merge Diff Viewer, Bug Fix Mode, Prototype Exploration, Telegram & WhatsApp, Policy-Driven Supply Chain) connected via dependency edges to the cli repo group node. Proves canvas reparenting infrastructure works in the actual app with real data (task-11):
Feature node with connection handle — close-up showing the source connection handle (blue + circle on the right edge) visible on hover. Proves FR-1 (drag-to-connect handles enabled) and task-13 (
isConnectable={true}+ handle visibility on hover):Edge interaction layer — canvas view showing dependency edges between repo and feature nodes. Proves FR-4 edge deletion infrastructure rendered with selectable edges in real app context (task-12):
Main control center page —
http://localhost:3001/withFeaturesCanvasintegrated. Proves the canvas with reparenting capabilities loads in the real app routing context (task-11):Test runs
ReparentFeatureUseCase(19),GitPrService.rebaseOnBranch(13),CheckAndUnblockFeaturesUseCaseAuto-Rebase (16), Control Center Integration (24). Full suite: 383 files / 5402 tests passing in 40.85s. Seeevidence/unit-test-results.txt.feature-parent.repository(14),sqlite-feature-repository.find-by-branch(6), andgit-pr.service.rebase-sync(16). Seeevidence/integration-test-results.txt.Related
RebaseFeatureOnMainUseCase, stash,ConflictResolutionServiceBuilt with Shep 🐑 Shep Bot