Add public store_domain to CLI command analytics - #7578
Conversation
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.
| PickByPrefix<MonorailEventPublic, 'env_'> & | ||
| PickByPrefix<MonorailEventPublic, 'store_'> | ||
| PickByPrefix<MonorailEventPublic, 'store_'> & | ||
| Pick<MonorailEventPublic, 'shop_domain'> |
There was a problem hiding this comment.
feels like we could be consistent here and continue using store_prefix to refence shop stuff instead of spliting it, what do you think? I'm aware it'd mean updating the monorail schema
There was a problem hiding this comment.
PR to update the topic to have store_domain here https://app.graphite.com/github/pr/Shopify/monorail/23826
There was a problem hiding this comment.
I've made the update here as well.
There was a problem hiding this comment.
@isaacroldan this needs a team approval to merge, are you good with the changes?
There was a problem hiding this comment.
Sorry, i was sure i approved this, but i obviously didn't 🙈
8dfcb6f to
a53b14a
Compare
a53b14a to
a1fe5ec
Compare
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/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.26";
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>;
+ store_domain?: Optional<string>;
user_id: string;
cmd_all_alias_used?: Optional<string>;
cmd_all_launcher?: Optional<string>;
|

Requires https://app.graphite.com/github/pr/Shopify/monorail/23826 to include
store_domainin the Monorail schema.What
Add a public
store_domainfield to CLI command analytics and bump the Monorail command topic toapp_cli3_command/1.26.This records the normalized shop domain alongside existing store attribution fields in app, store, and theme analytics paths.
Why
The CLI needs a non-sensitive store-domain signal after the sensitive
store_fqdnfield is redacted. Keeping the field under thestore_prefix makes it consistent with the existing store attribution fields and lets metadata containers include it through existingstore_prefix typing.How
Populate
store_domainwherever CLI command analytics already record store attribution, and keepstore_fqdn,store_fqdn_hash, andstore_fqdn_validatedunchanged.The app store context path normalizes the selected store domain before logging metadata so the new public field and existing store attribution fields are consistent.