Skip to content

Conversation

@pinebit
Copy link
Collaborator

@pinebit pinebit commented Nov 24, 2025

Handling 409 status code for Obol API's HTTP POST requests, e.g. when DKG is publishing the lock file.

category: refactor
ticket: #4107

@sonarqubecloud
Copy link

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds graceful handling of HTTP 409 (Conflict) status codes returned by the Obol API during POST requests. When a 409 is received (indicating duplicate submission), the code now logs an informational message instead of returning an error, allowing the operation to continue successfully. This is useful in distributed DKG scenarios where multiple nodes might attempt to publish the same lock file.

  • Special handling for 409 status codes to treat them as success (not errors)
  • Added test coverage for 409 conflict scenario
  • Info-level logging when duplicate requests are detected

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
app/obolapi/api.go Added conditional logic to ignore 409 status codes and log informational message instead of returning error
app/obolapi/api_internal_test.go Added test case to verify 409 status code is handled as success
.gitignore Added .serena/ directory to ignore list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.38%. Comparing base (99bc194) to head (5180810).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4121      +/-   ##
==========================================
+ Coverage   56.36%   56.38%   +0.02%     
==========================================
  Files         245      245              
  Lines       31173    31175       +2     
==========================================
+ Hits        17571    17579       +8     
+ Misses      11290    11288       -2     
+ Partials     2312     2308       -4     

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

Copy link
Contributor

@OisinKyne OisinKyne left a comment

Choose a reason for hiding this comment

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

I think Cluster lock is already published. would be cleaner than: Duplicate request ignored by Obol API. Likely another node submitted the same data already.

@pinebit pinebit added the merge when ready Indicates bulldozer bot may merge when all checks pass label Nov 25, 2025
@obol-bulldozer obol-bulldozer bot merged commit 4137969 into main Nov 25, 2025
18 checks passed
@obol-bulldozer obol-bulldozer bot deleted the pinebit/http-post-409 branch November 25, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge when ready Indicates bulldozer bot may merge when all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants