Files
temporal/chasm/errors.go
Quinn Klassen 05167abf67 Make standalone activity completion callback attachment idempotent after closure (#11628)
## What changed?

Makes Standalone Activity conflict updates idempotent by recording the
`requestID` when attaching callbacks or links and recognizing duplicate
request IDs. I needed to add a dedicated CHASM error for

## Why?
This prevents a successful attachment whose response was lost from
failing on retry or duplicating/replacing callbacks and links.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [x] added new functional test(s)
2026-08-20 10:21:57 -07:00

28 lines
792 B
Go

package chasm
import "go.temporal.io/api/serviceerror"
// ErrRequestIDAlreadyUsed is returned by UpdateComponent when the request ID supplied via
// WithRequestID has already been recorded on the execution.
var ErrRequestIDAlreadyUsed = serviceerror.NewFailedPrecondition("request ID has already been used for this execution")
type ExecutionAlreadyStartedError struct {
Message string
CurrentRequestID string
CurrentRunID string
}
func NewExecutionAlreadyStartedErr(
message, currentRequestID, currentRunID string,
) *ExecutionAlreadyStartedError {
return &ExecutionAlreadyStartedError{
Message: message,
CurrentRequestID: currentRequestID,
CurrentRunID: currentRunID,
}
}
func (e *ExecutionAlreadyStartedError) Error() string {
return e.Message
}