fix: log sanitized caught errors #218

Merged
erik merged 1 commit from fix/task-b83fd986-log-caught-errors into main 2026-06-27 21:19:49 -05:00
Owner

Summary

  • Added a reusable logCaughtError helper for structured safe error logging with message, stack, route/action, status, and safe identity context.
  • Logged caught passkey registration failures before returning sanitized JSON responses.
  • Logged passkey authentication caught-error paths and uncaught API route exceptions before sanitized/error responses.
  • Added regression coverage for passkey registration failure logging without leaking credential payload fields.

Verification

  • npm exec --workspace @slugkit/template-site -- vitest run --config ./vitest.config.ts src/routes/tests/admin-passkeys.test.ts src/auth/tests/logging.test.ts
  • npm run typecheck --workspace @slugkit/template-site
  • npm run lint
  • ./scripts/pre-pr.sh

Task: #task-b83fd986

## Summary - Added a reusable `logCaughtError` helper for structured safe error logging with message, stack, route/action, status, and safe identity context. - Logged caught passkey registration failures before returning sanitized JSON responses. - Logged passkey authentication caught-error paths and uncaught API route exceptions before sanitized/error responses. - Added regression coverage for passkey registration failure logging without leaking credential payload fields. ## Verification - npm exec --workspace @slugkit/template-site -- vitest run --config ./vitest.config.ts src/routes/__tests__/admin-passkeys.test.ts src/auth/__tests__/logging.test.ts - npm run typecheck --workspace @slugkit/template-site - npm run lint - ./scripts/pre-pr.sh Task: #task-b83fd986
fix: log sanitized caught errors
All checks were successful
CI / build-lint-test (pull_request) Successful in 45s
04df866a80
Task: #task-b83fd986
Author
Owner

Review summary

Approved.

Acceptance criteria

  • Passkey registration failures emit useful server logs. Evidence: /settings/passkeys/register now calls logCaughtError with route, action, status, email, error message, and stack before returning the sanitized JSON response.
  • Other caught route/API errors are logged consistently. Evidence: passkey authentication options/verify caught-error paths use the same helper, and API middleware logs uncaught API route exceptions with method/path/status/duration before rethrowing.
  • Tests or documented verification cover at least one caught-error path. Evidence: admin-passkeys.test.ts now verifies passkey registration failure logs useful context and does not include credential payload strings.

Blocking issues

  • None.

Warnings

  • None.

Verification reviewed

  • ./scripts/pre-pr.sh passed locally.
  • Forgejo CI run #302 passed.

Final verdict

Approved. Ready for human merge approval.

### Review summary Approved. ### Acceptance criteria - [x] Passkey registration failures emit useful server logs. Evidence: `/settings/passkeys/register` now calls `logCaughtError` with route, action, status, email, error message, and stack before returning the sanitized JSON response. - [x] Other caught route/API errors are logged consistently. Evidence: passkey authentication options/verify caught-error paths use the same helper, and API middleware logs uncaught API route exceptions with method/path/status/duration before rethrowing. - [x] Tests or documented verification cover at least one caught-error path. Evidence: `admin-passkeys.test.ts` now verifies passkey registration failure logs useful context and does not include credential payload strings. ### Blocking issues - None. ### Warnings - None. ### Verification reviewed - `./scripts/pre-pr.sh` passed locally. - Forgejo CI run #302 passed. ### Final verdict Approved. Ready for human merge approval.
erik merged commit 859ed3c9ba into main 2026-06-27 21:19:49 -05:00
erik deleted branch fix/task-b83fd986-log-caught-errors 2026-06-27 21:19:49 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
erik/slugkit!218
No description provided.