Skip to content

feat(frontend): add App Router error boundaries and diagnostic error handling - #483

Open
samueldoo wants to merge 4 commits into
Stellar-Ecosystem:mainfrom
samueldoo:376-frontend-error-boundary
Open

feat(frontend): add App Router error boundaries and diagnostic error handling#483
samueldoo wants to merge 4 commits into
Stellar-Ecosystem:mainfrom
samueldoo:376-frontend-error-boundary

Conversation

@samueldoo

Copy link
Copy Markdown

Closes #376

Summary

This PR adds error boundaries across the Next.js App Router tree in frontend/app/ to prevent blank screens or unstyled default error screens when contract reads, RPC requests, or component renders fail.

Key Changes

  1. Root Error Boundary (app/error.tsx):

    • Displays a branded error card styled with Lodestar's design system tokens (background #FAFAF7, error badges, card styling).
    • Shows user-friendly message and diagnostic code/digest output for debugging.
    • Provides a "Try again" action calling Next.js reset() to re-attempt rendering/fetches.
    • Logs errors to console.error for diagnostic monitoring.
  2. Route-Level Error Boundaries:

    • app/registry/error.tsx: Tailored for Soroban contract read failures on the service registry.
    • app/agents/error.tsx: Tailored for agent credit score fetch failures.
    • app/services/error.tsx: Tailored for service details fetch failures.
    • app/global-error.tsx: Handles root layout shell failures.
  3. Unit Tests (__tests__/ErrorBoundaries.test.tsx):

    • Added tests verifying all error boundary components render branded UI, report errors to console.error, and invoke reset() on retry.

Verification

  • npx next build — compiled all 11 routes cleanly.
  • npx jest — all 17 test suites (49 total tests) passed.

- Add comprehensive OpenAPI 3.1 spec covering all routes in registry.js, agents.js, services.js, and demo.js
- Serve OpenAPI spec at /openapi.json endpoint
- Add contract tests to validate API responses against OpenAPI spec
- Install @apidevtools/swagger-parser for spec validation
- Document all request/response schemas with proper types and validation
- Add url-validator.js with comprehensive URL validation
- Block non-HTTPS endpoints
- Block private, loopback, and link-local IP addresses (IPv4 and IPv6)
- Resolve DNS and block endpoints that resolve to private IPs
- Add configurable ALLOWED_ENDPOINTS allowlist for local development
- Validate redirects to prevent SSRF via redirect chains
- Integrate validation into agent.js HTTP client
- Add comprehensive test suite covering SSRF attack scenarios
- Tests cover AWS metadata service, localhost, and DNS rebinding attacks
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@samueldoo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b3d2b66d-7d3f-4685-97e0-dd76f62eb110

📥 Commits

Reviewing files that changed from the base of the PR and between a3fd824 and eadea59.

⛔ Files ignored due to path filters (1)
  • backend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (15)
  • agent/README.md
  • agent/agent.js
  • agent/agent.test.js
  • agent/url-validator.js
  • agent/url-validator.test.js
  • backend/openapi.json
  • backend/package.json
  • backend/src/index.js
  • backend/test/openapi.test.js
  • frontend/__tests__/ErrorBoundaries.test.tsx
  • frontend/app/agents/error.tsx
  • frontend/app/error.tsx
  • frontend/app/global-error.tsx
  • frontend/app/registry/error.tsx
  • frontend/app/services/error.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@samueldoo 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

@ritik4ever

Copy link
Copy Markdown
Collaborator

Hi @samueldoo,

This PR could not be merged because it has merge conflicts with the target branch.

Please resolve the merge conflicts, push the updated changes, and the PR can be reviewed and merged.

Thank you!

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.

Frontend: no error.tsx error boundaries in the App Router

2 participants