Skip to content

feat(taskflow)!: hold task row when a step in its workflow parks - #357

Merged
lokewate merged 2 commits into
mainfrom
feat/hold-parked-task-steps
Oct 28, 2026
Merged

lokewate merged 2 commits into
mainfrom
feat/hold-parked-task-steps

Conversation

@lokewate

@lokewate lokewate commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Note

For reviewers, lines to review (blank lines not counted): code +29 / −2, plus 28 / −3 comment lines · tests +121 / −2 · docs +4 / −2. Diff against #287.

Summary

Add store.StateOnHold ("ON_HOLD") and a seq-guarded HoldTask write so a task row moves to ON_HOLD whenever a node in its workflow parks for admin intervention, stripping interactive actions and refusing drafts until an admin resolves the park.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Other (please describe):

Changes Made

  • workflow: Add Seq int64 to AdminParkPayload and populate it from nodeInfo.Seq in notifyAdminPark so hosts can order park notifications against later step claims.
  • taskflow/store and taskflow/store/gorm: Add StateOnHold = "ON_HOLD" and TaskStore.HoldTask(ctx, taskID, seq), guarded by (seq <= ? OR (state = 'ADVANCING' AND seq = ? + 1)) AND state NOT IN ('COMPLETED', 'CANCELLED'), and include StateOnHold in WriteDraft's excluded states.
  • taskflow/orchestrator: Add TaskManager.HoldTask(ctx, payload) to wire to a task workflow runner's AdminParkHandler, and refuse StateOnHold in SaveDraft.
  • A step that parks after its submission (for example, a required output is missing) is held too: PersistSubmission has already moved the row to ADVANCING at seq + 1, so HoldTask also accepts that row and keeps seq + 1, so a repeated submission of the step stays stale. Tested in TestHoldTask_StepParkedAfterItsSubmission and TestHoldTask_HoldsAStepThatParkedAfterItsSubmission.
  • taskflow/docs/architecture.md: Document HoldTask and ON_HOLD lifecycle semantics.

Testing

  • I have tested this change locally
  • I have added tests that prove my fix is effective or that my feature works
  • I have tested edge cases
  • All existing tests pass

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have checked that there are no merge conflicts

Related Issues

Related to https://github.com/LSFLK/lsf-govtech-tnsw/issues/243
Stacked on #287

Screenshots/Demo

N/A

Additional Notes

Stacked on #287 (feat/task-cancel-and-fail-activation). TaskStore gains HoldTask(ctx, taskID, seq).

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f817289f-e039-4dcd-9fcd-7c5f608ac995
  • 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lokewate
lokewate added this pull request to stack #356 October 26, 2026 18:43
@lokewate
lokewate marked this pull request as ready for review October 26, 2026 18:47
lokewate added a commit to OpenNSW/nsw-srilanka that referenced this pull request Oct 27, 2026
Pins OpenNSW/core to OpenNSW/core#357's head (1826a5a), which also holds a
task whose step parks after its submission, and drops the go.sum entries
left from the previous pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lokewate
lokewate force-pushed the feat/hold-parked-task-steps branch 6 times, most recently from a0fc223 to 6e3bf4d Compare October 28, 2026 04:22
Base automatically changed from feat/task-cancel-and-fail-activation to main October 28, 2026 04:26
lokewate and others added 2 commits October 28, 2026 09:56
PersistSubmission moves the row to ADVANCING at seq+1, but the step's park
notification carries the step's own seq, so HoldTask's seq <= n guard dropped
it and the task never went ON_HOLD. HoldTask now also accepts a row ADVANCING
at exactly seq+1, and keeps seq+1 so a repeated submission of the step stays
stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lokewate
lokewate force-pushed the feat/hold-parked-task-steps branch from 6e3bf4d to 2f21f25 Compare October 28, 2026 04:26

@Aravinda-HWK Aravinda-HWK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lokewate
lokewate merged commit 3ccf5f9 into main Oct 28, 2026
28 checks passed
@lokewate
lokewate deleted the feat/hold-parked-task-steps branch October 28, 2026 08:02
lokewate added a commit to OpenNSW/nsw-srilanka that referenced this pull request Oct 28, 2026
Main now has force-park (#920) squashed. Pins core to 3ccf5f9, the squash
of the hold-on-park change (OpenNSW/core#357) this branch was built on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants