Skip to content

fix(workflows): deterministic notifier task ordering - #328

Merged
hughneale merged 2 commits into
mainfrom
fix/deterministic-notifier-order
Apr 27, 2026
Merged

fix(workflows): deterministic notifier task ordering#328
hughneale merged 2 commits into
mainfrom
fix/deterministic-notifier-order

Conversation

@hughneale

Copy link
Copy Markdown
Contributor

Summary

  • make notifier provider iteration deterministic in workflow-capable notification paths
  • sort notifier map keys before building/scheduling notification tasks
  • apply consistently across authorize, revoke, approvals, and form paths

Why

Go map iteration order is randomized. These notification tasks are later scheduled via workflow goroutines, so non-deterministic iteration can reorder scheduled activities between runs.

Changes

  • internal/workflows/tasks/providers/thand/authorize.go
  • internal/workflows/tasks/providers/thand/revoke.go
  • internal/workflows/tasks/providers/thand/approvals.go
  • internal/workflows/tasks/providers/thand/form.go

Validation

  • gofmt -w on touched files
  • go test -mod=mod ./internal/workflows/tasks/providers/thand -run TestDoesNotExist

Copilot AI review requested due to automatic review settings April 27, 2026 13:06
@github-actions github-actions Bot added the fix Bug fix (patch version bump) label Apr 27, 2026

Copilot AI 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.

Pull request overview

This PR makes notifier provider iteration deterministic in Thand workflow task notification paths to avoid Temporal replay nondeterminism caused by randomized Go map iteration.

Changes:

  • Collect and sort notifier provider map keys before building notification tasks.
  • Apply deterministic provider ordering consistently across authorize, revoke, approvals (including rejection), and form notification flows.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/workflows/tasks/providers/thand/authorize.go Sorts notifier provider keys before building authorization notification tasks.
internal/workflows/tasks/providers/thand/revoke.go Sorts notifier provider keys before building revocation notification tasks.
internal/workflows/tasks/providers/thand/approvals.go Sorts notifier provider keys for approval notifications and rejection notifications.
internal/workflows/tasks/providers/thand/form.go Sorts notifier provider keys before building form notification tasks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/workflows/tasks/providers/thand/approvals.go Outdated
Comment thread internal/workflows/tasks/providers/thand/approvals.go Outdated
@hughneale
hughneale merged commit 221086d into main Apr 27, 2026
13 checks passed
@hughneale
hughneale deleted the fix/deterministic-notifier-order branch April 27, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix (patch version bump)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants