fix(workflow): return errors instead of panicking in history readers (EN-1226) - #189
fix(workflow): return errors instead of panicking in history readers (EN-1226)#189flemzord wants to merge 1 commit into
Conversation
ReadInstanceHistory and ReadStageHistory ran inside HTTP handlers but panicked on json.Unmarshal failures and on any DescribeWorkflowExecution error other than NotFound, and indexed Input.Payloads[0] / Result.Payloads[0] without a length check (index out of range when a workflow/activity was started with no payload). chi's Recoverer turned each into an opaque 500. - Add unmarshalFirstPayload(), which tolerates a nil/empty payload set and returns the decode error instead of panicking. - Replace all four panic sites with wrapped returned errors; the DescribeWorkflowExecution NotFound case still maps to ErrInstanceNotFound. Adds TestUnmarshalFirstPayload (nil/empty/malformed/well-formed). Note: overlaps internal/workflow/manager.go with other PRs in this series (different functions); independent.
|
Warning Review limit reached
More reviews will be available in 5 minutes and 57 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Superseded by #199, which consolidates this change with the related reliability and safety fixes on top of the current main branch. |
Problem (H6 — HIGH)
ReadInstanceHistoryandReadStageHistoryrun inside HTTP handlers but:panic(err)onjson.Unmarshalfailures of history payloads (3 sites),panic(err)on anyDescribeWorkflowExecutionerror other than NotFound (Temporal unreachable, deadline, permission),Input.Payloads[0]/Result.Payloads[0]with no length check ⇒ index-out-of-range when started with no payload.chi's
Recovererturned each into an opaque 500 with no schema-conformant body and lost the error context.Fix
unmarshalFirstPayload()— tolerates a nil/empty payload set and returns the decode error instead of panicking.DescribeWorkflowExecutionNotFound case still maps toErrInstanceNotFound.Test
TestUnmarshalFirstPayloadcovers nil / empty / malformed / well-formed payloads.Severity: HIGH.