Skip to content

refactor(common): extract ApiError::status_code helper#739

Open
geoffjay wants to merge 2 commits intomainfrom
issue-720
Open

refactor(common): extract ApiError::status_code helper#739
geoffjay wants to merge 2 commits intomainfrom
issue-720

Conversation

@geoffjay
Copy link
Copy Markdown
Owner

refactor(common): extract ApiError::status_code helper

refactor(common): extract ApiError::status_code helper from into_response (closes #720)

@geoffjay geoffjay added the review-agent Used to invoke a review by an agent tracking this label label Mar 23, 2026
@geoffjay
Copy link
Copy Markdown
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.69%. Comparing base (a5867f0) to head (8a5acd4).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #739      +/-   ##
==========================================
+ Coverage   55.66%   55.69%   +0.02%     
==========================================
  Files         126      126              
  Lines       13759    13763       +4     
==========================================
+ Hits         7659     7665       +6     
+ Misses       6100     6098       -2     

☔ View full report in Codecov by Sentry.
📢 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.

@geoffjay
Copy link
Copy Markdown
Owner Author

👀 Conductor: Awaiting Reviewer

PR #739 (refactor(common): extract ApiError::status_code helper) has CI passing and is in the review-agent queue awaiting a reviewer pickup.

Nudge posted by conductor pipeline sync.

Copy link
Copy Markdown
Owner Author

@geoffjay geoffjay left a comment

Choose a reason for hiding this comment

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

Review: refactor(common): extract ApiError::status_code helper

Stack position: issue-720 is directly on main with no parent PR
dependency, but git-spice reports (needs restack) — the branch is behind
main and must be rebased before the conductor can merge it.


Code quality: approved

The change is correct, focused, and well-tested. Specific notes:

status_code() method — the variant→status mapping is identical to the
old per-arm match in into_response. No behaviour change.

Internal case — the old code used e.to_string() (on the inner
anyhow::Error); the new code uses self.to_string(). Because Internal is
annotated #[error(transparent)], Display delegates to the inner error, so
the two produce identical strings. Correct.

into_response simplification — going from 7 match arms (each repeating
self.to_string()) to two lines is the right outcome. The match &self /
self.to_string() awkwardness (matching a reference to get the status then
calling to_string on the owner) is gone.

Tests — 7 tests, one per variant, all exercising status_code() directly.
anyhow::anyhow!("boom").into() for Internal is the idiomatic pattern.
Coverage is complete.

Scope — single file, single responsibility, no unrelated changes.


Action required before merge

Rebase onto main:

git-spice branch restack
git-spice branch submit

Once restacked, add merge-queue to trigger the conductor.

@geoffjay geoffjay added needs-restack Branch is behind its stack parent, needs git-spice restack and removed review-agent Used to invoke a review by an agent tracking this label labels Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-restack Branch is behind its stack parent, needs git-spice restack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(common): extract status_code() helper from ApiError::into_response

1 participant