[Phase 1] Track auto-upgrade metrics in Monorail#7001
Draft
alfonso-noriega wants to merge 1 commit intomainfrom
Draft
[Phase 1] Track auto-upgrade metrics in Monorail#7001alfonso-noriega wants to merge 1 commit intomainfrom
alfonso-noriega wants to merge 1 commit intomainfrom
Conversation
197454c to
7a735be
Compare
2869478 to
e33833f
Compare
00ff291 to
5bff8e0
Compare
- Adds Monorail tracking for auto-upgrade events - Tracked metrics: triggered, package_manager, skipped_reason, success - Updated postrun hook to record metrics at each decision point - Added tests for all metric recording scenarios Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5bff8e0 to
bf2d5b2
Compare
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/analytics.d.ts@@ -23,6 +23,7 @@ interface EnvironmentData {
env_auth_method: string;
env_is_wsl: boolean;
env_build_repository: string;
+ env_auto_upgrade_enabled: boolean | null;
}
export declare function getEnvironmentData(config: Interfaces.Config): Promise<EnvironmentData>;
export declare function getSensitiveEnvironmentData(config: Interfaces.Config): Promise<{
packages/cli-kit/dist/public/node/metadata.d.ts@@ -34,7 +34,7 @@ export type SensitiveSchema<T> = T extends RuntimeMetadataManager<infer _TPublic
* @returns A container for the metadata.
*/
export declare function createRuntimeMetadataContainer<TPublic extends AnyJson, TSensitive extends AnyJson = Record<string, never>>(defaultPublicMetadata?: Partial<TPublic>): RuntimeMetadataManager<TPublic, TSensitive>;
-type CmdFieldsFromMonorail = PickByPrefix<MonorailEventPublic, 'cmd_all_'> & PickByPrefix<MonorailEventPublic, 'cmd_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_create_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_theme_'> & PickByPrefix<MonorailEventPublic, 'store_'>;
+type CmdFieldsFromMonorail = PickByPrefix<MonorailEventPublic, 'cmd_all_'> & PickByPrefix<MonorailEventPublic, 'cmd_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_create_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_theme_'> & PickByPrefix<MonorailEventPublic, 'store_'> & PickByPrefix<MonorailEventPublic, 'env_auto_upgrade_'>;
declare const coreData: RuntimeMetadataManager<CmdFieldsFromMonorail, {
commandStartOptions: {
startTime: number;
packages/cli-kit/dist/public/node/monorail.d.ts@@ -46,6 +46,12 @@ export interface Schemas {
cmd_all_timing_network_ms?: Optional<number>;
cmd_all_timing_prompts_ms?: Optional<number>;
cmd_all_timing_active_ms?: Optional<number>;
+ env_auto_upgrade_enabled?: Optional<boolean>;
+ env_auto_upgrade_accepted?: Optional<boolean>;
+ env_auto_upgrade_triggered?: Optional<boolean>;
+ env_auto_upgrade_package_manager?: Optional<string>;
+ env_auto_upgrade_skipped_reason?: Optional<string>;
+ env_auto_upgrade_success?: Optional<boolean>;
cmd_extensions_binary_from_source?: Optional<boolean>;
cmd_scaffold_required_auth?: Optional<boolean>;
cmd_scaffold_template_custom?: Optional<boolean>;
packages/cli-kit/dist/public/node/upgrade.d.ts@@ -2,7 +2,7 @@
* Utility function for generating an install command for the user to run
* to install an updated version of Shopify CLI.
*
- * @returns A string with the command to run.
+ * @returns A string with the command to run, or undefined if the package manager cannot be determined.
*/
export declare function cliInstallCommand(): string | undefined;
/**
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
cmd_all_auto_upgrade_triggered: whether auto-upgrade was attemptedcmd_all_auto_upgrade_package_manager: which package manager was used (npm, yarn, pnpm, brew, etc.)cmd_all_auto_upgrade_skipped_reason: why upgrade was skipped (major_version)cmd_all_auto_upgrade_success: whether the upgrade succeeded or failedChanges
packages/cli-kit/src/public/node/monorail.ts: Added 4 new fields to thepublicsection ofSchemas[MONORAIL_COMMAND_TOPIC]packages/cli-kit/src/public/node/hooks/postrun.ts: UpdatedautoUpgradeIfNeeded()to calladdPublicMetadataat each decision point (major bump skip, trigger with package manager, success/failure)packages/cli-kit/src/public/node/hooks/postrun.test.ts: Added 4 new test cases covering metrics recording scenariosTest plan
pnpm vitest run src/public/node/hooks/postrun.test.ts— all 8 tests pass🤖 Generated with Claude Code