Skip to content

fix(database): Refine database create output#77

Merged
luanvdw merged 1 commit into
mainfrom
feat/database-create-output
Jun 9, 2026
Merged

fix(database): Refine database create output#77
luanvdw merged 1 commit into
mainfrom
feat/database-create-output

Conversation

@luanvdw

@luanvdw luanvdw commented Jun 9, 2026

Copy link
Copy Markdown
Member

Overview

Refines the human output for creating Prisma Postgres databases and database connections. The stream contract stays automation-friendly: human status goes to stderr, the one-time URL is the only default stdout value, and --json remains JSON-only.

Changes

  • Updated docs/product/command-spec.md and docs/product/output-conventions.md to document default, verbose, quiet, and JSON behavior for one-time database URLs.
  • Added compact human stderr renderers for database create and database connection create in packages/cli/src/presenters/database.ts, with verbose metadata rows behind --verbose.
  • Kept opaque ids and generated connection names out of default human output, while showing ids inline in verbose mode.
  • Adjusted packages/cli/src/shell/command-runner.ts so non-JSON commands with both human output and raw stdout emit stderr first, then stdout. --quiet still emits only raw stdout, and --json bypasses human/raw stdout presenters.
  • Expanded database and command-runner tests to cover default, verbose, quiet, JSON, stream ordering, URL one-time output, and generated-name hiding.

Why

The first database command slice was functionally correct but too bare for interactive users. This keeps the machine contract intact while giving humans a clear success message and save-now warning without burying the URL under metadata.

Verification

  • pnpm --filter @prisma/cli test database.test.ts command-runner.test.ts
  • pnpm --filter @prisma/cli test
  • pnpm --filter @prisma/cli build
  • git diff --check

Note: one full-suite run timed out once in project-real-mode.test.ts; the immediate rerun passed all 407 tests.

Local Review

  • skills/engineering/tmp-code-review/: LGTM, no actionable findings.
  • skills/engineering/thermonuclear-review/: conditional pass initially for runner stderr-writing shape; resolved by folding the separator into the human output writer path.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR implements human-readable CLI output for database and connection creation commands. The output is now split across stderr (creation summary with project/branch context) and stdout (raw connection URL only), with proper verbosity controls. The command runner was refactored to handle quiet mode early and manage output ordering. New test infrastructure tracks per-stream writes, and integration tests now verify exact stderr/stdout content and separation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is directly related to the changeset, providing overview, detailed changes, rationale, and verification steps for the database output refinement.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title 'fix(database): Refine database create output' directly and clearly describes the main objective of the PR—improving the output formatting for database creation commands.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/database-create-output
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/database-create-output

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.

@luanvdw luanvdw changed the title Refine database create output fix(database): Refine database create output Jun 9, 2026
@luanvdw luanvdw requested a review from AmanVarshney01 June 9, 2026 08:52
@luanvdw luanvdw merged commit da7b057 into main Jun 9, 2026
5 checks passed
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