Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
6d2463a to
4e58f7b
Compare
dd1278d to
4b99cef
Compare
bac2759 to
c447b80
Compare
There was a problem hiding this comment.
Pull request overview
Improves analytics attribution for shopify store commands by ensuring store commands set the command analytics user_id and consistently emit a hashed public store identifier (store_fqdn_hash) while keeping the raw store FQDN in sensitive metadata.
Changes:
- Record
store_fqdn_hash(public) +store_fqdn(sensitive) for StoreCommand-based commands when--storeis parsed. - Record analytics
user_idforstore auth(from OAuth associated user) andstore execute(from stored store auth session). - Add a small public cli-kit session helper (
setLastSeenUserId) and accompanying tests.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/store/src/cli/utilities/store-command.ts | Adds hashed store attribution recording during --store parsing. |
| packages/store/src/cli/utilities/store-command.test.ts | Verifies StoreCommand parsing records both sensitive and public store metadata. |
| packages/store/src/cli/services/store/metrics.ts | Introduces shared helpers for store fqdn hash metadata and store-command user id attribution. |
| packages/store/src/cli/services/store/metrics.test.ts | Unit tests for hashed store fqdn metadata and setting user id. |
| packages/store/src/cli/services/store/execute/admin-context.ts | Records user_id from stored store session for store execute. |
| packages/store/src/cli/services/store/execute/admin-context.test.ts | Asserts recordStoreCommandUserId is called from stored session user id. |
| packages/store/src/cli/services/store/auth/index.ts | Records user_id from OAuth associated_user.id after auth. |
| packages/store/src/cli/services/store/auth/index.test.ts | Asserts recordStoreCommandUserId is called with the associated user id. |
| packages/store/src/cli/commands/store/execute.test.ts | Mocks metrics module to isolate command tests from attribution side effects. |
| packages/store/src/cli/commands/store/auth.test.ts | Mocks metrics module to isolate command tests from attribution side effects. |
| packages/cli-kit/src/public/node/session.ts | Adds setLastSeenUserId public wrapper used by store commands to set analytics user id. |
| packages/cli-kit/src/public/node/session.test.ts | Tests the new public setLastSeenUserId wrapper delegates to the private setter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c447b80 to
58ecacb
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/session.d.ts@@ -16,6 +16,12 @@ export interface Session {
userId: string;
}
export type AccountInfo = UserAccountInfo | ServiceAccountInfo | UnknownAccountInfo;
+/**
+ * Records the user ID that should be attached to command analytics for this process.
+ *
+ * @param userId - User identifier to report on the command analytics event.
+ */
+export declare function setLastSeenUserId(userId: string): void;
interface UserAccountInfo {
type: 'UserAccount';
email: string;
|

WHY are these changes introduced?
shopify store authandshopify store executecurrently under-attribute command analytics compared to app workflows:user_id--storeshould expose a public store identifier hashThis PR intentionally avoids
shop_idbecause that depends on a Monorail schema update. Theshop_idwork is split into the stacked PR #7429.WHAT is this pull request doing?
Adds existing-schema analytics attribution for store commands:
user_idfor:store authfrom the OAuthassociated_user.idstore executefrom the stored store auth session userstore_fqdn_hashfor StoreCommand-based commands with--storestore_fqdnin sensitive metadata onlyThe user ID helper is deliberately narrow: store commands set the command analytics user without introducing a generic public metadata override for
user_id.Post-release steps
None for this PR. It only uses existing Monorail fields.
Checklist