Skip to content

fix(cms): improve health check with DB verification and add maintenance error page#417

Merged
hakalb merged 3 commits intomainfrom
cod-378-improve-health-check-and-add-maintenance-error-page
Apr 13, 2026
Merged

fix(cms): improve health check with DB verification and add maintenance error page#417
hakalb merged 3 commits intomainfrom
cod-378-improve-health-check-and-add-maintenance-error-page

Conversation

@hakalb
Copy link
Copy Markdown
Member

@hakalb hakalb commented Apr 13, 2026

Summary

  • Health check (/api/health) now verifies DB connectivity with SELECT 1 and returns 503 when unreachable, preventing Fly.io from routing traffic to machines with a broken DB
  • Added global-error.tsx maintenance page that renders without any providers or styles, shown when an unhandled error escapes the root layout
  • Added dev-only /test/error route for e2e verification of the error boundary
  • Extended e2e coverage: health check header assertions + maintenance page rendering

Closes COD-378

Test plan

  • nx e2e cms-e2e — health check and error page specs pass
  • Stop DB locally, verify /api/health returns 503
  • Navigate to /test/error in dev, verify maintenance page renders with logo and digest reference

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 13, 2026 18:32
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 13, 2026

View your CI Pipeline Execution ↗ for commit 6b651fb

Command Status Duration Result
nx affected -t e2e nx-payload-e2e -c skip-docker ✅ Succeeded 7m 13s View ↗
nx affected -t integration-test -c ci ✅ Succeeded <1s View ↗
nx affected -t e2e -c ci --exclude nx-payload-e2e ✅ Succeeded 7m 26s View ↗
nx affected -t lint,test,build -c ci ✅ Succeeded 9s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 8s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-13 19:28:17 UTC

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 13, 2026

View your CI Pipeline Execution ↗ for commit 6b651fb

Command Status Duration Result
nx-cloud record -- nx format:check ✅ Succeeded 8s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-13 19:12:29 UTC

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 13, 2026

View your CI Pipeline Execution ↗ for commit 1720481

Command Status Duration Result
nx-cloud record -- nx format:check ❌ Failed 9s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-13 18:34:01 UTC

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR strengthens the CMS operational safety and user experience by making the Fly.io health check validate database reachability and by adding a minimal global error boundary (“maintenance”) page plus e2e coverage to verify both behaviors.

Changes:

  • Update /api/health to run a DB connectivity probe (SELECT 1) and return 503 when unreachable.
  • Add a minimal global-error.tsx maintenance page (no providers/styles) and a dev-only /test/error route to trigger it.
  • Extend Playwright e2e tests for health headers and maintenance page rendering.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
libs/shared/util/payload-types/src/lib/payload-types.ts Regenerated/normalized Payload generated types formatting.
apps/cms/src/app/global-error.tsx Replaces Next default error UI with a minimal maintenance page.
apps/cms/src/app/api/health/route.ts Adds Payload init + DB query verification; returns 503 on failure.
apps/cms/src/app/(site)/test/error/page.tsx Dev-only route that throws to exercise the global error boundary.
apps/cms-e2e/src/site/error-page.spec.ts Adds e2e coverage for the global error boundary UI.
apps/cms-e2e/src/health.spec.ts Adds response header assertions for the health check endpoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/cms/src/app/global-error.tsx Outdated
Comment thread apps/cms-e2e/src/site/error-page.spec.ts Outdated
@hakalb hakalb force-pushed the cod-378-improve-health-check-and-add-maintenance-error-page branch from 1720481 to 04bbe55 Compare April 13, 2026 18:42
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hakalb hakalb force-pushed the cod-378-improve-health-check-and-add-maintenance-error-page branch from 04bbe55 to cb62df7 Compare April 13, 2026 18:48
@hakalb hakalb enabled auto-merge April 13, 2026 18:49
@codeware-actions
Copy link
Copy Markdown

✨ Your pull request project is ready for preview

Project App name Preview
cms (demo) cdwr-cms-pr-417-demo https://cdwr-cms-pr-417-demo.fly.dev

@hakalb hakalb added this pull request to the merge queue Apr 13, 2026
@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.56%. Comparing base (1e489aa) to head (6b651fb).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #417       +/-   ##
===========================================
- Coverage   64.04%   42.56%   -21.48%     
===========================================
  Files         199      124       -75     
  Lines        5270     1534     -3736     
  Branches      716      333      -383     
===========================================
- Hits         3375      653     -2722     
+ Misses       1856      838     -1018     
- Partials       39       43        +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Merged via the queue into main with commit 6d17f5a Apr 13, 2026
16 checks passed
@hakalb hakalb deleted the cod-378-improve-health-check-and-add-maintenance-error-page branch April 13, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants