Add public shop_domain to CLI command analytics#7578
Conversation
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/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_'> & PickByPrefix<MonorailEventPublic, 'env_auto_upgrade_'>;
+type CmdFieldsFromMonorail = PickByPrefix<MonorailEventPublic, 'cmd_all_'> & PickByPrefix<MonorailEventPublic, 'cmd_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_create_app_'> & PickByPrefix<MonorailEventPublic, 'cmd_theme_'> & PickByPrefix<MonorailEventPublic, 'store_'> & Pick<MonorailEventPublic, 'shop_domain'> & PickByPrefix<MonorailEventPublic, 'env_auto_upgrade_'>;
declare const coreData: RuntimeMetadataManager<CmdFieldsFromMonorail, {
commandStartOptions: {
startTime: number;
packages/cli-kit/dist/public/node/monorail.d.ts@@ -2,7 +2,7 @@ import { JsonMap } from '../../private/common/json.js';
import { DeepRequired } from '../common/ts/deep-required.js';
export { DeepRequired };
type Optional<T> = T | null;
-export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.24";
+export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.25";
export interface Schemas {
[MONORAIL_COMMAND_TOPIC]: {
sensitive: {
@@ -33,6 +33,7 @@ export interface Schemas {
is_employee: boolean;
store_fqdn_hash?: Optional<string>;
store_fqdn_validated?: Optional<boolean>;
+ shop_domain?: Optional<string>;
user_id: string;
cmd_all_alias_used?: Optional<string>;
cmd_all_launcher?: Optional<string>;
|
There was a problem hiding this comment.
Pull request overview
Adds a public shop_domain field to CLI command analytics and bumps the Monorail topic to app_cli3_command/1.25. The field is populated alongside existing store attribution in app, store, and theme analytics paths, and a small bug in storeContext is fixed so the store FQDN is normalized before logging.
Changes:
- Add
shop_domainto public metadata in app dev, store attribution, store-context, and theme command analytics. - Bump Monorail command topic to
1.25and addshop_domainto the schema and metadata type picks. - Normalize
selectedStore.shopDomainbeforelogMetadatainstoreContextand add a test for it.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli-kit/src/public/node/monorail.ts | Bump topic to 1.25 and add optional shop_domain to schema. |
| packages/cli-kit/src/public/node/monorail.test.ts | Updated expectations to include shop_domain. |
| packages/cli-kit/src/public/node/metadata.ts | Include shop_domain in CmdFieldsFromMonorail pick. |
| packages/app/src/cli/metadata.ts | Include shop_domain in app metadata public field pick. |
| packages/app/src/cli/services/dev.ts | Record shop_domain in dev metadata. |
| packages/app/src/cli/services/store-context.ts | Normalize store FQDN before logging; record shop_domain. |
| packages/app/src/cli/services/store-context.test.ts | New test for normalization before metadata logging. |
| packages/store/src/cli/services/store/attribution.ts | Add shop_domain to public metadata. |
| packages/store/src/cli/services/store/attribution.test.ts | Updated test to cover shop_domain. |
| packages/theme/src/cli/utilities/theme-command.ts | Record shop_domain in theme metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Requires https://app.graphite.com/github/pr/Shopify/monorail/23747 to merge.
What
Add the public
shop_domainfield to CLI command analytics and bump the Monorail command topic toapp_cli3_command/1.25.This records
shop_domainalongside the existing store attribution fields in the current app, store, and theme analytics paths.Why
Shopify/monorail#23747adds a non-sensitiveshop_domainfield to the CLI command schema.Populating that field lets downstream metrics keep using shop domain after the sensitive
store_fqdnfield is redacted, while preserving the existingstore_fqdn,store_fqdn_hash, andstore_fqdn_validatedsignals.This also fixes one small bug in
storeContext: normalize the selected store domain before logging analytics so the new field and the existing store attribution fields are recorded consistently.