Skip to content

feat(git): make upstream clone/fetch failures diagnosable from logs - #83

Merged
rolandjitsu merged 6 commits into
rolandjitsu:mainfrom
profiling:profiling/issue-82-upstream-failure-logs
Nov 26, 2026
Merged

rolandjitsu merged 6 commits into
rolandjitsu:mainfrom
profiling:profiling/issue-82-upstream-failure-logs

Conversation

@profiling

@profiling profiling commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

  • fix
  • feat
  • refactor
  • perf
  • docs
  • test
  • build / ci
  • chore

Summary

Closes #82. Logs each upstream clone/fetch failure once, with the repo, a trigger (request or background refresh), an error_kind, and a redacted summary of the git stderr. Cancelled operations (client gone, or shutdown) are no longer counted as upstream errors. Moves the upstream error types to src/git/error.rs.

Tests

  • Added / updated tests (unit, plus integration where it fits)
  • Not relevant, because: ...

Checklist

  • CI is green locally: cargo fmt --all --check, cargo clippy --all-targets --all-features --locked -- -D warnings, cargo test --all-features
  • Commits follow Conventional Commits; AI-assisted commits carry an Assisted-by: trailer (see CONTRIBUTING.md / AGENTS.md)
  • Preserves the read-only, pull-only invariant (no push or proactive replication to upstream)
  • Docs / README updated if behavior or flags changed

Breaking change?

upstream_ops_total{result="error"} no longer counts cancelled operations.

@profiling profiling closed this Nov 19, 2026
@profiling
profiling force-pushed the profiling/issue-82-upstream-failure-logs branch from 60b0860 to 35d9861 Compare November 19, 2026 09:46
@profiling profiling reopened this Nov 19, 2026
@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.79%. Comparing base (93bb604) to head (6d66513).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   98.72%   98.79%   +0.07%     
==========================================
  Files          10       11       +1     
  Lines        6427     6817     +390     
==========================================
+ Hits         6345     6735     +390     
  Misses         82       82              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@profiling
profiling force-pushed the profiling/issue-82-upstream-failure-logs branch from c7f6b91 to 2cc06d2 Compare November 19, 2026 09:59
@profiling
profiling marked this pull request as draft November 19, 2026 11:36
@profiling
profiling force-pushed the profiling/issue-82-upstream-failure-logs branch 2 times, most recently from 9018da2 to 629db79 Compare November 19, 2026 15:35
@profiling
profiling marked this pull request as ready for review November 19, 2026 15:36
@rolandjitsu

Copy link
Copy Markdown
Owner

In client credential mode, each upstream auth rejection logs a warn. Keep warn, or use info?

Definitely warn. When kind == FailureKind::Auth && cred.is_some() -> warn instead of info (keeps warn for server cred misconfig and network/transient failures).

The metric change shows in the changelog only as the commit subject. Add a BREAKING CHANGE footer?

Let's add it and describe in a short/concise message that only upstream failures will be counted after this change.

Comment thread tests/http.rs Resolved
Comment thread src/git.rs Resolved
@profiling
profiling marked this pull request as draft November 21, 2026 11:15
@profiling
profiling force-pushed the profiling/issue-82-upstream-failure-logs branch from 8acc742 to 599a51e Compare November 23, 2026 00:49
@profiling

Copy link
Copy Markdown
Contributor Author

Thanks for the review.

  • Auth rejection in client mode: kept at warn. upstream_failed logs every
    classified failure at warn.
  • Added a BREAKING CHANGE footer to fix(metrics): skip cancelled upstream ops.
  • Log capture is now a shared Logs helper in tests/helpers.rs.
  • Moved the upstream error types, classification and redaction to
    src/git/error.rs in a separate commit. It is a pure move.

Rebased on main (#79). The failure log now has a trigger field (request or
refresh). A background refresh failure is logged once and still shows that
refresh started it.

The Dependencies check fails on RUSTSEC-2026-0592 (url). This PR does not
change dependencies.

@profiling
profiling marked this pull request as ready for review November 23, 2026 07:10
@rolandjitsu

Copy link
Copy Markdown
Owner

The Dependencies check fails on RUSTSEC-2026-0592 (url). This PR does not
change dependencies.

Fixed that with #89 .

@profiling
profiling force-pushed the profiling/issue-82-upstream-failure-logs branch from 822a454 to b747c3e Compare November 24, 2026 03:34

@rolandjitsu rolandjitsu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM. Just needs a rebase.

A failed clone or fetch was only counted under repo="-"; callers
logged the outer error without git's diagnostic, and a client
disconnect was not logged at all. Log the final failure where the
operation, repo and credential are known, with a bounded, redacted
stderr summary, and drop the duplicate.

Refs rolandjitsu#82

Assisted-by: Claude:claude-opus-5-5
A client going away or shutdown is not an upstream failure.

BREAKING CHANGE: upstream_ops_total{result="error"} now counts only
upstream failures, not cancelled operations.

Assisted-by: Claude:claude-opus-5-5
Assisted-by: Claude:claude-opus-5-5
Assisted-by: Claude:claude-opus-5-5
git.rs has grown large; this is a pure move with no behavior change.

Assisted-by: Claude:claude-opus-5-5
@profiling
profiling force-pushed the profiling/issue-82-upstream-failure-logs branch from b747c3e to 1ec620f Compare November 25, 2026 06:19
@rolandjitsu

Copy link
Copy Markdown
Owner

Ah, can we fix :

❌ Patch coverage is 99.82301% with 1 line in your changes missing coverage. Please review.

as well?

@profiling

Copy link
Copy Markdown
Contributor Author

Sorry for the extra round here, and thanks for catching this. I rebased the branch onto the latest main and pushed 499dc78, which keeps the emitted log event unchanged while making the upstream failure log callsite fully covered by Codecov.

Local verification passed:

  • cargo fmt --all --check
  • cargo clippy --all-targets --all-features --locked -- -D warnings
  • cargo test --all-features

@profiling
profiling force-pushed the profiling/issue-82-upstream-failure-logs branch from 499dc78 to 6d66513 Compare November 26, 2026 09:34
Keep the log message in a local field so coverage instruments the callsite
without changing the emitted event.

Assisted-by: Claude:claude-opus-4-8
@profiling

Copy link
Copy Markdown
Contributor Author

Small follow-up: the first push exposed a commit-message line-length check failure. I amended the same fix commit to wrap the body line, force-pushed it as 6d66513, and left the code change unchanged. Sorry for the extra CI round.

@rolandjitsu
rolandjitsu merged commit 1c76d67 into rolandjitsu:main Nov 26, 2026
13 checks passed
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.

[FEATURE] Make upstream clone/fetch failures diagnosable from logs

2 participants