Skip to content

docs: add AuthResponse struct definition and document MagicLinkSender type#72

Merged
veverkap merged 2 commits into
mainfrom
docs/add-auth-response-struct-and-magic-link-sender-type-4501669b4f2cc69f
Apr 24, 2026
Merged

docs: add AuthResponse struct definition and document MagicLinkSender type#72
veverkap merged 2 commits into
mainfrom
docs/add-auth-response-struct-and-magic-link-sender-type-4501669b4f2cc69f

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Apr 23, 2026

Two small documentation gaps surfaced during a post-push documentation audit:

Changes

1. Add handler.AuthResponse struct definition

AuthResponse is an exported type that is the primary response body for Signup, Login, RefreshToken, VerifyMagicLink, and FinishAuthentication. Previously it was only described in prose ("containing token, refresh_token...") without a Go struct block. UserDTO was already shown as a Go struct definition in the same section — AuthResponse deserves the same treatment so that:

  • Frontend/client developers can see the exact JSON field names (token, refresh_token, user) and know that refresh_token is omitted (not null) when Sessions is not configured.
  • Contributors writing custom handlers or tests can use the exported type directly without looking at source.

2. Document handler.MagicLinkSender type and nil Sender behaviour

The MagicLinkHandler.Sender field 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 nil Sender, but there was no prose near the struct example that drew attention to this "must be set" requirement — unlike EmailVerificationHandler.SendEmail which is explicitly noted as a no-op when nil. The new sentence:

  • Names the exported MagicLinkSender type for discoverability.
  • Reinforces that a nil Sender is not a "test-mode no-op" (it's an error) and that the token is already stored at that point (aligning with the error table note).

Verification

Both changes are documentation only (no code changes). Accuracy was verified against:

  • handler/auth.goAuthResponse struct definition (lines 67–73)
  • handler/magiclink.goMagicLinkSender type (line 19), nil-Sender 503 path (lines 73–76)

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • proxy.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"

See Network Configuration for more information.

Generated by Update Docs · ● 2.8M ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/update-docs.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

Greptile Summary

This documentation-only PR adds a Go struct block for AuthResponse in the auth Response types section and documents the MagicLinkSender type along with the nil-Sender 503 behaviour. Both changes have been verified against the source (handler/auth.go lines 67–71, handler/magiclink.go lines 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

Filename Overview
README.md Adds AuthResponse struct block and MagicLinkSender documentation; both are accurate against the source code in handler/auth.go and handler/magiclink.go

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}
Loading

Reviews (2): Last reviewed commit: "docs: warn that nil Sender accumulates u..." | Re-trigger Greptile

… 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>
@github-actions github-actions Bot added automation documentation Improvements or additions to documentation labels Apr 23, 2026
@veverkap veverkap marked this pull request as ready for review April 23, 2026 21:23
@veverkap veverkap requested review from a team and Copilot April 23, 2026 21:23
Comment thread README.md Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AuthResponse struct definition (including JSON field names and omitempty behavior for refresh_token).
  • Documented the exported handler.MagicLinkSender type and clarified that a nil Sender causes RequestMagicLink to 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

@veverkap veverkap merged commit 4724a76 into main Apr 24, 2026
14 checks passed
@veverkap veverkap deleted the docs/add-auth-response-struct-and-magic-link-sender-type-4501669b4f2cc69f branch April 24, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants