-
Notifications
You must be signed in to change notification settings - Fork 57
Build out task list view #717
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
18 commits
Select commit
Hold shift + click to select a range
09b4e3e
WIP
saddlepaddle 43beb67
WIP'
saddlepaddle 7626447
WIP'
saddlepaddle 5e65dba
WIP'
saddlepaddle ca4655b
WIP
saddlepaddle b4392d2
HOLY FUCK THIS SUCKS
saddlepaddle c65f417
better
saddlepaddle d01e460
WIP
saddlepaddle a145da3
WIP
saddlepaddle 40a73f6
WIP
saddlepaddle 6c5e442
WIP
saddlepaddle dcaa7b7
WIP
saddlepaddle 3574dd6
WIP
saddlepaddle 1d48e20
WIP
saddlepaddle 4dde9c6
WIP
saddlepaddle 6d8e747
WIP
saddlepaddle ccfc522
WIP
saddlepaddle 2fb1f80
done
saddlepaddle 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
Some comments aren't visible on the classic Files Changed page.
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
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
67 changes: 67 additions & 0 deletions
67
apps/api/src/app/api/integrations/linear/jobs/initial-sync/syncWorkflowStates.ts
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,67 @@ | ||
| import type { LinearClient } from "@linear/sdk"; | ||
| import { buildConflictUpdateColumns } from "@superset/db"; | ||
| import { db } from "@superset/db/client"; | ||
| import { taskStatuses } from "@superset/db/schema"; | ||
| import { calculateProgressForStates } from "./utils"; | ||
|
|
||
| export async function syncWorkflowStates({ | ||
| client, | ||
| organizationId, | ||
| }: { | ||
| client: LinearClient; | ||
| organizationId: string; | ||
| }): Promise<void> { | ||
| const teams = await client.teams(); | ||
|
|
||
| for (const team of teams.nodes) { | ||
| const states = await team.states(); | ||
|
|
||
| const statesByType = new Map<string, typeof states.nodes>(); | ||
| for (const state of states.nodes) { | ||
| if (!statesByType.has(state.type)) { | ||
| statesByType.set(state.type, []); | ||
| } | ||
| statesByType.get(state.type)?.push(state); | ||
| } | ||
|
|
||
| const startedStates = statesByType.get("started") || []; | ||
| const progressMap = calculateProgressForStates( | ||
| startedStates.map((s) => ({ name: s.name, position: s.position })), | ||
| ); | ||
|
|
||
| const values = states.nodes.map((state) => ({ | ||
| organizationId, | ||
| name: state.name, | ||
| color: state.color, | ||
| type: state.type, | ||
| position: state.position, | ||
| progressPercent: | ||
| state.type === "started" ? (progressMap.get(state.name) ?? null) : null, | ||
| externalProvider: "linear" as const, | ||
| externalId: state.id, | ||
| })); | ||
|
|
||
| if (values.length > 0) { | ||
| await db | ||
| .insert(taskStatuses) | ||
| .values(values) | ||
| .onConflictDoUpdate({ | ||
| target: [ | ||
| taskStatuses.organizationId, | ||
| taskStatuses.externalProvider, | ||
| taskStatuses.externalId, | ||
| ], | ||
| set: { | ||
| ...buildConflictUpdateColumns(taskStatuses, [ | ||
| "name", | ||
| "color", | ||
| "type", | ||
| "position", | ||
| "progressPercent", | ||
| ]), | ||
| updatedAt: new Date(), | ||
| }, | ||
| }); | ||
| } | ||
| } | ||
| } |
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.
🧩 Analysis chain
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 4174
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 4848
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 2251
Replace Error with null-return pattern for graceful handling of missing workflow states.
When an issue references a workflow state that wasn't synced (due to deletion, archival, or race conditions), throwing an Error aborts the entire sync batch.
syncWorkflowStatesis already called beforefetchAllIssues, but this doesn't guarantee all states referenced by existing issues will be present in the database.Return
nullfrommapIssueToTaskand filter nulls at the call site to allow partial sync success, or log the missing state and skip that issue:🤖 Prompt for AI Agents