Skip to content

Fix username in default reason string#1002

Open
dandavison wants to merge 3 commits intomainfrom
fix-username-bug
Open

Fix username in default reason string#1002
dandavison wants to merge 3 commits intomainfrom
fix-username-bug

Conversation

@dandavison
Copy link
Copy Markdown
Contributor

What was changed

Use username in default reason when username is available.

Why?

It's what was intended; the code just had a typo.

How was this tested:

  1. Contains a test of termination
  2. Manually tested termination of standalone activity
$ temporal activity terminate --activity-id standalone_activity_helloworld_ActivityID
Activity terminated

$ temporal activity result -a standalone_activity_helloworld_ActivityID
Results:
  Status   FAILED
  Failure
    Message: Requested from CLI by dan
Error: activity failed

The success branch of `user.Current()` was guarded by `err != nil` so
the resolved username was never used and `defaultReason()` always
rendered as `Requested from CLI by <unknown-user>`, making the recorded
audit trail useless for distinguishing operators in the failure body of
terminated activities and similar default-reason call sites.

Run the test:
  go test ./internal/temporalcli/ -run 'TestSharedServerSuite/TestActivity_Terminate_DefaultReason_NoUnknownUser$' -v
@dandavison dandavison requested a review from a team as a code owner April 28, 2026 01:10
@dandavison dandavison requested a review from chaptersix April 28, 2026 01:10
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