Skip to content

Conversation

aidankmcalister
Copy link
Member

@aidankmcalister aidankmcalister commented Oct 9, 2025

Summary by CodeRabbit

  • New Features

    • Database creation requests now include a client user agent header for improved request context. No change to user-facing behavior.
    • Standardized attribution by always using the CLI name for utm_source during database creation.
  • Chores

    • Added a YAML configuration for localization, review workflow, and chat preferences. No impact on product functionality.

Copy link

coderabbitai bot commented Oct 9, 2025

Walkthrough

Adds a new .coderabbit.yaml configuration file. Updates create-db client to send a new userAgent field and fixes utm_source to always use CLI_NAME. Updates the create-db worker to read userAgent from the request body, log it, and forward it as a User-Agent header to Prisma.

Changes

Cohort / File(s) Change summary
Configuration
\.coderabbit.yaml
Introduces YAML config for localization, review workflow, and chat preferences; no code changes.
Create DB client
create-db/index.js
Payload now includes userAgent; utm_source set to CLI_NAME unconditionally.
Create DB worker
create-db-worker/src/index.ts
Extracts userAgent from request body, logs it, and forwards it via User-Agent header to Prisma API.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • feat: --source flag added #45 — Also adjusts the create-db flow to add/propagate a userAgent/utm_source value across client and request payloads.

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the primary change of this pull request—sending the user agent to the management API—and directly reflects the modifications made in both the worker and CLI layers. It is clear, concise, and free of extraneous details, making it easy for collaborators to understand the core update at a glance.

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

Copy link

cloudflare-workers-and-pages bot commented Oct 9, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
claim-db-worker 188bba4 Commit Preview URL

Branch Preview URL
Oct 09 2025, 03:38 PM

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
create-db-worker/src/index.ts (2)

112-112: Consider structured logging instead of console.log.

The console.log statement is functional for debugging, but consider whether this should use a structured logging approach for production environments, especially if you need to correlate or filter these logs.


118-118: Consider omitting the User-Agent header when userAgent is falsy.

Setting the User-Agent header to an empty string when userAgent is undefined or null may not be ideal. Consider conditionally including the header only when a valid value exists.

Apply this diff to conditionally include the User-Agent header:

-			headers: {
-				'Content-Type': 'application/json',
-				Authorization: `Bearer ${env.INTEGRATION_TOKEN}`,
-				'User-Agent': userAgent || '',
-			},
+			headers: {
+				'Content-Type': 'application/json',
+				Authorization: `Bearer ${env.INTEGRATION_TOKEN}`,
+				...(userAgent && { 'User-Agent': userAgent }),
+			},
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1163d1f and 188bba4.

📒 Files selected for processing (3)
  • .coderabbit.yaml (1 hunks)
  • create-db-worker/src/index.ts (2 hunks)
  • create-db/index.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
create-db-worker/src/index.ts (1)
create-db/index.js (7)
  • region (246-246)
  • region (264-264)
  • region (283-283)
  • region (399-404)
  • region (657-657)
  • name (656-656)
  • userAgent (629-629)
🔇 Additional comments (2)
create-db/index.js (1)

434-435: LGTM! Coordinated change for user agent tracking.

The addition of the userAgent field and the standardization of utm_source to always use CLI_NAME aligns with the worker implementation in create-db-worker/src/index.ts. This ensures consistent tracking and identification data in the create-service requests.

.coderabbit.yaml (1)

1-23: LGTM! Valid CodeRabbit configuration.

The configuration file is well-formed and all settings are valid according to the CodeRabbit schema. The choices reflect a focused review workflow with minimal distractions (poem, fortune, and art disabled) while maintaining essential features like auto-review and request changes workflow.

@aidankmcalister aidankmcalister merged commit 2863300 into main Oct 9, 2025
2 of 3 checks passed
Copy link

github-actions bot commented Oct 9, 2025

Preview CLIs & Workers are live!

Test the CLIs locally under tag pr60-user-agent-sent-to-mgmt-api-18380858926:

npx create-db@pr60
npx create-pg@pr60
npx create-postgres@$pr60

Worker URLs
• Create-DB Worker:
• Claim-DB Worker:

These will live as long as this PR exists under tag pr60-user-agent-sent-to-mgmt-api-18380858926.

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