Skip to content

[codex] Add Query Details copy actions#1520

Merged
sorenbs merged 2 commits into
mainfrom
codex/query-details-copy-actions
Jun 5, 2026
Merged

[codex] Add Query Details copy actions#1520
sorenbs merged 2 commits into
mainfrom
codex/query-details-copy-actions

Conversation

@sorenbs
Copy link
Copy Markdown
Member

@sorenbs sorenbs commented Jun 5, 2026

Summary

  • Add compact copy actions in Query Details for the original SQL and the AI recommendation.
  • Copy recommendations as a plain-text bundle containing the summary, action bullets, and any suggested SQL or Prisma snippets.
  • Document the Query Insights detail-sheet copy affordances and include a minor changeset for @prisma/studio-core.

Validation

  • pnpm test ui/studio/views/queries/QueriesView.test.tsx
  • pnpm typecheck
  • pnpm exec eslint --cache --cache-location ./node_modules/.cache/eslint --no-warn-ignored ui/studio/views/queries/QueriesView.tsx ui/studio/views/queries/QueriesView.test.tsx FEATURES.md .changeset/good-turtles-lie.md
  • pnpm changeset status --since origin/main
  • Browser verification with pnpm demo:ppg: opened Query Details, verified both copy buttons are visible, and verified clipboard payloads for SQL and recommendation.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 69c4f776-e219-45f1-8212-d8f0bf6c53aa

📥 Commits

Reviewing files that changed from the base of the PR and between 8127865 and 2cabdcc.

📒 Files selected for processing (1)
  • ui/studio/views/queries/QueriesView.test.tsx

Summary by CodeRabbit

  • New Features

    • Query Details sheet adds quick-copy buttons for SQL and AI recommendations, with instant visual feedback.
  • Tests

    • Added test coverage for Query Details copy functionality, including clipboard assertions.
  • Documentation

    • Updated Query Insights docs to mention filter/sort/detail capabilities and the new compact copy actions.

Walkthrough

This PR adds clipboard copy functionality to the Query Details sheet. A new CopyToClipboardButton component handles copying text with visual feedback (icon swap, "Copied" tooltip, auto-reset). The SQL code block and Recommendations header each receive a copy button; recommendations use formatQueryAnalysisCopyText() to compose summary, bullets, and improved SQL/Prisma sections. A test mocks navigator.clipboard.writeText and verifies both copy actions produce the expected payloads. Documentation and a changeset note the feature.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding copy action functionality to the Query Details feature.
Description check ✅ Passed The description is directly related to the changeset, providing clear context about the copy actions being added, the validation steps performed, and the scope of changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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 codex/query-details-copy-actions
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/query-details-copy-actions

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Compute preview deployed.

Branch: codex/query-details-copy-actions
Service: codex-query-details-copy-actions
Preview: https://cmq0lyr4o4dwqdryr9pgkr1mh.cdg.prisma.build
Version: https://cv-6ff7e37e9dae.cdg.prisma.build

Copy link
Copy Markdown

@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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/studio/views/queries/QueriesView.test.tsx`:
- Around line 1352-1357: The test stubs navigator.clipboard via
Object.defineProperty but never restores the original descriptor, causing global
leakage; capture the original descriptor with const originalClipboard =
Object.getOwnPropertyDescriptor(navigator, "clipboard") before calling
Object.defineProperty(navigator, "clipboard", { value: { writeText },
configurable: true }), and then restore it in a finally/afterEach block (or
after the test) by calling Object.defineProperty(navigator, "clipboard",
originalClipboard || {}) or deleting the property if originalClipboard is
undefined so both occurrences (the block around navigator.clipboard and the
similar block at the other spot) properly restore the global state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: db683638-f40c-4894-a4e6-760061db2bf2

📥 Commits

Reviewing files that changed from the base of the PR and between ca42edf and 8127865.

📒 Files selected for processing (4)
  • .changeset/good-turtles-lie.md
  • FEATURES.md
  • ui/studio/views/queries/QueriesView.test.tsx
  • ui/studio/views/queries/QueriesView.tsx

Comment thread ui/studio/views/queries/QueriesView.test.tsx
@sorenbs sorenbs merged commit 9d45420 into main Jun 5, 2026
3 checks passed
@sorenbs sorenbs deleted the codex/query-details-copy-actions branch June 5, 2026 07:41
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