Skip to content

feat(debugging): add developer debugging toolkit#659

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
distributed-nerd:feat/enhanced-debugging
May 27, 2026
Merged

feat(debugging): add developer debugging toolkit#659
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
distributed-nerd:feat/enhanced-debugging

Conversation

@distributed-nerd
Copy link
Copy Markdown

@distributed-nerd distributed-nerd commented May 27, 2026

Summary

Adds an in-process developer debugging toolkit (new module src/debugging/) covering all acceptance criteria of the issue.

Acceptance criterion Implementation
Request/response inspection DebugCaptureMiddleware records every exchange into a bounded in-memory ring buffer (RequestCaptureService) with sensitive-header redaction and body truncation. GET /debug/requests, GET /debug/requests/:id
Request replay RequestReplayService re-issues a captured request against the running instance (or a custom baseUrl), supports header/body overrides for replacing redacted credentials, and diffs the response status. POST /debug/requests/:id/replay
Performance timeline TimelineRecorder captures per-phase spans with high-resolution timing; PerformanceTimelineService.hotspots() surfaces the slowest phases. GET /debug/requests/:id/timeline
Stack trace enhancement StackTraceService parses raw V8 stacks into structured frames, flags application vs node_module/internal frames, and follows the error cause chain. GET /debug/requests/:id/trace

Notes

  • Capture middleware mounts only outside production (or when DEBUG_CAPTURE=true) and excludes /debug/* to avoid recursion.
  • All endpoints are admin-only (JwtAuthGuard + RolesGuard, UserRole.ADMIN).
  • DebuggingModule is wired into AppModule. See src/debugging/README.md for details.

Closes #652

Implements an in-process debugging toolkit for developers:

- Request/response inspection: DebugCaptureMiddleware records every
  exchange into a bounded in-memory ring buffer with header redaction
  and body truncation; exposed via GET /debug/requests[/:id].
- Request replay: RequestReplayService re-issues a captured request
  against the running instance (or a custom base URL) and diffs the
  response status; POST /debug/requests/:id/replay with header/body
  overrides for replacing redacted credentials.
- Performance timeline: TimelineRecorder captures per-phase spans with
  high-resolution timing; PerformanceTimelineService surfaces slowest
  hotspots; GET /debug/requests/:id/timeline.
- Stack trace enhancement: StackTraceService parses raw V8 stacks into
  structured frames, flags application vs node_module/internal frames,
  follows the error cause chain; GET /debug/requests/:id/trace.

Capture middleware mounts only outside production (or DEBUG_CAPTURE=true)
and excludes /debug/* to avoid recursion. Endpoints are admin-only.
Wires DebuggingModule into AppModule.
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@distributed-nerd Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER
Copy link
Copy Markdown
Contributor

Kindly fix workflow

@RUKAYAT-CODER RUKAYAT-CODER merged commit 508d9c4 into rinafcode:main May 27, 2026
5 of 11 checks passed
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.

Add advanced debugging capabilities

3 participants