Skip to content

Chasm engine to convert returned errors#9369

Merged
fretz12 merged 25 commits intotemporalio:mainfrom
fretz12:fredtzeng/chasm-err-convert
Mar 18, 2026
Merged

Chasm engine to convert returned errors#9369
fretz12 merged 25 commits intotemporalio:mainfrom
fretz12:fredtzeng/chasm-err-convert

Conversation

@fretz12
Copy link
Copy Markdown
Contributor

@fretz12 fretz12 commented Feb 20, 2026

What changed?

Changed chasm engine to convert errors, if needed, to the relevant service errors. Chasm errors remain as is. Internal errors (i.e., persistence) are sanitized and error details for uncategorized errors are preserved via logging. Uncategorized errors are defaulted to serviceerror.Unavailable

Why?

Currently chasm engine can expose non-service errors with internal details. We should not expose this to the API callers as those errors may eventually be exposed publicly. But we do want to preserve the original errors for debugging purposes, and thus they get logged before the conversion.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

@fretz12 fretz12 changed the title Chasm engine to convert errors Chasm engine to convert returned errors Feb 20, 2026
@fretz12 fretz12 requested a review from Copilot February 20, 2026 00:46
Copy link
Copy Markdown

Copilot AI left a comment

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 hardens the history service’s CHASM engine error surface by converting non-serviceerror errors (notably persistence-layer errors) into appropriate serviceerror types, while preserving internal details via logging.

Changes:

  • Added a centralized ChasmEngine.convertError to sanitize/translate returned errors (including persistence error mappings and a default-to-Unavailable fallback).
  • Routed multiple CHASM engine call paths through convertError (e.g., StartExecution / UpdateWithStartExecution / component operations).
  • Added unit coverage validating error conversion behavior.

Reviewed changes

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

File Description
service/history/chasm_engine.go Adds and wires in error conversion logic across CHASM engine operations to prevent leaking internal/non-service errors.
service/history/chasm_engine_test.go Adds unit tests intended to validate the new error conversion behavior and mappings.

Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go
Comment thread service/history/chasm_engine_test.go
Comment thread service/history/chasm_engine.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread service/history/chasm_engine.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
fretz12 and others added 2 commits February 19, 2026 21:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread service/history/chasm_engine_test.go
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
@fretz12 fretz12 requested a review from bergundy February 23, 2026 23:22
@awln-temporal awln-temporal requested review from awln-temporal and removed request for bergundy February 24, 2026 01:16
@fretz12 fretz12 requested a review from bergundy February 24, 2026 21:10
Comment thread service/history/chasm_engine.go
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
@fretz12 fretz12 requested a review from bergundy March 9, 2026 17:55
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
@fretz12 fretz12 requested a review from bergundy March 10, 2026 18:32
Comment thread service/history/chasm_engine.go Outdated
Comment thread service/history/chasm_engine.go Outdated
@fretz12 fretz12 requested a review from bergundy March 12, 2026 03:51
Comment thread service/history/chasm_engine.go Outdated
@fretz12 fretz12 requested a review from bergundy March 16, 2026 20:38
@fretz12 fretz12 merged commit 16b8a8a into temporalio:main Mar 18, 2026
68 of 70 checks passed
@fretz12 fretz12 deleted the fredtzeng/chasm-err-convert branch March 18, 2026 19:24
stephanos pushed a commit that referenced this pull request Mar 20, 2026
## What changed?
Changed chasm engine to convert errors, if needed, to the relevant
service errors. Chasm errors remain as is. Internal errors (i.e.,
persistence) are sanitized and error details for uncategorized errors
are preserved via logging. Uncategorized errors are defaulted to
serviceerror.Unavailable

## Why?
Currently chasm engine can expose non-service errors with internal
details. We should not expose this to the API callers as those errors
may eventually be exposed publicly. But we do want to preserve the
original errors for debugging purposes, and thus they get logged before
the conversion.

## How did you test it?
- [X] built
- [X] run locally and tested manually
- [X] covered by existing tests
- [X] added new unit test(s)
- [ ] added new functional test(s)
birme pushed a commit to eyevinn-osaas/temporal that referenced this pull request Mar 23, 2026
## What changed?
Changed chasm engine to convert errors, if needed, to the relevant
service errors. Chasm errors remain as is. Internal errors (i.e.,
persistence) are sanitized and error details for uncategorized errors
are preserved via logging. Uncategorized errors are defaulted to
serviceerror.Unavailable

## Why?
Currently chasm engine can expose non-service errors with internal
details. We should not expose this to the API callers as those errors
may eventually be exposed publicly. But we do want to preserve the
original errors for debugging purposes, and thus they get logged before
the conversion.

## How did you test it?
- [X] built
- [X] run locally and tested manually
- [X] covered by existing tests
- [X] added new unit test(s)
- [ ] added new functional test(s)
stephanos pushed a commit that referenced this pull request Mar 23, 2026
## What changed?
Changed chasm engine to convert errors, if needed, to the relevant
service errors. Chasm errors remain as is. Internal errors (i.e.,
persistence) are sanitized and error details for uncategorized errors
are preserved via logging. Uncategorized errors are defaulted to
serviceerror.Unavailable

## Why?
Currently chasm engine can expose non-service errors with internal
details. We should not expose this to the API callers as those errors
may eventually be exposed publicly. But we do want to preserve the
original errors for debugging purposes, and thus they get logged before
the conversion.

## How did you test it?
- [X] built
- [X] run locally and tested manually
- [X] covered by existing tests
- [X] added new unit test(s)
- [ ] added new functional test(s)
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.

3 participants