Repository navigation
gix-error v0.5.0
New Features
-
make caller-location printing opt-in
auto-chain-erroralso printed source locations in user-facing reports,
including consumers which only wanted a standard error chain. Make printing
independently configurable witherror-print-location, forwarded bygix.
The feature gates the shared location writer; caller locations, metadata,
classification, and the existing alternate-format rules remain intact.Enable printing explicitly in workspace binary dependencies and the filter
test-helper feature.gix-erroropts in for its own tests so existing location
snapshots retain their coverage. An isolated Cargo consumer checks real
main()stderr for both crates, printing on and off, tree and chain modes,
andtree-errorprecedence without workspace test feature unification.
Bug Fixes
-
shorten caller locations to package source paths
Reviewed and refactored carefully, tried the release script as well.
Didn't review the release script at all though, just had some docs added.
I consider it disposable.Enabled location diagnostics could expose entire checkout and Cargo registry
paths, obscuring the useful source location with machine-specific directories.
Format conventional source paths relative to their containing package directory
and remove Cargo registry version suffixes, so a path such as
/home/user/.cargo/registry/src/index.crates.io-hash/gix-url-0.39.0/src/parse.rs
prints asgix-url/src/parse.rs. Unrecognized layouts fall back to the filename.Keep captured
std::panic::Locationvalues and line numbers intact. The shared
formatter covers tree, chain, source, test, andmain()diagnostics; feature
defaults and alternate formatting remain unchanged. Document the limitation
that locations contain no Cargo package metadata and build owners can use
--remap-path-prefixfor exact package names in arbitrary layouts. -
preserve explicit causes in standard error source chains
Returning a child frame's bare diagnostic from
Error::source()lost any
explicit causes attached to that frame. Standard error reporters, including
anyhow, could truncate nested context chains before reaching the underlying
error.Keep nonleaf frames reachable as source boundaries while exposing raw leaf
diagnostics for downcasting. Format each boundary as a single diagnostic to
avoid duplicating subtrees in external reports, and preserve native-source
precedence without another allocation.Add regression coverage for standard and
anyhowtraversal and rendering,
erasure and boxing round trips, and preservation of typed diagnostics,
classification, and metadata. Document linear source traversal and the
full-tree inspection alternatives. -
flatten native error chains in linear time
Exn::into_chain()resolved each native source from its owning root both
to check for nested boundaries and to construct the next handle. Flattening
64 errors therefore required 4,096source()calls.Scan each native chain once when constructing its
ErrorHandle, recording
its length and the prefix that inherits the frame location. Advancing a
handle only increments its depth. Stop at nestedErrorboundaries to
preserve breadth-first order, concrete error types, and caller locations
without extra allocations or dependencies.Add
native_source_flattening_is_linearto require at most four source
lookups per error and separately verify that every error survives.
Chains of 16, 32, and 64 errors now need 16, 32, and 64 source calls.
Explicitinto_chain()calls exercise flattening in every feature
configuration. Individual handle lookups continue to walk from their owner.
Changed (BREAKING)
-
wrap
Metadataand simplify diagnostic keysQuoting every metadata key adds noise to diagnostic output even when the
name is already unambiguous. Keep nonempty keys containing only ASCII
letters, digits,_,-, or.unquoted inMessagedisplay and metadata
debug output. Empty and unusual keys remain quoted and escaped, and value
formatting is unchanged.Replace the public
BTreeMapalias with a private-storageMetadata
wrapper so dictionary formatting and its public API no longer expose the
implementation. Preserve lexicographic ordering and provide construction,
lookup, mutation, iteration, indexing, collection, and extension APIs.Breaking change:
Metadatais no longer interchangeable with
BTreeMap. Callers must use the wrapper API; iterator return types hide
the underlying collection.Add regression coverage for key quoting, compact values, and dictionary
access, and update dependent assertions and output snapshots. -
unify workspace diagnostics and error recovery
Looked at
gix-errorcarefully and did multiple cleanup and improvement passes.
At some point I went quicker through the changes as they looked good enough,
also to at some point just wave it through.General changes
Use the workspace's own error API throughout applications, examples, internal
utilities, and fuzz targets. Replace downstreamanyhow::Result,Context,
bail!, andensure!usage withgix::Resultand helpers fromgix::error,
orgix_errorin plumbing crates. Convert native errors at their call sites
while preserving concrete causes, typed recovery contracts, and caller locations.
Keep optionalanyhowinteroperability ingix-errorandgixfor consumers.Make diagnostics useful both to people and to callers deciding how to recover.
Distinguish invalid input, corrupt data, missing resources, unavailable
capabilities, authentication, authorization, conflicting state, and cancellation.
Explicit cancellation prevents retrying even when another cause is retryable.
Store offending input and available subprocess details as structured metadata,
with operation context in the message and native failures retained as causes.Report causes under a numbered
Caused by:section, retaining branch guides for
error trees and flattening linear chains. Standardize path quoting, refresh
snapshots, and omit changing source locations from CLI error comparisons.
Migrate affected tests and helpers toTestResultwhere they need to propagate
both native errors and exceptions. Update contributor and application guidance,
remove redundant dependencies, and refresh the lockfile.gix-error: recovery classes, metadata, and complete native reportsAdd
Cancelled,PermissionDenied,Unauthenticated,Conflict, and
Unsupportedclasses with matching constructors, markers, builders, and
predicates. Order classes by suggested recovery precedence and expose
dominant_class(). Both retry policies inspect cancellation across causes;
native permission and unsupported I/O errors receive classifications, while
explicit authentication challenges take precedence over legacy permission wrappers.Add classified
Messagebuilders and_errorhelpers, caller-tracked
Messageconversions, and formattedbail!/ensure!shorthand with builder
chains. Introducewith_input(), subprocess metadata helpers, common metadata
schemas, andmetadata_merged(), with more specific causes overriding context.Number tree reports while preserving forks and flattening chains. Give
auto-chain-errorcompleteDebugreports with locations and single-line
alternateDisplaychains; share that formatter withTestError. Cover nested
native sources, classification precedence, metadata, caller tracking, macro
evaluation, report layout, and retainedanyhowinteroperability.gix: consistent porcelain diagnostics and application guidanceDocument
gix::Result,gix::Error, andgix::errorfor applications. Apply
classification and input metadata to configuration, initialization, repository
opening, clone and remote setup, object access, and path handling. Distinguish
unsupported formats from malformed values, and classify branch/worktree state
conflicts and explicit cancellation without replacing concrete recovery errors.Record signing and key-command failures through subprocess metadata. Migrate
examples and tests away fromanyhow, refresh diagnostics and classification
assertions, remove the test dependency, and updateprodashto31.0.1.gitoxide: native CLI errors and dependency cleanupReturn
gix::Resultfromgix,ein, the combined binary, and shared command,
progress, and tracing helpers. Preserve context when configuring repositories,
writing output, and starting tracing; classify unavailable tracing as unsupported.
Migrate top-level examples and journey snapshots to native diagnostics.
Replaceis-terminalwithstd::io::IsTerminal, removeanyhow, and update
prodashto31.0.1with corresponding feature and lockfile cleanup. -
return public errors from extension helpers
gix-errorwas refackiewed, the rest was scrolled through to peek out problems
at best.
Looked atgixin detail, refackiew, and came up with API improvement to
gix-config-valueon the way.Public plumbing APIs now use
gix_error::Result, so constructing typed
exceptions by default requires repeated erasure, conversion, and propagation
wrappers at their call sites.Make
raise()andand_raise()returnError, and makeor_raise()and
ok_or_raise()returnResult. Preserve the former behavior under explicit
_typednames and addResultExt::or_error()for conversion without context.
Existing public errors pass through unchanged without allocating, while
context retains concrete causes, metadata, classifications, and caller sites.
Keep the erased helpers and inherentExnoperations unchanged.Migrate callers and documentation together, preserving concrete public
exception signatures and typed internal boundaries. Use the existingbail!
macro for 388 early error returns across 37 crates, passing native errors and
messages directly and retaining context and explicit erasure on typed
exceptions. Preserve direct propagation of publicErrorvalues to avoid
introducing extra exception frames. -
standardize public errors and reuse exception frames
rubber-stamp after scrolling through the diff top to bottom.
gix-error changes were refackiewed carefully.Use
gix_error::Resultandgix_error::Errorat public plumbing boundaries
with erased or message-based exceptions so applications can use ordinary
std::error::Errorhandling while retaining concrete recovery errors,
causes, metadata, and caller locations. Apply this to public traits,
callbacks, iterator items, and re-exported APIs, and adapt their consumers
throughout the workspace. Preserve concrete public error signatures and
typed internal exceptions; letbail!convert to either result form.Add
Error::into_exn()for internal tree manipulation, including the
revision parser's delayed errors. Recover explicitly raised frames in
auto-chain-errormode and forward native source chains through nested
Errorwrappers. Reuse existing boxed tree frames when adding context or
erasing errors to avoid redundant boxing, and keep context construction
independent of existing chain depth.Remove repeated propagation wrappers from callers and update the migration
guide and repository conventions. Document the value of context that
explains an operation's intent or identifies user-controlled configuration,
including its raise location, even when failures are rare.Remove
Class::Ioand the syntheticio()constructor so classifications
describe semantic failures. RetainNotFoundandOutOfMemory
classifications for real I/O errors, and inspect their concrete causes for
the conservative and lenient retry policies. -
replace recovery tags with typed operation errors
GitButler needs to distinguish missing binary merge results, ambiguous object
prefixes, diff setup failures, unrelated histories, and repository discovery
outcomes. Broad classifications alone also match failures that these callers
must propagate, such as missing-directory I/O and rejected repository trust.Remove
Class::Taggedand expose non-exhaustiveErrorenums for these
operations. Share the merge-base enum across pair, many, and octopus methods,
and keep porcelain returns asgix::Result. Preserve candidate information,
native paths, diff resource details, requested commit IDs, and callee causes.Add
gix_error::tag()and make classifications identify the wrapped error or
the owner of a constant marker source. Keep traversal lazy and preserve its
order, duplicates, marker transparency, and original I/O kinds in both error
representations. Document typed recovery and wildcard propagation.Validate merge-base input commits in the shared traversal path so missing
inputs cannot masquerade as unrelated histories, including fast paths and
octopus calls. Continue allowing absent parents for shallow histories and
empty successful results formerge_bases_many*()on unrelated histories.Fix the recovery tests failing in Linux/ARM
test-fastand Windows
test-fixtures-windowsCI. Discovery examines the ceiling directory before
stopping, so its immediate child reports a stopping height of 2. Attribute
lookup converts Git paths to native paths, rejecting ill-formed UTF-8 on
Windows before reaching object lookup. Cover missing-object conversion with
a valid path everywhere and retain its non-UTF-8 path case on Unix.
New Features (BREAKING)
-
make
bstran opt-in metadata conversion featureSmall error-handling programs should not compile
bstrandmemchrjust
to add ordinary error contexts. Disablebstrby default so a standalone
gix-errorconsumer needs no dependencies unless it enables optional features.Always store
MetadataValue::BytesasVec<u8>, regardless of features.
This changes the public variant payload fromBString. Keep escaped debug
and display diagnostics compatible withbstr, including valid Unicode,
control characters, invalid bytes, and truncated UTF-8.The opt-in
bstrfeature suppliesFrom<BString>andFrom<&BStr>for
MetadataValueand retains the crate re-export. Owned conversions reuse
the allocation; borrowed conversions copy the bytes. Enable the feature
explicitly in workspace crates that need these conversions or the re-export,
preserving theirwith_input()andwith()calls. Adapt direct byte
constructors and submodule payload access to the newVec<u8>representation.Earlier five-sample fresh-build measurements of the same small consumer on
Rust 1.99.0 / M4 Max recorded medians of 702 vs 458 ms in debug and 872 vs
609 ms in release with and withoutbstr. These include Cargo and linking
with registry sources cached; they are specific to that consumer and machine.
Commit Statistics
- 16 commits contributed to the release over the course of 13 calendar days.
- 13 days passed between releases.
- 10 commits were understood as conventional.
- 0 issues like '(#ID)' were seen in commit messages
Commit Details
view details
- Uncategorized
- Prepare changelogs prior to release (794eeef)
- Merge pull request #3032 from GitoxideLabs/sec-audit (1d7bac7)
- Shorten caller locations to package source paths (a347e61)
- Make caller-location printing opt-in (1f56236)
- Preserve explicit causes in standard error source chains (d18a82b)
- Wrap
Metadataand simplify diagnostic keys (aa7b699) - Merge pull request #3046 from GitoxideLabs/gix-error-optional-bstr (9272d45)
- Make
bstran opt-in metadata conversion feature (f0940c5) - Merge pull request #3033 from GitoxideLabs/gix-cli-progress-cleanup (80f4b03)
- Unify workspace diagnostics and error recovery (506fc1d)
- Merge pull request #3022 from GitoxideLabs/release-testtools (f819565)
- Flatten native error chains in linear time (2332185)
- Return public errors from extension helpers (7cbd9eb)
- Standardize public errors and reuse exception frames (ac71fb4)
- Replace recovery tags with typed operation errors (a36bff1)
- Merge pull request #3020 from GitoxideLabs/report-september (5fb3dcf)