Skip to content

Loosen stats validation for CLI #1699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2025

Conversation

wojtekn
Copy link
Contributor

@wojtekn wojtekn commented Aug 21, 2025

Related issues

Proposed Changes

I propose to fix CLI preview site creation by relaxing the Zod schema for lastBumpStats to accept arbitrary metric keys, preventing parse failures on older stat names like studio-app-launch-uniques-monthly.

Testing Instructions

  1. Ensure you're authenticated in Studio (Sync, pull, push, assistant should work)
  2. Try to create a preview site for any existing site
  3. Verify the preview site creation completes without the "Invalid Studio config file format" error
  4. Confirm the preview site appears in the previews tab and is accessible

To reproduce the issue in trunk, ensure to add an incorrect stat to appdata config files before launching Studio e.g.:

"lastBumpStats": {
    "studio-cli-usage-unique": {
      "success": 1747138805686
    },
    "studio-app-launch-uniques": {
      "darwin": 1755617494935
    },
    "studio-app-launch-uniques-monthly": {
      "darwin": 1754296649792
    },
    "studio-app-launch-uniqs-mon": {
      "darwin": 1754924827013
    }
  },

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@wojtekn wojtekn requested a review from a team August 21, 2025 10:22
@wojtekn wojtekn self-assigned this Aug 21, 2025
Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

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

This looks good and works as described. 👍

I confirm that with these changes and with the older stat names added to the config, I can create the Preview site and don't receive any errors. The preview site also works as expected.

No preview sites Creating a preview site Done
Image Image Image

@wojtekn wojtekn merged commit a852706 into trunk Aug 22, 2025
12 checks passed
@wojtekn wojtekn deleted the fix/issue-with-stats-schema-too-strict branch August 22, 2025 12:49
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.

2 participants