Skip to content

feat(log): Add wrapper function for standardized logging#4061

Merged
TheodoreSpeaks merged 11 commits intostagingfrom
log/add-centralized-error-reporting
Apr 21, 2026
Merged

feat(log): Add wrapper function for standardized logging#4061
TheodoreSpeaks merged 11 commits intostagingfrom
log/add-centralized-error-reporting

Conversation

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator

@TheodoreSpeaks TheodoreSpeaks commented Apr 8, 2026

Summary

We have no centralized entry for our routes, making it hard to trace failing requests. Added request metadata for generating request id and returning a standardized output showing status code, path, and route.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • Tested locally, validated endpoints are being called.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Apr 21, 2026 4:57pm

Request Review

…d-error-reporting

# Conflicts:
#	apps/sim/app/api/organizations/[id]/invitations/[invitationId]/route.ts
#	apps/sim/app/api/workspaces/invitations/[invitationId]/route.ts
@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator Author

@BugBot review

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 21, 2026

PR Summary

Medium Risk
Touches a large number of API endpoints to change their exported handler shape and wrap execution in centralized logging/error handling; mistakes could affect response headers/status propagation or route behavior across auth/billing/chat/copilot paths.

Overview
Adds a centralized withRouteHandler wrapper that creates a request-scoped context (requestId/method/path), auto-attaches x-request-id, logs 4xx/5xx responses, and catches unhandled errors with a consistent 500 payload.

Updates many Next.js API routes (A2A, auth, billing, chat, copilot, academy, admin, audit-logs) to export export const METHOD = withRouteHandler(...) instead of bare async function METHOD, aligning them with the new request tracing/logging pattern. Documentation/guidelines are updated accordingly, and auth route tests extend the @sim/logger mock to include request-context helpers.

Reviewed by Cursor Bugbot for commit 11ab6c8. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 08213aa. Configure here.

@TheodoreSpeaks TheodoreSpeaks marked this pull request as ready for review April 21, 2026 04:56
TheodoreSpeaks and others added 2 commits April 21, 2026 09:44
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…d-error-reporting

# Conflicts:
#	apps/sim/app/api/workspaces/[id]/data-retention/route.ts
@TheodoreSpeaks TheodoreSpeaks merged commit 699bbfd into staging Apr 21, 2026
14 checks passed
@TheodoreSpeaks TheodoreSpeaks deleted the log/add-centralized-error-reporting branch April 21, 2026 17:21
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