Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**Hand a task to a Workflow** keeps the picked card in the twelve it draws after the card list is folded again: a card picked past the twelfth is drawn first, so the rows never hide the card its confirm button is about to send. The count row and the assignment it sends are unchanged. ([#2257](https://github.com/ThinkFlowLab/FlyBot/issues/2257))
2 changes: 1 addition & 1 deletion docs/subsystems/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Everything in `plugins/workflow/`: the graph rules, the run store, the matcher,
| `plugins/workflow/src/match.js` | Which open card matches a Workflow or a local Bot. |
| `plugins/workflow/src/template.js` | Factory delivery/weekly graphs plus `EARLY_END_GUIDANCE` for Claim/Verify/Triage early-end markers; 发布交付流水线 (a parallel branch) and the weekly report, each node with the inputs and outputs that edge carries. |
| `plugins/workflow/src/narrate.js` | Progress lines for a step. A live run quotes the Bot reply when present; otherwise delivery-template nodes may use canned copy. A join line is only for a rank of more than one node. |
| `plugins/workflow/client.js` | Sidebar section (with mini-flowcharts), workflow stage (view/control: one card per live run with its own title, node line, segment progress, status chip, and Pause / Resume / Stop; click a card or its Flow button to focus that run in the drawer flowchart; optional aggregate chip when several run or the queue is non-empty — no message composer), assign dialog (scrollable with sticky footer; it selects the first card once the board loads, keeps `Assign` disabled until a card is selected, and shows a failed Tasks load as an error with a `Retry` instead of the empty-board hint, #1457, #1458; both of its choice lists draw twelve at a time and a `Show {count} more cards` / `Show {count} more Bots` row says how many they are not showing, expanding to the rest and folding back to `Show less`, so no card or local Bot is out of reach while the default view keeps its length, #2244), flowchart drawer (collapsed by default, per-node inspector, fitted to the 400px panel so the graph needs no inner horizontal scroll), and Settings → Workflow graphs (canvas-first with inspector panel). The product UI starts only live runs (assign, ingest). The stage shows the queue and refreshes state while runs are active; a running node uses a breathing border animation. Visual flowcharts replace text chains across all surfaces. Sidebar rows (including factory ids such as `delivery`) support Delete with confirm. A row with live runs draws the number beside the dot and carries the count, with the word `running`, in a visually hidden `.wf-sr` span — the dot and the digit sit inside an `aria-hidden` wrap, so the number alone would be silent to a reader — and its accessible name therefore stays the name its content gives: the lane's name, the `Workflow` badge, its Project and its preview, plus the count; a row-level `aria-label` replaced all of that and made two lanes that share a name read alike (#2222, #2230). An idle row draws no dot, no count, no digit and no hidden text, so its name stays its own text. The stage and dialogs portal onto `document.body`; a missing container stays in the section tree. A stage control that fails — a graph save, Reset, Pause, Resume or Stop that throws, rejects, answers `{ok:false}` or does not answer within 10 s — ends on the section's `.wf-err` alert instead of being swallowed, and a success clears the alert. The flowchart's node role sub-label takes its colour from `--bt-ink-2` rather than a hardcoded grey, so it stays readable on every theme's node card (#1495). The drawer's styling reuses the core `--bt-*` tokens and the Bot details drawer's patterns (title, pill tabs, soft pill buttons, bubble-surfaced node cards; accent tints mixed from `--bt-accent`, #1654). The stage lists the tasks the open workflow holds (`heldTasks`; when `heldTaskCount` exceeds that page the rest is a `Show {count} more held tasks` control — a `wf-more` button with `data-more="held"` and `aria-expanded` — that reads the wider page with `heldLimit: 200` and folds back to `Show less`, so the ids behind the cap are reachable instead of being named and dropped, #2256), each with one **Re-match** action that drops that task's claim and matches it again through `workflow/ingest` with `rematch: true` — one board read to hand over the card's fields and one state read after, never a second polling loop (#1647). The drawer's Edit plane keeps one copy of the row geometry: a graph whose parallel cards still fit is the fitted plane (scaled centres, `parallelFrameStyle` frame, one-fold `wirePath`), and one that cannot is laid out in `flowLayout`'s own rows — its cards are those boxes, its dashed frame is that band's frame, and its wires are the `flowWires` routing around them, so a 3+ way step at a 364px drawer keeps its frame inside the panel and no wire crosses a card (#1693). A two-Bot parallel step the fitted plane would squeeze — the drawer's fit leaves the pair 4px apart, with each card's out-port (5px) and remove button (8px) past its right edge under the neighbour — is drawn at that row's `flowLayout` column width (154px at a 364px drawer) on its fitted centres and wires, keeping the 12px row gap and a plane whose drags still commit world coordinates; `parallelFrameStyle` adds the 20px label band above the cards and a 10px pad below them, so the fitted frame encloses every card it names (#1738). |
| `plugins/workflow/client.js` | Sidebar section (with mini-flowcharts), workflow stage (view/control: one card per live run with its own title, node line, segment progress, status chip, and Pause / Resume / Stop; click a card or its Flow button to focus that run in the drawer flowchart; optional aggregate chip when several run or the queue is non-empty — no message composer), assign dialog (scrollable with sticky footer; it selects the first card once the board loads, keeps `Assign` disabled until a card is selected, and shows a failed Tasks load as an error with a `Retry` instead of the empty-board hint, #1457, #1458; both of its choice lists draw twelve at a time and a `Show {count} more cards` / `Show {count} more Bots` row says how many they are not showing, expanding to the rest and folding back to `Show less`, so no card or local Bot is out of reach while the default view keeps its length, and a card picked past the twelfth is drawn first once the list is folded again, so the twelve rows never hide the card the button is about to send (#2257), #2244), flowchart drawer (collapsed by default, per-node inspector, fitted to the 400px panel so the graph needs no inner horizontal scroll), and Settings → Workflow graphs (canvas-first with inspector panel). The product UI starts only live runs (assign, ingest). The stage shows the queue and refreshes state while runs are active; a running node uses a breathing border animation. Visual flowcharts replace text chains across all surfaces. Sidebar rows (including factory ids such as `delivery`) support Delete with confirm. A row with live runs draws the number beside the dot and carries the count, with the word `running`, in a visually hidden `.wf-sr` span — the dot and the digit sit inside an `aria-hidden` wrap, so the number alone would be silent to a reader — and its accessible name therefore stays the name its content gives: the lane's name, the `Workflow` badge, its Project and its preview, plus the count; a row-level `aria-label` replaced all of that and made two lanes that share a name read alike (#2222, #2230). An idle row draws no dot, no count, no digit and no hidden text, so its name stays its own text. The stage and dialogs portal onto `document.body`; a missing container stays in the section tree. A stage control that fails — a graph save, Reset, Pause, Resume or Stop that throws, rejects, answers `{ok:false}` or does not answer within 10 s — ends on the section's `.wf-err` alert instead of being swallowed, and a success clears the alert. The flowchart's node role sub-label takes its colour from `--bt-ink-2` rather than a hardcoded grey, so it stays readable on every theme's node card (#1495). The drawer's styling reuses the core `--bt-*` tokens and the Bot details drawer's patterns (title, pill tabs, soft pill buttons, bubble-surfaced node cards; accent tints mixed from `--bt-accent`, #1654). The stage lists the tasks the open workflow holds (`heldTasks`; when `heldTaskCount` exceeds that page the rest is a `Show {count} more held tasks` control — a `wf-more` button with `data-more="held"` and `aria-expanded` — that reads the wider page with `heldLimit: 200` and folds back to `Show less`, so the ids behind the cap are reachable instead of being named and dropped, #2256), each with one **Re-match** action that drops that task's claim and matches it again through `workflow/ingest` with `rematch: true` — one board read to hand over the card's fields and one state read after, never a second polling loop (#1647). The drawer's Edit plane keeps one copy of the row geometry: a graph whose parallel cards still fit is the fitted plane (scaled centres, `parallelFrameStyle` frame, one-fold `wirePath`), and one that cannot is laid out in `flowLayout`'s own rows — its cards are those boxes, its dashed frame is that band's frame, and its wires are the `flowWires` routing around them, so a 3+ way step at a 364px drawer keeps its frame inside the panel and no wire crosses a card (#1693). A two-Bot parallel step the fitted plane would squeeze — the drawer's fit leaves the pair 4px apart, with each card's out-port (5px) and remove button (8px) past its right edge under the neighbour — is drawn at that row's `flowLayout` column width (154px at a 364px drawer) on its fitted centres and wires, keeping the 12px row gap and a plane whose drags still commit world coordinates; `parallelFrameStyle` adds the 20px label band above the cards and a 10px pad below them, so the fitted frame encloses every card it names (#1738). |

## Entry points

Expand Down
8 changes: 7 additions & 1 deletion plugins/workflow/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,13 @@ window.__ModuleLoader__.load({
const targetLane = targetBot ? null : workflows.find(item => item.id === target)
const laneProject = targetLane ? projectName(targetLane.projectId) : ''
const targetName = targetBot ? targetBot.name : targetLane ? (laneProject ? `${targetLane.name} · ${laneProject}` : targetLane.name) : ''
const shownTasks = tasksExpanded ? tasks : tasks.slice(0, ASSIGN_VISIBLE)
// P-465: expanding the list, picking a card past the twelfth and collapsing again used to
// drop the picked card out of the drawn rows — no row carried `sel` while Assign still sent
// it. The collapsed slice keeps the picked card in it, first, and the count row is unchanged.
const pickedIndex = tasks.findIndex(task => task.id === taskId)
const shownTasks = tasksExpanded ? tasks : pickedIndex >= ASSIGN_VISIBLE
? [tasks[pickedIndex], ...tasks.slice(0, ASSIGN_VISIBLE - 1)]
: tasks.slice(0, ASSIGN_VISIBLE)
const shownBots = botsExpanded ? bots : bots.slice(0, ASSIGN_VISIBLE)
return h('div', { className: 'wf-mask', onClick: (event) => { if (event.target === event.currentTarget) onClose() } },
h('div', { className: 'wf-modal', role: 'dialog', 'aria-modal': true, 'aria-label': tr('Hand a task to a Workflow') },
Expand Down
51 changes: 51 additions & 0 deletions plugins/workflow/test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3009,7 +3009,7 @@
// The hint's text is read when the drag is refused, so the host translation is put in place
// after the drawer mounted: a stub standing in for the whole host at mount time is read by the
// page's own reads (avatars, tool links) and hides the workflow list.
globalThis.__flybot__ = { ...(previous ?? {}), t: (key) => (key === 'Tasks' ? '任务' : key) }

Check warning on line 3012 in plugins/workflow/test/client.test.js

View workflow job for this annotation

GitHub Actions / plugins (workflow)

unicorn(no-useless-fallback-in-spread)

Empty fallbacks in spreads are unnecessary
try {
nodeAt('r1').props.onPointerDown({ clientX: 40, clientY: 160, target: { dataset: {} } })
canvas().props.onPointerMove({ clientX: 96, clientY: 208 })
Expand Down Expand Up @@ -4574,3 +4574,54 @@
document.body = prevBody
}
})
// #2257: twenty cards open as twelve with a "Show 8 more cards" row. Expanding, picking the
// twentieth and collapsing again dropped the picked card out of the twelve drawn rows: no row
// carried `sel`, and Assign still submitted that invisible card. The collapsed slice now keeps
// the picked card in it, first, so the list always shows what the button is about to send.
const selCards = cards => cards.filter(card => String(card.props?.className ?? '').split(' ').includes('sel'))
const cardTitle = card => textOf(findAll(card, node => String(node.props?.className ?? '') === 'wf-tt')[0])

test('#2257: collapsing the card list keeps the picked card in view', async () => {
await withBoardHost(assignBoard(20), async () => {
const ui = await openAssignWith({ roster: { bots: [] } })
try {
ui.moreRow('tasks').props.onClick()
await settle()
const twentieth = ui.cards().find(card => textOf(card).includes('Board card 20'))
assert.ok(twentieth, 'precondition: the twentieth card is reachable when expanded')
twentieth.props.onClick()
await settle()
assert.equal(selCards(ui.cards()).length, 1, 'precondition: the twentieth card is the picked one')
ui.moreRow('tasks').props.onClick()
await settle()
const cards = ui.cards()
assert.equal(cards.length, 12, 'the collapsed list still draws twelve cards')
const picked = selCards(cards)
assert.equal(picked.length, 1, 'exactly one drawn card is marked as picked')
assert.ok(textOf(picked[0]).includes('Board card 20'), `the marked card is the picked one, saw ${textOf(picked[0])}`)
assert.equal(cards.indexOf(picked[0]), 0, 'the picked card is drawn first')
assert.equal(textOf(ui.moreRow('tasks')), 'Show 8 more cards', 'the count of cards not shown is unchanged')
assignOf(dialogOf(ui.view)).props.onClick()
await settle()
assert.equal(ui.posted().length, 1, 'one assign is posted')
assert.deepEqual(ui.posted()[0].body, { workflowId: 'delivery', taskId: 'task-20', title: 'Board card 20' }, 'the submit body is unchanged')
} finally { ui.view.unmount() }
})
})

test('#2257: a pick inside the twelve rows leaves the list exactly as today', async () => {
await withBoardHost(assignBoard(20), async () => {
const ui = await openAssignWith({ roster: { bots: [] } })
try {
const open = ui.cards()
assert.deepEqual(open.map(cardTitle), assignBoard(12).map(card => card.title), 'the default view is the first twelve cards in board order')
assert.deepEqual(selCards(open).map(cardTitle), ['Board card 1'], 'the first card is picked by default')
ui.cards().find(card => textOf(card).includes('Board card 5')).props.onClick()
await settle()
const cards = ui.cards()
assert.deepEqual(cards.map(cardTitle), assignBoard(12).map(card => card.title), 'picking inside the twelve leaves the same twelve cards in the same order')
assert.deepEqual(selCards(cards).map(cardTitle), ['Board card 5'], 'only the picked fifth card is marked')
assert.equal(textOf(ui.moreRow('tasks')), 'Show 8 more cards', 'the count of cards not shown is unchanged')
} finally { ui.view.unmount() }
})
})
Loading