Skip to content

app/obolapi: send a User-Agent and type 404s on POST - #4808

Open
OisinKyne wants to merge 1 commit into
mainfrom
obolapi/user-agent-404
Open

OisinKyne wants to merge 1 commit into
mainfrom
obolapi/user-agent-404

Conversation

@OisinKyne

@OisinKyne OisinKyne commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Sends a User-Agent: charon/<version> header on every Obol API request, so the API can attribute traffic. Today every Go client shows up as Go-http-client/1.1. The new WithUserAgent(product) client option lets tools built on this package put themselves in front, e.g. lido-dv-exit/v0.7.0 charon/v1.12.0.

httpPost, httpGet and httpDelete become Client methods so they can read the header from the client. PostFeeRecipientsFetch, which builds its own request, sets it too.

A 404 response to a POST now returns the new ErrLockNotFound sentinel, matched on status, not body text. The error keeps its status and body fields. Before, 404s were a generic http POST failed error, so callers couldn't tell "the cluster lock isn't published to this API" from a transient failure. lido-dv-exit retried such a cluster forever without telling the operator. PostFeeRecipientsFetch's existing "cluster is unknown to the API" error now wraps it too.

httpGet also closes the response body on non-2xx responses; the 404 path used to leak it.

category: feature
ticket: none

@sonarqubecloud

Copy link
Copy Markdown

@OisinKyne OisinKyne changed the title feat(app/obolapi): send a User-Agent and type 404s on POST app/obolapi: send a User-Agent and type 404s on POST Oct 23, 2026
@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.92308% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.65%. Comparing base (4e4d996) to head (1186421).

Files with missing lines Patch % Lines
app/obolapi/feerecipient.go 0.00% 4 Missing ⚠️
app/obolapi/exit.go 66.66% 1 Missing ⚠️
app/obolapi/test.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4808      +/-   ##
==========================================
+ Coverage   67.61%   67.65%   +0.04%     
==========================================
  Files         254      254              
  Lines       33609    33622      +13     
==========================================
+ Hits        22725    22748      +23     
+ Misses      10883    10873      -10     
  Partials        1        1              

☔ 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.

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.

2 participants