Skip to content

docs: add missing 404 status rows for BeginRegistration and ChangePassword#157

Merged
veverkap merged 2 commits into
mainfrom
docs/fix-404-status-codes-passkey-changepassword-1b65871b363c2852
Apr 28, 2026
Merged

docs: add missing 404 status rows for BeginRegistration and ChangePassword#157
veverkap merged 2 commits into
mainfrom
docs/fix-404-status-codes-passkey-changepassword-1b65871b363c2852

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

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

What changed

Two recent code fixes (commit 6864a5dc) mapped auth.ErrNotFound to HTTP 404 in two handlers that previously only returned 500 for all store errors. The HTTP status code tables in the reference docs were not updated to reflect these new 404 paths.

docs/handler/passkeys.mdBeginRegistration

  • Added BeginRegistration | 404 Not Found | User not found row
  • Updated the 500 row condition to remove "Failed to fetch user" (a non-ErrNotFound fetch error is now the only remaining 500 path for that operation)

docs/handler/auth.mdChangePassword

  • Added ChangePassword | 404 Not Found | User not found row

docs/handler/auth.mdLogout session-tracking description

A separate fix (commit a0c3d033) changed Logout to emit a slog.WarnContext when DeleteSession returns an unexpected error, and to silently ignore ErrNotFound (session already expired or revoked). The HTTP response is always 200 OK, but operators monitoring logs should know when to expect this warning. Updated the bullet point in the "Session tracking and refresh token rotation" section.

Why these are important

Incorrect HTTP status tables lead developers to write overly broad error handlers (e.g., retrying on 404 instead of surfacing "user not found") and produce misleading observability dashboards. These gaps are documentation bugs equivalent to failing tests.

Testing

Documentation-only change; no code was modified. Verified against the implementation in handler/passkey.go and handler/auth.go.

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 · ● 1.1M ·

To install this agentic workflow, run

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

Greptile Summary

This documentation-only PR adds missing HTTP 404 status rows for BeginRegistration and ChangePassword, and clarifies Logout session-deletion logging behaviour. All three changes have been verified against the corresponding implementation in handler/passkey.go and handler/auth.go and are accurate.

Confidence Score: 5/5

Documentation-only PR with all changes verified against the implementation — safe to merge.

No code changes; all three documentation updates accurately reflect the existing handler logic confirmed by direct code inspection.

No files require special attention.

Important Files Changed

Filename Overview
docs/handler/auth.md Adds accurate 404 row for ChangePassword and correctly documents the WarnContext/silent-ignore behaviour for Logout session deletion.
docs/handler/passkeys.md Adds accurate 404 row for BeginRegistration and narrows the 500 description to only non-ErrNotFound fetch errors, matching the implementation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[BeginRegistration] --> B{WebAuthn nil?}
    B -->|Yes| C[503 Service Unavailable]
    B -->|No| D{name empty or >100 chars?}
    D -->|Yes| E[400 Bad Request]
    D -->|No| F[FindByID]
    F -->|ErrNotFound| G[404 Not Found]
    F -->|Other error| H[500 Internal Server Error]
    F -->|OK| I[ListCredentialsByUser]
    I -->|Error| H
    I -->|OK| J[WebAuthn.BeginRegistration]
    J -->|Error| H
    J -->|OK| K[StoreChallenge]
    K -->|Error| H
    K -->|OK| L[200 OK]

    M[ChangePassword] --> N{Missing fields?}
    N -->|Yes| O[400 Bad Request]
    N -->|No| P[FindByID]
    P -->|ErrNotFound| Q[404 Not Found]
    P -->|Other error| R[500 Internal Server Error]
    P -->|OK| S{Wrong password?}
    S -->|Yes| T[401 Unauthorized]
    S -->|No| U[UpdatePassword]
    U -->|Error| R
    U -->|OK| V[200 OK]

    W[Logout] --> X[DeleteSession]
    X -->|ErrNotFound| Y[silently ignored → 200 OK]
    X -->|Other error| Z[slog.WarnContext → 200 OK]
    X -->|OK| AA[200 OK]
Loading

Reviews (2): Last reviewed commit: "docs: qualify ErrNotFound as auth.ErrNot..." | Re-trigger Greptile

…dling docs

handler/passkey.go (commit 6864a5d) now returns HTTP 404 when the
authenticated user is not found in BeginRegistration, instead of 500.
Update docs/handler/passkeys.md to:
- Add BeginRegistration | 404 Not Found | User not found
- Narrow BeginRegistration 500 condition to exclude the user-not-found case

handler/auth.go (commit 6864a5d) now returns HTTP 404 when the
authenticated user is not found in ChangePassword, instead of 500.
Update docs/handler/auth.md to:
- Add ChangePassword | 404 Not Found | User not found

handler/auth.go (commit a0c3d03) changed Logout to log a warning via
slog when session deletion fails with an unexpected error, and silently
ignore ErrNotFound. Update the session-tracking section to document this
operational behavior.

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 28, 2026
@veverkap veverkap marked this pull request as ready for review April 28, 2026 18:59
@veverkap veverkap requested review from a team and Copilot April 28, 2026 18:59
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

Updates handler reference documentation to reflect recently added 404 Not Found responses and to clarify Logout session-deletion logging behavior, keeping the published HTTP status tables aligned with current handler implementations.

Changes:

  • Add a BeginRegistration | 404 Not Found | User not found row and refine the 500 condition wording in docs/handler/passkeys.md.
  • Add a ChangePassword | 404 Not Found | User not found row in docs/handler/auth.md.
  • Expand the Logout session-tracking description to mention ignoring ErrNotFound and logging unexpected deletion errors via slog while still returning HTTP 200.
Show a summary per file
File Description
docs/handler/passkeys.md Adds missing 404 row for BeginRegistration and updates 500-row condition text.
docs/handler/auth.md Adds missing 404 row for ChangePassword and clarifies Logout session-deletion behavior in the session-tracking section.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread docs/handler/auth.md Outdated
@veverkap veverkap merged commit 8163804 into main Apr 28, 2026
7 checks passed
@veverkap veverkap deleted the docs/fix-404-status-codes-passkey-changepassword-1b65871b363c2852 branch April 28, 2026 19:24
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