TT-7316 make sure bold workflow steps crecored correctly#311
Merged
Conversation
f761486 to
78b31a5
Compare
- update sql to fix issues - update AddRecord dates by one millisecond Signed-off-by: Greg Trihus <gtryus@gmail.com>
78b31a5 to
18a87e8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes how Bold workflow steps are recorded by aligning the SQL seed/migration with the renderer's expectation that workflowsteps.tool.settings is a stringified JSON blob, and ensures that the dateCreated values of the workflow steps created in the renderer are strictly increasing so step ordering by creation time is stable. It also wires the StepEditor opened from OrgHead to use the team's actual workflow process instead of hard-coding the default.
Changes:
- SQL: store
settingsas an escaped JSON string (matchingJSON.parse(settings)consumers), cast literals tojsonb, and parameterize the seeded user via:user_email. - Renderer: add
useNewTimehook and thread per-step monotonically-increasingdateCreatedvalues throughAddRecord→AddOrgWFToOps→CreateOrgWorkflowSteps; refactorCreateOrgWorkflowStepsto mutate a caller-suppliedopArrayinstead of returning one. - UI:
OrgHead'sStepEditornow usesuseTeamWorkflowProcess(orgId)so it edits the team's actual process rather thandefaultWorkflow.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| migration/bold-workflow/insert-bold-workflowsteps.sql | Quote settings JSON correctly, cast to jsonb, and resolve lastmodifiedby via :user_email. |
| src/renderer/src/utils/useNewTime.ts | New hook producing strictly-incrementing UTC ISO timestamps for batch record creation. |
| src/renderer/src/model/baseModel.tsx | AddRecord now accepts an optional dateCreated override. |
| src/renderer/src/crud/useOrgWorkflowSteps.tsx | Use useNewTime for each org workflow step; change CreateOrgWorkflowSteps to mutate caller's opArray; make AddOrgWFToOps synchronous. |
| src/renderer/src/crud/useTeamCreate.ts | Adapt to the new CreateOrgWorkflowSteps signature. |
| src/renderer/src/components/App/OrgHead.tsx | Pass the team's actual workflow process to StepEditor instead of defaultWorkflow. |
| .vscode/mcp.json | Add chrome-devtools and playwright MCP server entries. |
| .gitignore | Ignore *.lscache files. |
| }; | ||
|
|
||
| const setCurrent = () => { | ||
| created.current = DateTime.now().toUTC().toMillis(); |
Comment on lines
112
to
129
| @@ -120,10 +123,9 @@ export const useOrgWorkflowSteps = () => { | |||
| Boolean(s?.keys?.remoteId) !== offlineOnly | |||
| ) | |||
| .sort((a, b) => a.attributes.sequencenum - b.attributes.sequencenum); | |||
| const opArray: RecordOperation[] = []; | |||
| setTime(); | |||
| for (let stepIndex = 0; stepIndex < processSteps.length; stepIndex++) | |||
| AddOrgWFToOps(tb, processSteps[stepIndex] as WorkflowStepD, org, opArray); | |||
| return opArray; | |||
| }; | |||
Comment on lines
+8
to
9
| -- Variable: :user_email - email address of the user to associate with created/modified records | ||
|
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.