fix(api): /auth/email/confirm-deletion JSON envelope (BUG-API-047/204/273)#194
Merged
Merged
Conversation
4e36b7a to
810c5a3
Compare
…/273)
The missing-token branch on /auth/email/confirm-deletion used to
`SendString("Missing token")` which served `Content-Type: text/plain`
with no envelope, no request_id, no agent_action — an envelope-bypass
that broke the universal {ok,error,message,request_id,agent_action}
contract every other 4xx in the api carries.
Agents grepping on `error: missing_token` (the canonical code already
used across onboarding.go, deletion_confirm.go:275, magic_link.go)
silently failed because this surface returned a plain string.
Route through respondError so the envelope shape + the existing
codeToAgentAction[missing_token] entry land here too.
The handler is browser-initiated (email-link click) but the response
shape must match the rest of the API for agent-driven probes (e.g. an
MCP tool unwrapping the JSON envelope before opening the dashboard).
Coverage block:
Symptom: /auth/email/confirm-deletion returns text/plain 400 with no
envelope (BUG-API-047, BUG-API-204, BUG-API-273)
Enumeration: rg -F 'SendString' internal/handlers/deletion_confirm.go (1 site)
rg -F 'confirm-deletion' internal/router/router.go (route bind)
Sites found: 1 (deletion_confirm.go:510 SendString)
Sites touched: 1
Coverage test: TestEmailConfirmDeletionRedirectHandler now asserts:
- status 400
- Content-Type application/json
- envelope.ok == false
- envelope.error == "missing_token"
- envelope.message non-empty
- envelope.agent_action non-empty (from codeToAgentAction)
so a future revert to SendString fails before merge.
Live verified: pending auto-deploy + curl -sI 'https://api.instanode.dev/auth/email/confirm-deletion' | grep -i content-type
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
810c5a3 to
48dcb43
Compare
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.
Summary
Coverage block
```
Symptom: /auth/email/confirm-deletion text/plain 400 (BUG-API-047/204/273)
Enumeration: rg -F 'SendString' internal/handlers/deletion_confirm.go (1 site)
rg -F 'confirm-deletion' internal/router/router.go (route bind)
Sites found: 1 (deletion_confirm.go:510)
Sites touched: 1
Coverage test: TestEmailConfirmDeletionRedirectHandler asserts status 400,
Content-Type application/json, envelope.ok=false,
envelope.error == 'missing_token', message + agent_action
non-empty.
Live verified: pending auto-deploy + curl -sI 'https://api.instanode.dev/auth/email/confirm-deletion' | grep -i content-type
```
Inbox reference
Test plan
🤖 Generated with Claude Code