Skip to content

Add public shop_domain to CLI command analytics#7578

Open
dmerand wants to merge 1 commit into
mainfrom
donald/monorail-shop-domain-metrics
Open

Add public shop_domain to CLI command analytics#7578
dmerand wants to merge 1 commit into
mainfrom
donald/monorail-shop-domain-metrics

Conversation

@dmerand
Copy link
Copy Markdown
Contributor

@dmerand dmerand commented May 18, 2026

Requires https://app.graphite.com/github/pr/Shopify/monorail/23747 to merge.

What

Add the public shop_domain field to CLI command analytics and bump the Monorail command topic to app_cli3_command/1.25.

This records shop_domain alongside the existing store attribution fields in the current app, store, and theme analytics paths.

Why

Shopify/monorail#23747 adds a non-sensitive shop_domain field to the CLI command schema.

Populating that field lets downstream metrics keep using shop domain after the sensitive store_fqdn field is redacted, while preserving the existing store_fqdn, store_fqdn_hash, and store_fqdn_validated signals.

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.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label May 18, 2026
@dmerand dmerand marked this pull request as ready for review May 18, 2026 19:14
@dmerand dmerand requested review from a team as code owners May 18, 2026 19:14
Copilot AI review requested due to automatic review settings May 18, 2026 19:14
@github-actions
Copy link
Copy Markdown
Contributor

Differences in type declarations

We 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:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

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_'> & 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>;

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_domain to public metadata in app dev, store attribution, store-context, and theme command analytics.
  • Bump Monorail command topic to 1.25 and add shop_domain to the schema and metadata type picks.
  • Normalize selectedStore.shopDomain before logMetadata in storeContext and 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants