Repository navigation
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
| Layer / File(s) | Summary |
|---|---|
Cancelled task state and storage guards taskflow/store/db.go, taskflow/store/gorm/store.go, taskflow/store/gorm/store_test.go, taskflow/store/db_test.go, taskflow/README.md, taskflow/docs/architecture.md |
The store adds the CANCELLED state and CancelTask, which advances seq and rejects completed tasks. Store guards reject writes and claims for cancelled tasks. Documentation describes the cancellation state and guarded operations. |
Workflow termination and forced parking workflow/manager.go, workflow/completion.go, workflow/workflow.go, workflow/park_category.go, workflow/*_test.go |
The workflow manager adds workflow termination and forced parking for pending activations. Accepted force-parks resolve the activation with an admin-forced error. Task nodes consume ready completion signals after successful activities. |
Task cancellation orchestration and stale operations taskflow/orchestrator/manager.go, taskflow/orchestrator/draft.go, taskflow/orchestrator/*_test.go, taskflow/docs/architecture.md |
TaskManager.CancelTask terminates the workflow before storing cancellation. Drafts and step completions for cancelled tasks are rejected as stale, and late workflow completions do not invoke the completion hook. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant ActivationParker
participant WorkflowManager
participant PendingActivation
participant TaskNode
ActivationParker->>WorkflowManager: Request force-park with activation ID and reason
WorkflowManager->>PendingActivation: Submit workflow update
PendingActivation->>TaskNode: Resolve completion future with forced-park error
TaskNode->>TaskNode: Park for admin resolution
Suggested reviewers: webcooper
Merge Risk: 
Minimal · previous review 4c630
-
No merge-blocking issue is established; merge after normal validation.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The description is complete and aligned with the template. It explains the purpose, identifies the breaking change, lists implementation changes, documents testing, records checklist items, and provides issue context. The optional Screenshots/Demo section is omitted.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 47.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 23 functions across 16 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 2
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🛠️ Fix failing CI checks: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
411a312 to
9b183ef
Compare
9b183ef to
31725de
Compare
da2cb00 to
4c6300f
Compare
1aad1ad to
35652de
Compare
… from outside its workflow An admin can override a node only after it parks itself on an error. A node that is healthy but has to be overridden, such as a wait for an event that happened offline, has no way in. These add the engine and task operations a host needs to park such a node and close the task behind it. - workflow: ActivationParker.ForceParkActivation fails a waiting step through the workflow's ForceParkActivation Update with an AdminForcedPark error, so its TASK node parks in AWAITING_ADMIN and is resolved like any parked node. - workflow: WorkflowTerminator.TerminateWorkflow stops a workflow outright. - Both are optional interfaces next to AdminInterventionResolver, implemented by the Temporal manager. - taskflow/store: StateCancelled and a guarded TaskStore.CancelTask, which also advances seq so a step write still in flight is dropped. - taskflow/orchestrator: TaskManager.CancelTask marks the task cancelled and terminates its workflow; CompleteTaskStep and SaveDraft reject a cancelled task as stale. BREAKING CHANGE: TaskStore has a new method, CancelTask. Implementations outside this module must add it.
35652de to
760e860
Compare
Note
For reviewers, lines to review (blank lines not counted): code +115 / −18, plus 77 / −20 comment lines · tests +408 / −5 · docs +7 / −3. Diff against #355.
Summary
An admin can override a workflow node only after it parks itself on an error. A node that is healthy and waiting on an external event or human action — such as a warranting step that happened offline, or an open trader task that needs to be taken out of the trader's hands — has no way in.
Built on top of #355 (
feat/wait-outside-activity), this adds the workflow and taskflow primitives a host application needs to force-park a waiting step and close the task behind it:workflow.ActivationParker(ForceParkActivation): sends aForceParkActivationWorkflow Update that settles the waiting step'spendingCompletionsentry with anAdminForcedParkerror (ForcedParkErrorType), causing theTASKnode waiting on it to park immediately inNodeStatusAwaitingAdminwith the newParkCategoryAdminForced(ADMIN_FORCED) so it can be resolved (COMPLETE,RETRY,ABORT) like any parked node. ReturnsErrActivationNotPendingif the step is not waiting.workflow.WorkflowTerminator(TerminateWorkflow): stops a running workflow outright without running any further nodes or completion callbacks, returningErrWorkflowNotFoundif the workflow is not running.taskflow/store.StateCancelledandTaskStore.CancelTask: marks an open taskCANCELLED(refusingCOMPLETEDtasks and making repeated calls onCANCELLEDtasks a no-op) while advancingseqso any in-flight step write is dropped as stale.taskflow/orchestrator.TaskManager.CancelTask: marks the task rowCANCELLEDand terminates its task workflow;CompleteTaskStepandSaveDraftrejectCANCELLEDtasks withErrStaleStep.Type of Change
Changes Made
workflow/completion.go: register theForceParkActivationWorkflow Update alongsideCompleteActivation, sharingvalidatePendingCompletionand settlingpendingCompletions[activationID]with anAdminForcedParkapplication error.workflow/park_category.go: addParkCategoryAdminForced(ADMIN_FORCED), the category a force-parked node parks under.workflow/workflow.go:handleTaskNodealso reads a force-park that arrived while the step's Activity was still running, so the node parks instead of ignoring it.workflow/manager.go: addForcedParkErrorType,ActivationParker(ForceParkActivation), andWorkflowTerminator(TerminateWorkflow), implemented ontemporalManagerImpl.workflow/completion_test.go,workflow/manager_test.go,workflow/force_park_integration_test.go: in-memory workflow tests, unit tests, and Temporal integration tests forForceParkActivationandTerminateWorkflow.taskflow/store/db.go,taskflow/store/gorm/store.go: addStateCancelledandCancelTask(ctx, taskID)onTaskStore,InMemoryTaskStore, andGormTaskStore; guardWriteDraftagainstStateCancelled.taskflow/orchestrator/manager.go,taskflow/orchestrator/draft.go: addErrTaskNotOpenandTaskManager.CancelTask(ctx, taskID, reason); rejectStateCancelledinCompleteTaskStepandSaveDraft.taskflow/orchestrator/cancel_task_test.go,taskflow/orchestrator/manager_test.go,taskflow/orchestrator/draft_test.go,taskflow/store/db_test.go,taskflow/store/gorm/store_test.go: unit tests covering task cancellation, idempotency, draft/step rejection after cancellation, andseqfencing.taskflow/README.md,taskflow/docs/architecture.md: documentCANCELLEDtask state and transition.Testing
Test details:
go test -race ./workflow/... ./taskflow/...Checklist
Related Issues
Depends on #355.
Related to LSFLK/lsf-govtech-tnsw#243
Additional Notes
Breaking change:
store.TaskStoreaddsCancelTask(ctx context.Context, taskID string) (int64, error). ExternalTaskStoreimplementations must implement this method.Summary by CodeRabbit