fix(git): unify transient error detection - #853
Merged
Conversation
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.
Problem
The required
cargo clippy --workspace --all-targets -- -D warningscheck fails ondevelopand on unrelated pull requests withambiguous glob re-exportsingit_api::commands.streamingexposed a crate-visibleis_transient_errorwhileutilsre-exported the canonicalgit::util::is_transient_error; glob-exporting both modules made the command namespace ambiguous.git::bundlealso carried a third byte-for-byte copy of the same predicate.Solution
Make
git::util::is_transient_errorthe single implementation. The streaming and bundle paths now import that canonical helper, and the streaming tests exercise the canonical function directly. The existing publicgit_api::commands::is_transient_errorpath remains available throughutils, so no caller-facing API changes.The resulting invariant is one transient-error classifier for all Git retry paths and one unambiguous command export.
Potential risks
Future edits to the canonical classifier now affect both streaming and bundle retry behavior together; that coupling is intentional, but changes to the shared predicate should keep both consumers in mind. The current predicates were byte-for-byte identical, so this PR does not change which errors are retried.
No dependency, lockfile, persistence, schema, wire-format, or UI behavior changes are included. Cross-platform runtime behavior was not manually exercised; workspace compilation covers all local targets, and CI remains the source for runner-platform validation. Rollback is a revert of commit
10b5aada7.Verification
node scripts/tauri/prepare-sidecars.cjs --profile debug— passed; staged the sidecar required by the Tauri build script.cargo test -p git --lib— passed, 134/134.cargo test -p git_api --lib— passed, 90/90.cargo check --workspace --all-targets— passed.cargo clippy --workspace --all-targets -- -D warnings— passed with the exact CI command and a worktree-local target directory.rustfmt --edition 2021 --check crates/git/src/bundle.rs crates/git-api/src/commands/streaming.rs crates/git-api/src/commands/tests/streaming_tests.rs— passed.gitandgit_api.cargo fmt --all -- --check— not clean on the untoucheddevelopbaseline; it reports pre-existing formatting diffs outside these three changed files. The changed files pass the targetedrustfmt --checkcommand above.Audit
Architecture audit covered all 10 layers. Compilation and warnings pass; the duplicate implementation class was swept across the Rust workspace and reduced to the canonical helper; naming and ownership now point to the shared Git utility layer. No default branches, domain leakage, wire payloads, initialization paths, or multi-field resolvers are changed, so layers 5 and 8-10 are non-applicable beyond confirming the diff does not enter those boundaries.