fix(workflows): get random workflow color when none provided on create#4782
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview In Reviewed by Cursor Bugbot for commit 0c9364b. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR fixes a bug where workflows created server-side (e.g. by Mothership/Copilot) always displayed as blue because no color was passed to
Confidence Score: 5/5Safe to merge — the change is a minimal, well-scoped default-value addition with no side effects on existing callers that already supply a color. The diff touches a single function in one file, resolves the null-color storage issue at the right abstraction level, and uses an already-tested utility (randomItem over a non-empty as const array). Existing UI-created workflows are unaffected because they still pass params.color. No error-handling paths, schema migrations, or concurrency concerns are introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[performCreateWorkflow called] --> B{params.color provided?}
B -- Yes --> C[Use params.color]
B -- No --> D[Call getNextWorkflowColor]
D --> E[Pick random item from WORKFLOW_COLORS]
E --> C
C --> F[Insert workflow to DB with color]
C --> G[recordAudit with color]
C --> H[Return workflow object with color]
Reviews (1): Last reviewed commit: "fix(workflows): default workflow color w..." | Re-trigger Greptile |
Summary
performCreateWorkflow(params.color ?? getNextWorkflowColor()) so any caller omitting a color gets a random palette colorType of Change
Testing
Tested manually.
bun run lintandbun run check:api-validation:strictboth pass.Checklist