-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat(table): chunked dispatcher + workflow cascade + UX polish #4672
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
21 commits
Select commit
Hold shift + click to select a range
2cfd1f2
feat(table): chunked dispatcher for workflow-column runs
TheodoreSpeaks 6b30f14
fix(table): eager bulk clear on column run so cells flip immediately
TheodoreSpeaks b315324
fix(table): bulk clear honors in-flight execs under mode: 'incomplete'
TheodoreSpeaks e76469a
refactor(table): dispatcher uses batchTriggerAndWait + tag-based cancel
TheodoreSpeaks af07b16
fix(table): show Stop button on optimistic-pending row cells
TheodoreSpeaks 8fa3568
refactor(table): loop-in-cell cascade + dispatcher-everywhere routing
TheodoreSpeaks bd99d6c
fix(table): SQL cancellation guard allows worker to claim a null-exec…
TheodoreSpeaks 125ae7e
fix(table): dispatcher cursor starts at -1 so position 0 is included
TheodoreSpeaks 99e623a
refactor(table): align optimistic UI with new dispatcher; sticky canc…
TheodoreSpeaks 563fc37
refactor(table): unify trigger.dev and inline dispatcher paths
TheodoreSpeaks 757033a
feat(table): backend running counter, dep-aware retrigger, sidebar po…
TheodoreSpeaks e57380d
fix(table): paused workflow cells route through executeResumeJob; ren…
TheodoreSpeaks 7279172
feat(table): typewriter reveal for SSE-driven workflow cell values
TheodoreSpeaks b2b1a83
fix(table): address bugbot/greptile review feedback
TheodoreSpeaks 01bb233
refactor(table): row executions sidecar + left-to-right dep retrigger…
TheodoreSpeaks bfb847b
fix(table): address remaining cursor/greptile review feedback
TheodoreSpeaks 0b14dbb
fix(table): cancel prior runs, scope batch insert dispatch, recover o…
TheodoreSpeaks ec0b73e
fix(table): row-scoped Refresh cancels in-flight; counter includes qu…
TheodoreSpeaks 5c657e7
fix(table): per-row Stop tombstones ahead-of-cursor rows during Run-all
TheodoreSpeaks 655269e
fix(table): seed dispatch overlay on Run; surface batch-enqueue failu…
TheodoreSpeaks 9f30cb7
fix(table): seed dispatch overlay on Run; surface batch-enqueue failu…
TheodoreSpeaks 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import { createLogger } from '@sim/logger' | ||
| import { type NextRequest, NextResponse } from 'next/server' | ||
| import { type ActiveDispatch, listActiveDispatchesContract } from '@/lib/api/contracts/tables' | ||
| import { parseRequest } from '@/lib/api/server' | ||
| import { checkSessionOrInternalAuth } from '@/lib/auth/hybrid' | ||
| import { generateRequestId } from '@/lib/core/utils/request' | ||
| import { withRouteHandler } from '@/lib/core/utils/with-route-handler' | ||
| import { countRunningCells, listActiveDispatches } from '@/lib/table/dispatcher' | ||
| import { accessError, checkAccess } from '@/app/api/table/utils' | ||
|
|
||
| const logger = createLogger('TableDispatchesAPI') | ||
|
|
||
| interface RouteParams { | ||
| params: Promise<{ tableId: string }> | ||
| } | ||
|
|
||
| /** | ||
| * GET /api/table/[tableId]/dispatches | ||
| * | ||
| * Returns active (`pending` / `dispatching`) dispatches for the table. Drives | ||
| * the client's "about to run" overlay so refresh during a long Run-all keeps | ||
| * the queued indicators on rows the dispatcher hasn't reached yet. | ||
| */ | ||
| export const GET = withRouteHandler(async (request: NextRequest, { params }: RouteParams) => { | ||
| const requestId = generateRequestId() | ||
|
|
||
| try { | ||
| const authResult = await checkSessionOrInternalAuth(request, { requireWorkflowId: false }) | ||
| if (!authResult.success || !authResult.userId) { | ||
| return NextResponse.json({ error: 'Authentication required' }, { status: 401 }) | ||
| } | ||
|
|
||
| const parsed = await parseRequest(listActiveDispatchesContract, request, { params }) | ||
| if (!parsed.success) return parsed.response | ||
| const { tableId } = parsed.data.params | ||
|
|
||
| const result = await checkAccess(tableId, authResult.userId, 'read') | ||
| if (!result.ok) return accessError(result, requestId, tableId) | ||
|
|
||
| const [rows, running] = await Promise.all([ | ||
| listActiveDispatches(tableId), | ||
| countRunningCells(tableId), | ||
| ]) | ||
| const dispatches: ActiveDispatch[] = rows.map((r) => ({ | ||
| id: r.id, | ||
| status: r.status as 'pending' | 'dispatching', | ||
| mode: r.mode, | ||
| isManualRun: r.isManualRun, | ||
| cursor: r.cursor, | ||
| scope: r.scope, | ||
| })) | ||
|
|
||
| return NextResponse.json({ | ||
| success: true, | ||
| data: { | ||
| dispatches, | ||
| runningCellCount: running.total, | ||
| runningByRowId: running.byRowId, | ||
| }, | ||
| }) | ||
| } catch (error) { | ||
| logger.error(`[${requestId}] list-dispatches failed:`, error) | ||
| return NextResponse.json({ error: 'Failed to list active dispatches' }, { status: 500 }) | ||
| } | ||
| }) |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.