Skip to content

fix(ci): postgres-shaped dummy DATABASE_URL for the build step - #80

Merged
remcostoeten merged 1 commit into
masterfrom
fix/build-db-lazy-init
Jul 20, 2026
Merged

fix(ci): postgres-shaped dummy DATABASE_URL for the build step#80
remcostoeten merged 1 commit into
masterfrom
fix/build-db-lazy-init

Conversation

@remcostoeten

@remcostoeten remcostoeten commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

CI has failed on master for weeks: https://example.com satisfies the zod .url() env check but neon() rejects a non-postgres connection string when src/server/db/connection.ts is imported during Next's page-data collection (/api/activity/combined). Use a well-formed dummy postgres URL — neon only parses it at import; nothing connects during build.

Test plan

  • bun run build with the workflow's exact env — lint, typecheck, tests, and build all pass (30.8s).

Summary by Sourcery

Build:

  • Update CI workflow environment to use a postgres-formatted DATABASE_URL instead of a generic HTTPS URL.

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
remcostoeten Ready Ready Preview Jul 20, 2026 12:42pm

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

Next review available in: 2 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

Run ID: 631e5c6f-ac28-4d71-98e9-4ef6a5c607fe

📥 Commits

Reviewing files that changed from the base of the PR and between 864ae7e and b3c7c96.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/build-db-lazy-init

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.

@sourcery-ai

sourcery-ai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The CI workflow’s quality job now uses a syntactically valid Postgres connection string for DATABASE_URL so that Neon’s client initialization succeeds during the Next.js build/page-data collection step without making any real database connections.

Sequence diagram for CI build using dummy postgres DATABASE_URL

sequenceDiagram
    participant GitHubActions
    participant quality_job
    participant Next_build as NextBuild
    participant neon_client as neon

    GitHubActions->>quality_job: start quality job
    quality_job->>quality_job: set env DATABASE_URL=postgresql://ci:ci@localhost:5432/ci
    quality_job->>Next_build: bun run build
    Next_build->>neon_client: import connection.ts (neon(DATABASE_URL))
    neon_client-->>Next_build: parse postgres URL (no connection)
    Next_build-->>quality_job: build succeeds
Loading

File-Level Changes

Change Details Files
Update CI workflow environment to use a dummy but well-formed Postgres DATABASE_URL so Neon’s initialization passes during build.
  • Replace the previous placeholder HTTPS URL with a Postgres-style connection URI containing dummy credentials, host, port, and database name.
  • Ensure the new DATABASE_URL remains non-functional for real connections while satisfying both zod’s .url() validation and Neon’s Postgres URL parsing during import.
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider using a clearly non-routable host (e.g. postgresql://ci:ci@127.254.0.1:5432/ci) or an invalid port to ensure this dummy DATABASE_URL can never inadvertently connect if future changes start opening connections during CI.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider using a clearly non-routable host (e.g. `postgresql://ci:ci@127.254.0.1:5432/ci`) or an invalid port to ensure this dummy DATABASE_URL can never inadvertently connect if future changes start opening connections during CI.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@remcostoeten
remcostoeten merged commit 1559c4a into master Jul 20, 2026
4 checks passed
@remcostoeten
remcostoeten deleted the fix/build-db-lazy-init branch July 20, 2026 12:43
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