Skip to content

fix(api): persist accepted manual deals - #691

Open
scaseye wants to merge 1 commit into
data-preservation-programs:mainfrom
scaseye:codex/save-manual-api-deals
Open

scaseye wants to merge 1 commit into
data-preservation-programs:mainfrom
scaseye:codex/save-manual-api-deals

Conversation

@scaseye

@scaseye scaseye commented Nov 4, 2026

Copy link
Copy Markdown

POST /api/send_deal currently submits a manual proposal without persisting the returned deal. A successful response can therefore have ID 0 even though the provider accepted the proposal.

We encountered this using an external controller for per-deal admission, pacing and duplicate checks beyond our scheduled submission workflow. API clients need persistence equivalent to CLI deal send-manual --save without direct database write access.

This change calls the existing proposal handler once, then saves the accepted model using database.DoRetry and returns its generated ID. Only persistence is retried; the network proposal is not replayed. The shared handler, CLI behavior and database schema remain unchanged.

Validation: the equivalent deployed wrapper passed persistence/rejection tests and live validation on our pinned revision. Current-main tests have not been run. This draft still needs Go formatting and regression tests added.

Provider acceptance and persistence are not atomic. A save failure after acceptance requires reconciliation before resubmission.

Refactor send_deal endpoint to use sendManualAndSave method for handling deals and saving to the database.
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.

1 participant