-
Notifications
You must be signed in to change notification settings - Fork 0
feat(workflow): 대시보드 체인 시각화 (배지 + 타임라인) #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
docs/superpowers/specs/2026-08-05-workflow-chain-view-design.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Maestro Workflow 체인 시각화 설계 (대시보드) | ||
|
|
||
| - 날짜: 2026-08-05 | ||
| - 상태: 확정 (이메일 유스케이스 잔여 — 운영자가 이전 단계를 보고 결정) | ||
| - 범위: `workflow/src/` 하위만 (서버 무변경 — 기존 chain API 사용) | ||
|
|
||
| ## 1. 동작 | ||
|
|
||
| - **ChannelBoard 카드**: `parentRequestId`가 있는 요청에 "🔗 체인" 배지 표시. | ||
| - **DecisionSheet**: 선택한 요청이 체인에 속하면(App이 `chain` prop 전달) | ||
| 상단에 컴팩트 타임라인 표시 — 체인의 각 요청을 순서대로 | ||
| `subjectType · title · 상태(결정됨/대기)`로, 현재 요청은 강조. | ||
| 체인 로드 실패 시 조용히 생략(기존 "체인 이전 요청: id" 라인 유지). | ||
| - **App**: 요청 선택 시 `parentRequestId`가 있으면 `fetchRequestChain`으로 | ||
| 체인을 불러 sheet에 전달. 없으면 즉시 열림(로딩 블로킹 없음 — 체인은 | ||
| 도착하는 대로 표시). | ||
|
|
||
| ## 2. api.js | ||
|
|
||
| `fetchRequestChain(requestId)` → `GET /api/decision-requests/:id/chain` | ||
| (기존 토큰 상태 재사용 — 운영자/서버 토큰). | ||
|
|
||
| ## 3. 테스트 | ||
|
|
||
| - ChannelBoard: parentRequestId 카드에 배지, 없는 카드엔 없음. | ||
| - DecisionSheet: chain prop 타임라인 렌더(순서·현재 강조·상태 라벨). | ||
| - App: 체인 요청 선택 시 fetchRequestChain 호출 + sheet에 표시 (mock). | ||
|
|
||
| ## 4. 비범위 | ||
|
|
||
| 레인 자체를 체인으로 묶는 보드 재배치, 서버 변경, 체인 내 결정 코멘트 | ||
| 전문 표시(타이틀·상태만). |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import { beforeEach, describe, expect, it, vi } from 'vitest'; | ||
| import { render, screen } from '@testing-library/react'; | ||
| import userEvent from '@testing-library/user-event'; | ||
|
|
||
| const fetchPendingRequests = vi.fn(); | ||
| const fetchRequestChain = vi.fn(); | ||
| vi.mock('./lib/api.js', () => ({ | ||
| WS_URL: 'ws://test', | ||
| fetchPendingRequests: (...args) => fetchPendingRequests(...args), | ||
| fetchHistory: vi.fn().mockResolvedValue([]), | ||
| decideRequest: vi.fn(), | ||
| fetchRequestChain: (...args) => fetchRequestChain(...args), | ||
| loadServerToken: vi.fn().mockReturnValue(''), | ||
| getServerToken: vi.fn().mockReturnValue(''), | ||
| setServerToken: vi.fn(), | ||
| })); | ||
|
|
||
| import App from './App.jsx'; | ||
|
|
||
| class FakeWebSocket { | ||
| send() {} | ||
| close() {} | ||
| } | ||
|
|
||
| describe('App 체인 시각화', () => { | ||
| beforeEach(() => { | ||
| vi.stubGlobal('WebSocket', FakeWebSocket); | ||
| fetchPendingRequests.mockReset(); | ||
| fetchRequestChain.mockReset(); | ||
| }); | ||
|
|
||
| it('체인 요청 선택 시 체인을 불러 시트에 타임라인으로 보여준다', async () => { | ||
| const reply = { | ||
| requestId: 'dcr_2', | ||
| parentRequestId: 'dcr_1', | ||
| subjectType: 'email-reply', | ||
| actorId: 'agent_mail', | ||
| subject: { title: '답장 초안 v1', summary: '', payload: {} }, | ||
| }; | ||
| fetchPendingRequests.mockResolvedValue([reply]); | ||
| fetchRequestChain.mockResolvedValue([ | ||
| { requestId: 'dcr_1', subjectType: 'email-triage', status: 'decided', subject: { title: '메일 분류' } }, | ||
| { ...reply, status: 'pending_decision' }, | ||
| ]); | ||
|
|
||
| const user = userEvent.setup(); | ||
| render(<App />); | ||
| await user.click(await screen.findByText('답장 초안 v1')); | ||
|
|
||
| expect(fetchRequestChain).toHaveBeenCalledWith('dcr_2'); | ||
| const timeline = await screen.findByLabelText('결정 체인'); | ||
| expect(timeline.textContent).toContain('메일 분류'); | ||
| }); | ||
|
|
||
| it('체인 없는 요청은 체인 조회를 하지 않는다', async () => { | ||
| fetchPendingRequests.mockResolvedValue([{ | ||
| requestId: 'dcr_solo', | ||
| subjectType: 'spend', | ||
| actorId: 'agent_a', | ||
| subject: { title: '단독 요청', summary: '', payload: {} }, | ||
| }]); | ||
|
|
||
| const user = userEvent.setup(); | ||
| render(<App />); | ||
| await user.click(await screen.findByText('단독 요청')); | ||
|
|
||
| expect(fetchRequestChain).not.toHaveBeenCalled(); | ||
| expect(screen.queryByLabelText('결정 체인')).not.toBeInTheDocument(); | ||
| }); | ||
| }); |
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an operator selects a chained request and then quickly selects another request before the first
/chaincall resolves, this promise still writes into the sharedselectedChainstate. SinceDecisionSheetrenders any non-null chain, the newly selected sheet can briefly or permanently show the previous request's timeline, including for a solo request if its own selection does not start a new fetch. Guard the response against the currently selectedrequestIdor cancel/ignore it after selection changes.Useful? React with 👍 / 👎.