Skip to content

Conversation

@sellout
Copy link
Contributor

@sellout sellout commented Sep 10, 2025

Overview

This preserves structured errors (CompileExn, DecompError, RuntimeExn, and RuntimePanic) until much closer to main, allowing rendering decisions to be made with more information. For example, pulling issue titles from GitHub is no longer done when running transcripts (to avoid network-induced nondeterminism, reflected in fix-4463.md).

Implementation notes

A new type, Unison.Runtime.Error, wraps CompileExn, RuntimeExn, and RuntimePanic, because they travel together.

Unison.Codebase.Runtime.Error is gone. It was the result of serializing various error types, and is now represented by either Unison.Runtime.Error or DecompError, depending on the site.

Error serialization has been moved to Unison.Runtime.Interface. Ideally, it would be moved out of unison-runtime completely and into unison-cli, but it is still used in tests, debugging, etc.

Unison.Codebase.Editor.Output.EvaluationFailure now takes a Unison.Runtime.Error and a separate function to apply to the prettified result, rather than expecting the failure to be prettified already.

This also indents the output for test failures (as seen in name-test-sandbox-violators.md).

Test coverage

This is covered by existing transcripts. Two of the test outputs change (as called out above), and the rest not changing shows that this is mostly a refactor.

Loose ends

This is based on #5868, so that should be merged first. Until it’s merged, this PR’s diff includes the changes from that PR, but that one is pretty small, so it shouldn’t block review.

In unisonweb#5661, exceptions were made much prettier, but also accidentally
double-prettified in cases where they were written to then read back off
the stack. This reverts that double-prettification.

Fixes unisonweb#5864.
This preserves structured errors (`CompileExn`, `DecompError`,
`RuntimeExn`, and `RuntimePanic`) until much closer to `main`, allowing
rendering decisions to be made with more information. For example,
pulling issue titles from GitHub is no longer done when running
transcripts (to avoid network-induced nondeterminism, reflected in
fix-4463.md).

Some of the specific changes that were made:

A new type, `Unison.Runtime.Error`, wraps `CompileExn`, `RuntimeExn`,
and `RuntimePanic`, because they travel together.

`Unison.Codebase.Runtime.Error` is gone. It was the result of
serializing various error types, and is now represented by either
`Unison.Runtime.Error` or `DecompError`, depending on the site.

Error serialization has been moved to `Unison.Runtime.Interface`.
Ideally, it would be moved out of unison-runtime completely and into
unison-cli, but it is still used in tests, debugging, etc.

`Unison.Codebase.Editor.Output.EvaluationFailure` now takes a
`Unison.Runtime.Error` and a separate function to apply to the
prettified result, rather than expecting the failure to be prettified
already.

This also indents the output for `test` failures (as seen in
name-test-sandbox-violators.md).
@aryairani aryairani merged commit da16c08 into unisonweb:trunk Sep 11, 2025
18 checks passed
@sellout sellout deleted the defer-error-serialization branch October 8, 2025 16:36
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