Skip to content

fix(api): /auth/email/confirm-deletion JSON envelope (BUG-API-047/204/273)#194

Merged
mastermanas805 merged 1 commit into
masterfrom
bug-api-204-confirm-deletion-envelope
May 30, 2026
Merged

fix(api): /auth/email/confirm-deletion JSON envelope (BUG-API-047/204/273)#194
mastermanas805 merged 1 commit into
masterfrom
bug-api-204-confirm-deletion-envelope

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

Summary

  • /auth/email/confirm-deletion missing-token branch used to `SendString("Missing token")` — `Content-Type: text/plain`, no envelope, no request_id, no agent_action. Envelope-bypass that broke the universal {ok,error,message,request_id,agent_action} contract.
  • 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.

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

  • BUG-API-047 (P2 — /auth/email/confirm-deletion text/plain 400 envelope bypass)
  • BUG-API-204 (P3 — confirm_del with_token 400 text/plain envelope bypass)
  • BUG-API-273 (P2 — confirm_del get text/plain 400 envelope bypass duplicate)

Test plan

🤖 Generated with Claude Code

@mastermanas805 mastermanas805 force-pushed the bug-api-204-confirm-deletion-envelope branch from 4e36b7a to 810c5a3 Compare May 30, 2026 08:50
…/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>
@mastermanas805 mastermanas805 force-pushed the bug-api-204-confirm-deletion-envelope branch from 810c5a3 to 48dcb43 Compare May 30, 2026 09:07
@mastermanas805 mastermanas805 merged commit 84d0e47 into master May 30, 2026
14 checks passed
@mastermanas805 mastermanas805 deleted the bug-api-204-confirm-deletion-envelope branch May 30, 2026 09:25
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