mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-16 21:53:07 +00:00
refactor: extract shared isBacklogLikeStatus helper and improve comments
Address PR #825 review feedback: - Extract duplicated backlog-like status check into shared helper in constants.ts - Improve spec-parser regex comment to clarify subsection preservation - Add file path reference in row-actions.tsx comment for traceability Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -214,7 +214,8 @@ export function extractSummary(text: string): string | null {
|
||||
}
|
||||
|
||||
// Check for ## Summary section (use last match)
|
||||
// Use \n## [^#] to stop at same-level headers (## Foo) but NOT subsections (### Root Cause)
|
||||
// Stop at \n## [^#] (same-level headers like "## Changes") but preserve ### subsections
|
||||
// (like "### Root Cause", "### Fix Applied") that belong to the summary content.
|
||||
const sectionMatches = text.matchAll(/##\s*Summary\s*\n+([\s\S]*?)(?=\n## [^#]|\n\*\*|$)/gi);
|
||||
const sectionMatch = getLastMatch(sectionMatches);
|
||||
if (sectionMatch) {
|
||||
|
||||
@@ -83,7 +83,7 @@ import type {
|
||||
StashApplyConflictInfo,
|
||||
} from './board-view/worktree-panel/types';
|
||||
import { BoardErrorBoundary } from './board-view/board-error-boundary';
|
||||
import { COLUMNS, getColumnsWithPipeline } from './board-view/constants';
|
||||
import { COLUMNS, getColumnsWithPipeline, isBacklogLikeStatus } from './board-view/constants';
|
||||
import {
|
||||
useBoardFeatures,
|
||||
useBoardDragDrop,
|
||||
@@ -1908,12 +1908,7 @@ export function BoardView({ initialFeatureId }: BoardViewProps) {
|
||||
// Running features should always show logs, even if status is
|
||||
// stale (still 'backlog'/'ready'/'interrupted' during race window)
|
||||
const isRunning = runningAutoTasksAllWorktrees.includes(feature.id);
|
||||
const isBacklogLike =
|
||||
feature.status === 'backlog' ||
|
||||
feature.status === 'merge_conflict' ||
|
||||
feature.status === 'ready' ||
|
||||
feature.status === 'interrupted';
|
||||
if (isBacklogLike && !isRunning) {
|
||||
if (isBacklogLikeStatus(feature.status) && !isRunning) {
|
||||
setEditingFeature(feature);
|
||||
} else {
|
||||
handleViewOutput(feature);
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import type { Feature } from '@/store/app-store';
|
||||
import { isBacklogLikeStatus } from '../../constants';
|
||||
|
||||
/**
|
||||
* Action handler types for row actions
|
||||
@@ -431,44 +432,41 @@ export const RowActions = memo(function RowActions({
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Running task with stale status (backlog/ready/interrupted but tracked as running).
|
||||
{/* Running task with stale status - the feature is tracked as running but its
|
||||
persisted status hasn't caught up yet during WebSocket/cache sync delays.
|
||||
These features are placed in the in_progress column by useBoardColumnFeatures
|
||||
but their actual status hasn't updated yet, so no other menu block matches. */}
|
||||
{!isCurrentAutoTask &&
|
||||
isRunningTask &&
|
||||
(feature.status === 'backlog' ||
|
||||
feature.status === 'ready' ||
|
||||
feature.status === 'interrupted' ||
|
||||
feature.status === 'merge_conflict') && (
|
||||
<>
|
||||
{handlers.onViewOutput && (
|
||||
(hooks/use-board-column-features.ts) but no other menu block matches their
|
||||
stale status, so we provide running-appropriate actions here. */}
|
||||
{!isCurrentAutoTask && isRunningTask && isBacklogLikeStatus(feature.status) && (
|
||||
<>
|
||||
{handlers.onViewOutput && (
|
||||
<MenuItem
|
||||
icon={FileText}
|
||||
label="View Logs"
|
||||
onClick={withClose(handlers.onViewOutput)}
|
||||
/>
|
||||
)}
|
||||
<MenuItem icon={Edit} label="Edit" onClick={withClose(handlers.onEdit)} />
|
||||
{handlers.onSpawnTask && (
|
||||
<MenuItem
|
||||
icon={GitFork}
|
||||
label="Spawn Sub-Task"
|
||||
onClick={withClose(handlers.onSpawnTask)}
|
||||
/>
|
||||
)}
|
||||
{handlers.onForceStop && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<MenuItem
|
||||
icon={FileText}
|
||||
label="View Logs"
|
||||
onClick={withClose(handlers.onViewOutput)}
|
||||
icon={StopCircle}
|
||||
label="Force Stop"
|
||||
onClick={withClose(handlers.onForceStop)}
|
||||
variant="destructive"
|
||||
/>
|
||||
)}
|
||||
<MenuItem icon={Edit} label="Edit" onClick={withClose(handlers.onEdit)} />
|
||||
{handlers.onSpawnTask && (
|
||||
<MenuItem
|
||||
icon={GitFork}
|
||||
label="Spawn Sub-Task"
|
||||
onClick={withClose(handlers.onSpawnTask)}
|
||||
/>
|
||||
)}
|
||||
{handlers.onForceStop && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<MenuItem
|
||||
icon={StopCircle}
|
||||
label="Force Stop"
|
||||
onClick={withClose(handlers.onForceStop)}
|
||||
variant="destructive"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Backlog actions */}
|
||||
{!isCurrentAutoTask &&
|
||||
|
||||
@@ -136,6 +136,26 @@ export function getPipelineInsertIndex(): number {
|
||||
return BASE_COLUMNS.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Statuses that display in the backlog column because they don't have dedicated columns:
|
||||
* - 'backlog': Default state for new features
|
||||
* - 'ready': Feature has an approved plan, waiting for execution
|
||||
* - 'interrupted': Feature execution was aborted (user stopped it, server restart)
|
||||
* - 'merge_conflict': Automatic merge failed, user must resolve conflicts
|
||||
*
|
||||
* Used to determine row click behavior and menu actions when a feature is running
|
||||
* but its status hasn't updated yet (race condition during WebSocket/cache sync).
|
||||
* See use-board-column-features.ts for the column assignment logic.
|
||||
*/
|
||||
export function isBacklogLikeStatus(status: string): boolean {
|
||||
return (
|
||||
status === 'backlog' ||
|
||||
status === 'ready' ||
|
||||
status === 'interrupted' ||
|
||||
status === 'merge_conflict'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a status is a pipeline status
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user