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 = Pick<MonorailEventPublic, 'shop_id'> & 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_'> & 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.23";
+export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.24";
export interface Schemas {
[MONORAIL_COMMAND_TOPIC]: {
sensitive: {
@@ -32,7 +32,7 @@ export interface Schemas {
node_version: string;
is_employee: boolean;
store_fqdn_hash?: Optional<string>;
- shop_id?: Optional<number>;
+ store_fqdn_validated?: Optional<boolean>;
user_id: string;
cmd_all_alias_used?: Optional<string>;
cmd_all_launcher?: Optional<string>;
|
There was a problem hiding this comment.
Pull request overview
This PR refactors store-command analytics attribution to avoid extra network calls done solely for metrics enrichment, while updating the CLI’s Monorail schema/topic to support distinguishing “requested” vs “validated” store attribution.
Changes:
- Removes the shared
StoreCommand.parse()-time store metadata recording and replaces it with explicit attribution recording instore authandstore executeflows. - Deletes
shop_idanalytics enrichment (including the Admin API lookup and thepublicApiVersionsquery path) to avoid metrics-only network calls. - Updates Monorail topic/schema from
app_cli3_command/1.23toapp_cli3_command/1.24and addsstore_fqdn_validatedto the public payload.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/store/src/cli/utilities/store-command.ts | Removes base parsing side-effects that recorded store analytics metadata. |
| packages/store/src/cli/utilities/store-command.test.ts | Updates expectations to ensure base parsing no longer records store attribution. |
| packages/store/src/cli/services/store/metrics.ts | Deletes the previous metrics helpers (hash + shop_id enrichment + Admin API lookup). |
| packages/store/src/cli/services/store/metrics.test.ts | Removes tests for deleted metrics helpers. |
| packages/store/src/cli/services/store/execute/index.ts | Records requested store attribution at the start of store execute. |
| packages/store/src/cli/services/store/execute/index.test.ts | Adds coverage ensuring requested store attribution is recorded even when request prep fails. |
| packages/store/src/cli/services/store/execute/admin-transport.ts | Removes shop id selection/recording from the public API versions request. |
| packages/store/src/cli/services/store/execute/admin-transport.test.ts | Updates tests to reflect removal of shop id behavior from the transport. |
| packages/store/src/cli/services/store/execute/admin-context.ts | Records validated store attribution after loading the stored store session; removes shop_id enrichment call. |
| packages/store/src/cli/services/store/execute/admin-context.test.ts | Updates assertions and adds coverage for attribution behavior around failures and store mismatch cases. |
| packages/store/src/cli/services/store/auth/index.ts | Records requested attribution early and validated attribution after token exchange; removes shop_id enrichment. |
| packages/store/src/cli/services/store/auth/index.test.ts | Adds coverage to ensure attribution is recorded at the intended points across failure modes. |
| packages/store/src/cli/services/store/attribution.ts | Introduces recordStoreFqdnMetadata(store, validated) to centralize attribution recording. |
| packages/store/src/cli/services/store/attribution.test.ts | Adds unit test for the new attribution helper (sensitive store + hashed public + validated state). |
| packages/store/src/cli/commands/store/execute.test.ts | Updates mocks to reflect metrics helper rename/removal. |
| packages/store/src/cli/commands/store/auth.test.ts | Updates mocks to reflect metrics helper rename/removal. |
| packages/cli-kit/src/public/node/monorail.ts | Bumps Monorail topic to 1.24 and replaces shop_id with store_fqdn_validated. |
| packages/cli-kit/src/public/node/monorail.test.ts | Adds coverage for publishing the real command topic including validated store attribution. |
| packages/cli-kit/src/public/node/metadata.ts | Removes shop_id from the set of tracked Monorail-derived fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
app_cli3_command/1.24shop_idfrom the store command analytics payloadstore_fqdn_validatedso requested store attribution is distinct from validated store attributionattribution.tsWhy
store authorstore executefail before an authenticated store context is establishedBehavior changes
store authrecords the requested store early and marks it validated only after token exchange succeedsstore executerecords the requested store before request validation and records the validated store after loading the stored sessionshop_idis no longer emitted, including from thepublicApiVersionsrequest pathstore_fqdn_validatedstore authbefore OAuth completesfalsestore authafter token exchange succeedstruestore executebefore stored session loadfalsestore executeafter stored session loadstruestore executewith no stored auth / early failurefalsestore_fqdn_validated=truemeans the FQDN was validated against an authenticated store context. It does not imply the command later completed successfully.Depends on Shopify/monorail#23622.