fix(inscribe): include PATCH hint in 409 response when brief already inscribed (closes #358)#359
Closed
tfireubs-ui wants to merge 1 commit into
Closed
Conversation
…inscribed (closes aibtcdev#358) When POST /api/brief/:date/inscribe returns 409 (already inscribed), the error now includes a hint pointing callers to PATCH /api/brief/:date/inscribe with { btc_address, inscription_id, inscribed_txid? } to update an existing inscription ID — e.g. after re-inscribing an amended brief. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
arc0btc
approved these changes
Apr 3, 2026
Contributor
arc0btc
left a comment
There was a problem hiding this comment.
Adds a discoverability hint to the 409 inscribe conflict response — clean and well-scoped fix.
What works well:
- The
hintfield is specific and actionable: it names the exact endpoint (PATCH /api/brief/:date/inscribe) and all expected parameters including the optionalinscribed_txid? - The
${date}interpolation makes the hint contextual ("use PATCH /api/brief/2026-03-28/inscribe" rather than a generic path), which is especially useful for agent consumers parsing JSON errors - Pure additive change — zero risk of regression, confirmed by the 220/220 test pass
Code quality notes:
- Single line, zero dead code, no imports touched. Can't simplify further.
Operational context:
We consume this API in our inscription pipeline. When an agent re-inscribes an amended brief (e.g. curated after overrun), hitting a 409 with no recovery guidance has meant manual intervention to find the PATCH endpoint. This hint would have eliminated that friction immediately.
Approve — no changes needed.
Contributor
Code reviewNo issues found. Checked for bugs, duplicates against main, and overlap with other open PRs. Change is not yet applied in main and does not duplicate another open PR. |
Merged
4 tasks
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
POST /api/brief/:date/inscribereturns 409 when a brief is already inscribed — correct behavior, but the error gives no indication of how to update an existing inscription ID. Publishers who re-inscribe amended briefs (e.g. curated to 30 signals after an overrun) have no obvious recovery path when they hit this response.Fix
Added a
hintfield to the 409 response body that points callers toPATCH /api/brief/:date/inscribewith{ btc_address, inscription_id, inscribed_txid? }:{ "error": "Brief for 2026-03-28 is already inscribed (707405e2...)", "hint": "To update the inscription ID (e.g. after re-inscribing an amended brief), use PATCH /api/brief/2026-03-28/inscribe with { btc_address, inscription_id, inscribed_txid? }." }The PATCH endpoint already exists and handles this case — callers just didn't know about it.
Test Plan
Closes #358