fix: keep erased errors visible to source-iteration and downcasting#2702
Merged
Sebastian Thiel (Byron) merged 4 commits intoJul 9, 2026
Merged
Conversation
…itoxideLabs#2694) Since 499402c, erasing an Exn wraps its error in the Untyped marker so that the typed accessors of Exn<Untyped> keep working. However, the marker also hid the original error from everything that walks the error afterwards: frames now yielded the marker, which cannot be downcast to the original type, and whose empty Error implementation cut off the source chain below it. This broke gix diff file, whose fallback for treating a revspec as a path on disk downcasts the sources() of a failed rev-parse to find the ref-not-found error - it would now fail with "couldn't parse revision" instead. Frame::error() now unwraps the erasure marker to return the original error, downcast_any_ref() goes through it, and Untyped forwards source(), so erasure no longer affects how errors are discovered - while the typed accessors keep seeing Untyped as their compile-time type, just like before. Also adds the previously missing journey-test coverage for gix diff file.
Sebastian Thiel (Byron)
force-pushed
the
fix/2694-exn-source-chain
branch
from
July 9, 2026 12:57
38c49f4 to
cf6d555
Compare
Sebastian Thiel (Byron)
marked this pull request as ready for review
July 9, 2026 12:59
Sebastian Thiel (Byron)
force-pushed
the
fix/2694-exn-source-chain
branch
from
July 9, 2026 13:24
42111ec to
735bbc3
Compare
- add an additional `gix` based test to not rely on journey tests for development tools Co-authored-by: GPT 5.5 <[email protected]>
Sebastian Thiel (Byron)
force-pushed
the
fix/2694-exn-source-chain
branch
from
July 9, 2026 13:31
7dc4f3d to
efc3b24
Compare
Sebastian Thiel (Byron)
force-pushed
the
fix/2694-exn-source-chain
branch
from
July 9, 2026 13:32
efc3b24 to
a985d38
Compare
Sebastian Thiel (Byron)
enabled auto-merge
July 9, 2026 13:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2694.
The problem
gix diff filetreats a revspec that fails to resolve as a path on disk, by walking the failed rev-parse'ssources()and downcasting each error to find the ref-not-found error. Since 499402c (found by Christoph Rüßler (@cruessler)'s bisect in #2694),Exn::erased()wraps the original error in theUntypedmarker so that the typed accessors ofExn<Untyped>keep working — but the marker also hid the original error from everything that walks the error afterwards:Untyped's emptyErrorimplementation returnedNoneforsource(), cutting off the chain below it.That made the revspec→path fallback unreachable, so
gix diff file :README.md README.mdfailed withError: couldn't parse revision: "README.md".The fix
Frame::error()now unwraps the erasure marker to return the original error,downcast_any_ref()goes through it, andUntypedforwardssource(). Erasure thus no longer affects how errors are discovered, while the typed accessors (Exn::error(),into_inner(),into_box()) keep seeingUntypedas their compile-time type, just like 499402c intended — its tests for that are untouched and keep passing.Two new unit tests pin this down, one of them mirroring the exact
sources()-downcast pattern that broke.Journey test
The regression could go unnoticed because
gix diff filehad no journey-test coverage, so this adds the missing test: it diffs an index revspec (:b) against the file on disk and snapshots the resulting hunk. Without the fix it fails with the exact error from #2694.