docs: add AuthResponse struct definition and document MagicLinkSender type#72
Merged
veverkap merged 2 commits intoApr 24, 2026
Conversation
… type - Add handler.AuthResponse struct definition to the AuthHandler Response types section, showing the exported Go struct with json tags. Previously only described in prose; now matches the treatment of UserDTO which is also shown as a struct block in the same section. - Add a note under MagicLinkHandler documenting that the Sender field is of the exported handler.MagicLinkSender type and that nil causes a 503 Service Unavailable (not silent no-op) once the token is persisted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Closes documentation gaps in the handler package README by adding concrete Go type definitions and clarifying the expected configuration for magic-link delivery, improving discoverability and accuracy for client authors and contributors.
Changes:
- Added a Go
AuthResponsestruct definition (including JSON field names andomitemptybehavior forrefresh_token). - Documented the exported
handler.MagicLinkSendertype and clarified that anilSendercausesRequestMagicLinkto fail with 503 after persisting the token.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds AuthResponse struct block and documents MagicLinkSender/nil-Sender behavior in MagicLinkHandler docs. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
…o-op Sender in tests
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.
Two small documentation gaps surfaced during a post-push documentation audit:
Changes
1. Add
handler.AuthResponsestruct definitionAuthResponseis an exported type that is the primary response body forSignup,Login,RefreshToken,VerifyMagicLink, andFinishAuthentication. Previously it was only described in prose ("containingtoken,refresh_token...") without a Go struct block.UserDTOwas already shown as a Go struct definition in the same section —AuthResponsedeserves the same treatment so that:token,refresh_token,user) and know thatrefresh_tokenis omitted (not null) when Sessions is not configured.2. Document
handler.MagicLinkSendertype andnilSender behaviourThe
MagicLinkHandler.Senderfield has an exported named type (handler.MagicLinkSender) that wasn't mentioned by name in the docs. Also, the existing error-response table already documented the 503 behaviour for a nilSender, but there was no prose near the struct example that drew attention to this "must be set" requirement — unlikeEmailVerificationHandler.SendEmailwhich is explicitly noted as a no-op when nil. The new sentence:MagicLinkSendertype for discoverability.Verification
Both changes are documentation only (no code changes). Accuracy was verified against:
handler/auth.go—AuthResponsestruct definition (lines 67–73)handler/magiclink.go—MagicLinkSendertype (line 19), nil-Sender 503 path (lines 73–76)Warning
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.
Greptile Summary
This documentation-only PR adds a Go struct block for
AuthResponsein the auth Response types section and documents theMagicLinkSendertype along with the nil-Sender 503 behaviour. Both changes have been verified against the source (handler/auth.golines 67–71,handler/magiclink.golines 19 and 73–76) and are accurate.Confidence Score: 5/5
Documentation-only change with no code modifications; safe to merge.
All changes are prose and code-block additions to README.md that accurately reflect the live source. No P0 or P1 findings; the nil-Sender orphaned-token concern was already captured in a previous review thread and is now addressed in the docs.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client participant RequestMagicLink participant MagicLinkStore participant MagicLinkSender Client->>RequestMagicLink: POST /auth/magic-link/request {email} RequestMagicLink->>MagicLinkStore: CreateMagicLink(email, tokenHash, expiresAt) MagicLinkStore-->>RequestMagicLink: ok alt Sender is nil RequestMagicLink-->>Client: 503 Service Unavailable (token persisted, unconsumed) else Sender configured RequestMagicLink->>MagicLinkSender: func(ctx, email, token) error MagicLinkSender-->>RequestMagicLink: nil or error (swallowed) RequestMagicLink-->>Client: 200 message response end Client->>RequestMagicLink: GET /auth/magic-link/verify with query param RequestMagicLink-->>Client: 200 AuthResponse {token, refresh_token?, user}Reviews (2): Last reviewed commit: "docs: warn that nil Sender accumulates u..." | Re-trigger Greptile