Skip to content

Scope preview list --format json output to the authenticated user - #4252

Merged
bcotrim merged 1 commit into
trunkfrom
fix-preview-list-json-user-scope
Jul 21, 2026
Merged

Scope preview list --format json output to the authenticated user#4252
bcotrim merged 1 commit into
trunkfrom
fix-preview-list-json-user-scope

Conversation

@bcotrim

@bcotrim bcotrim commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • N/A

How AI was used in this PR

Implemented and verified with Claude Code under my direction; I reviewed the diff and the direction was agreed beforehand.

Proposed Changes

Preview snapshots are per-user by design, but studio preview list --format json returned before the auth check and dumped every snapshot in cli.json unfiltered. A logged-out user (or a different account on the same machine) could see preview sites they don't own.

  • The json path now behaves like the table path: snapshots are filtered by the authenticated user's ID.
  • When logged out it emits an empty array ([]) instead of erroring, so the desktop app degrades gracefully
  • Site scoping is unchanged: json output still covers all local sites, and --all semantics are untouched.

Testing Instructions

  1. npm run cli:build
  2. Create a site + preview(s) site or use existing ones
  3. While logged in (node apps/cli/dist/cli/main.mjs auth status): run node apps/cli/dist/cli/main.mjs preview list --format json — your snapshots are listed.
  4. Log out (auth logout) and run the same command — output is [] with exit code 0, no error.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@bcotrim bcotrim self-assigned this Jul 20, 2026
@bcotrim
bcotrim requested a review from a team July 20, 2026 09:16
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 377e03f vs trunk

app-size

Metric trunk 377e03f Diff Change
App Size (Mac) 1355.69 MB 1355.69 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 377e03f Diff Change
load 1078 ms 1109 ms +31 ms ⚪ 0.0%

site-startup

Metric trunk 377e03f Diff Change
siteCreation 7024 ms 6984 ms 40 ms ⚪ 0.0%
siteStartup 2357 ms 2353 ms 4 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@bcotrim
bcotrim requested review from nightnei and sejas July 20, 2026 12:56

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

LGTM, works as expected and I confirm that in trunk it wasn't gated and now it works well

Screenshot 2026-07-21 at 12 02 48 Screenshot 2026-07-21 at 12 02 56 Screenshot 2026-07-21 at 12 03 02 Screenshot 2026-07-21 at 12 03 09
@bcotrim
bcotrim merged commit da1cfb4 into trunk Jul 21, 2026
15 checks passed
@bcotrim
bcotrim deleted the fix-preview-list-json-user-scope branch July 21, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants