jsonresume.org icon indicating copy to clipboard operation
jsonresume.org copied to clipboard

Fixes issue #210 in a better solution

Open a-y-a-n-das opened this issue 2 months ago • 3 comments

Pull Request

Description

This PR implements a comprehensive solution for Issue #210. While a previous PR attempted a partial fix, this update fully addresses the problem. The previous implementation only partially addressed the problem, while this update ensures that:

All existing GitHub issues are checked across all pages. Duplicate issues are correctly avoided. New errors from Sentry are reliably reported as GitHub issues.

Related Issues

Closes # Relates to #210

Changes Made

  • [x] Added configuration for Sentry to capture runtime and build-time errors automatically and send them to the Sentry dashboard.
  • [x] Added duplicate detection to prevent creating the same issue twice.
  • [x] Set up environment variables and ensured they’re read dynamically (no hardcoding).
  • [x] Configured the GitHub Action to fetch and process Sentry issues into GitHub.
  • [x] Added a test-error.js endpoint to simulate runtime errors for validation.

Note: Please update the current error-catching lines to use Sentry’s error handling methods.

Type of Change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Refactoring (code improvement without changing functionality)
  • [ ] Documentation update
  • [ ] Performance improvement
  • [ ] Test coverage improvement
  • [x] Dependency update

Testing

  • [ ] Unit tests added/updated
  • [ ] Integration tests added/updated
  • [ ] E2E tests added/updated
  • [x] Manual testing completed

Test Details:

Quality Checklist

  • [x] All tests passing locally (pnpm test)
  • [x] No ESLint errors (pnpm lint)
  • [x] Code formatted with Prettier (pnpm prettier)
  • [x] All files ≤150 lines (verify with: find . -name "*.ts" -o -name "*.tsx" -o -name "*.js" | xargs wc -l | awk '$1 > 150')
  • [x] Test coverage maintained or improved
  • [ ] No new security vulnerabilities (pnpm audit)
  • [ ] Documentation updated (if needed)
  • [x] TypeScript types are proper (no any unless absolutely necessary)

Performance Impact

  • [x] No performance impact
  • [ ] Performance improved
  • [ ] Potential performance impact (explain below)

Details:

Breaking Changes

  • [x] No breaking changes
  • [ ] Breaking changes (describe below)

Details:

Screenshots/Demos

Additional Notes


For Reviewers:

  • Does this PR follow the contribution guidelines?
  • Are all quality checks passing?
  • Is the code well-tested and documented?
  • Are there any security concerns?

Summary by CodeRabbit

  • New Features

    • Enabled error monitoring and reporting for better production visibility.
    • Added a test API endpoint to trigger and validate error reporting (returns a safe 500 response).
  • Chores

    • Added runtime dependencies and a global environment variable required for monitoring.
    • Added an automated workflow to regularly sync unresolved monitoring issues into GitHub for streamlined triage.

a-y-a-n-das avatar Oct 07 '25 05:10 a-y-a-n-das

⚠️ No Changeset found

Latest commit: 0185eacd46caa93e4b7fe15309b97051d1d3cf37

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Oct 07 '25 05:10 changeset-bot[bot]

@a-y-a-n-das is attempting to deploy a commit to the JSON Resume Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 07 '25 05:10 vercel[bot]

[!IMPORTANT]

Review skipped

Review was skipped due to path filters

:no_entry: Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds Sentry initialization and a test API route, a script to sync unresolved Sentry issues to GitHub, a GitHub Actions workflow to run that script, new runtime deps (@sentry/node, node-fetch), and exposes SENTRY_DSN in turbo.json.

Changes

Cohort / File(s) Summary
Sentry integration (app)
apps/homepage2/sentry.js, apps/homepage2/pages/api/test-error.js, turbo.json
Initialize @sentry/node with DSN and environment at import; export Sentry; add /api/test-error route that throws, captures and flushes the error to Sentry and responds 500; add SENTRY_DSN to turbo.json globalEnv.
GitHub Actions workflow
.github/workflows/fetch-issue.yml
New fetch-issue-sentry workflow triggered on pushes to sentry-to-github-issue branch, hourly cron, and manual dispatch; sets up Node 20 and pnpm, installs deps, and runs node scripts/sentry-to-github.js with secrets for Sentry and GitHub.
Sentry↔GitHub sync script
scripts/sentry-to-github.js
New script using node-fetch to GET unresolved Sentry issues (recent), check repo open GitHub issues for matching titles, and POST new GitHub issues for missing ones; logs progress and errors.
Dependency updates
package.json
Add runtime dependencies @sentry/node and node-fetch; add pnpm override for node-fetch; move eslint into devDependencies (reordering).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant API as /api/test-error
  participant Sentry
  Client->>API: GET /api/test-error
  API->>API: throw error
  API->>Sentry: captureException(err)
  API->>Sentry: flush(timeout=2000ms)
  API-->>Client: 500 { sent: true }
sequenceDiagram
  autonumber
  participant Trigger as Scheduler/Push/Manual
  participant GA as GitHub Actions
  participant Script as sentry-to-github.js
  participant SentryAPI as Sentry API
  participant GHAPI as GitHub API

  Trigger->>GA: start fetch-issue-sentry
  GA->>Script: run Node (env: SENTRY_*, GITHUB_*, MY_GITHUB_REPO)
  Script->>SentryAPI: GET unresolved issues (recent)
  SentryAPI-->>Script: issues[]
  loop per issue
    Script->>GHAPI: GET open issues (filter/title)
    GHAPI-->>Script: openIssues[]
    alt no matching title
      Script->>GHAPI: POST create issue (title, body with link/metadata)
      GHAPI-->>Script: createdIssue
    else exists
      Script->>Script: skip
    end
  end
  Script-->>GA: exit (logs)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I thump my paw—alerts set free,
From burrow logs to Sentry’s tree.
Bugs hop over to GitHub's gate,
Pipelines munch and celebrate.
A carrot cheer for each deploy spree. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title only references issue #210 and uses the vague phrase “in a better solution” without summarizing the primary changes such as adding Sentry integration, workflows, and duplicate-detection logic for GitHub issues. It fails to convey what was actually implemented or fixed, making it difficult for reviewers to understand the scope at a glance. Consider rewriting the title to clearly describe the core change in a concise sentence, for example “Integrate Sentry error reporting and GitHub issue creation to resolve #210.”
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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 and usage tips.

coderabbitai[bot] avatar Oct 07 '25 05:10 coderabbitai[bot]