Skip to content

Add --country flag to store create dev#7947

Open
amcaplan wants to merge 62 commits into
stable/4.5from
add-country-flag-to-store-create-dev
Open

Add --country flag to store create dev#7947
amcaplan wants to merge 62 commits into
stable/4.5from
add-country-flag-to-store-create-dev

Conversation

@amcaplan

@amcaplan amcaplan commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What

Adds a --country flag to shopify store create dev, implementing the country piece of shop/world#22968, and shares the flag — definition, validation, and error message — with shopify store create preview.

  • flags.ts exports a single shared countryFlag constant (env SHOPIFY_FLAG_STORE_COUNTRY). Its parse normalizes the value to trimmed uppercase and validates the two-letter shape, throwing a consistent AbortError before a command's run body executes. isCountryCode and the error message are internal implementation details of the flag.
  • Both store create dev and store create preview reference this one countryFlag, so validation and error output are identical and defined in exactly one place — no per-command if-checks.
  • store create dev threads --country into createDevStore, which sends it to the BP createAppDevelopmentStore mutation and surfaces it in JSON and success output.

Notes

  • Validation now lives in the flag's parse (oclif enforces it), rather than being duplicated in each command.
  • The preview command's env var changed from SHOPIFY_FLAG_PREVIEW_STORE_COUNTRY to the shared SHOPIFY_FLAG_STORE_COUNTRY. The --country flag is new/unreleased and the command is hidden, so there's no external impact.
  • Command is hidden; no changeset.
  • Tests pass (command + service); manifest updated for the env-var change.

stephanie-shopify and others added 4 commits June 22, 2026 17:48
Replaces the single catch-all Bugsnag bucket (~1,170 unrelated GraphQL/API
errors across app/theme/store/hydrogen) with grouping derived from the original
typed error's HTTP status and GraphQL extensions.code, rather than regex-
reparsing a stringified message.

- New error-grouping.ts: structured-first decision table
  (THROTTLED/429->rate_limit, 401->authentication, 403/ACCESS_DENIED->permission,
  5xx->server), shared keyword categorizer as fallback, and undefined for unknown
  errors so Bugsnag stack-trace grouping is preserved.
- error-handler.ts: sets event.groupingHash only when a real category resolves,
  and emits error_grouping metadata (slice_name, http_status, error_code,
  error_class) so backend routing works regardless of CLI version.
- error.ts: raw graphql-request ClientError 401/429/THROTTLED is now treated as
  expected and kept out of crash reporting.

Shared error-categorizer.ts / storage.ts (Monorail taxonomy) are untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Knip flagged the interface as an unused export — it is only used internally
as the return type of errorGroupingSignals; callers destructure inline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Assisted-By: devx/35aa2b43-cb40-4048-859c-af48d6d3ca28
Assisted-By: devx/3c9d2be5-81a1-4ad5-90ba-4155c6ff125d
@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 Jun 28, 2026
stephanie-shopify and others added 25 commits June 29, 2026 12:16
…r, suppression naming

Responds to Mbarak's review on #7901:
- Scan every GraphQL error (not just errors[0]) for routing codes, recognizing
  THROTTLED/429 and ACCESS_DENIED incl. nested App Management app_errors
  access_denied. Extracted into a dependency-free graphql-error-codes module
  shared by grouping and crash-report suppression (avoids the error.ts ->
  headers.ts -> error.ts import cycle).
- Add the string GraphQL code "429" as a rate-limit signal, matching
  errorsIncludeStatus429 in private/node/api.ts.
- Merge object signals over message-derived signals field-by-field with `??`
  so an absent object code/status can no longer erase a recovered value.
- Single resolveErrorGrouping() returns {hash, category, signals}; the reporter
  drives both event.groupingHash and the error_grouping metadata from it, so the
  metadata now carries category and message-derived signals.
- Rename isTransientApiError -> isExpectedApiError and document why 401
  (expired/invalid credentials) is expected, distinct from rate limiting.
- Document the deliberate 401-over-ACCESS_DENIED precedence and pin it + the new
  shapes with tests. Remove the issue-specific DESIGN.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wrap the two resolveErrorGrouping return objects across lines (prettier/prettier)
and flatten the isExpectedApiError jsdoc to remove indented continuation lines
(jsdoc/check-indentation, enforced on public API files).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…TH_CONDITION_TYPES

Incidental codegen drift cleanup, not part of the error-grouping logic. The
admin schema gained this OnlineStoreThemeFilesUserErrorsCode enum value upstream;
the committed generated types were stale. The codegen check only runs when a PR
touches graphql-pathed files, so this PR's new graphql-error-codes.ts un-skipped
it and surfaced the pre-existing drift. Reproduces codegen output byte-for-byte
(no local schema fetch available).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Assisted-By: devx/655cd991-b9e0-480d-ba60-50e176a7ce76
Assisted-By: devx/655cd991-b9e0-480d-ba60-50e176a7ce76
…_deterministic

Make metadata timer tests deterministic
…g_guidance

Clarify filesystem testing guidance
Route theme creation through the theme Admin request wrapper so ACCESS_DENIED responses use the existing friendly missing access error.

Normalize requiredAccess prose that starts with "The user needs" before embedding it in the user-facing message.

Co-authored-by: Pi AI <noreply@pi.dev>
Assisted-By: devx/a1027ad2-ceec-4016-b728-d7c842f1fe88
Handle missing theme write access during theme creation
Group CLI crash reports on structured error signals
Use preview identity for store open analytics
Assisted-By: devx/a2560e25-a597-4af7-92ea-24c6fa943415
Assisted-By: devx/782ef931-ac0a-4cc4-bff1-a2511c379664
Assisted-By: devx/782ef931-ac0a-4cc4-bff1-a2511c379664
Assisted-By: devx/782ef931-ac0a-4cc4-bff1-a2511c379664
Assisted-By: devx/782ef931-ac0a-4cc4-bff1-a2511c379664
Assisted-By: devx/df67c0ff-0bc3-434a-b5d7-091c8efbac1e
Assisted-By: devx/df67c0ff-0bc3-434a-b5d7-091c8efbac1e
Assisted-By: devx/a2560e25-a597-4af7-92ea-24c6fa943415
Assisted-By: devx/782ef931-ac0a-4cc4-bff1-a2511c379664
Assisted-By: devx/782ef931-ac0a-4cc4-bff1-a2511c379664
@amcaplan amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 360670c to 2337ab2 Compare July 9, 2026 11:27
@amcaplan amcaplan changed the base branch from graphite-base/7947 to unhide-store-commands July 9, 2026 11:27
@github-actions github-actions Bot added Area: @shopify/cli @shopify/cli package issues and removed no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. labels Jul 9, 2026
…surface

Remove unused extension creation surface
@github-actions

github-actions Bot commented Jul 9, 2026

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/private/node/constants.d.ts
@@ -6,6 +6,7 @@ export declare const environmentVariables: {
     doctor: string;
     enableCliRedirect: string;
     env: string;
+    firstPartyDev: string;
     noAnalytics: string;
     optOutInstrumentation: string;
     appAutomationToken: string;
packages/cli-kit/dist/private/node/session.d.ts
@@ -90,7 +90,6 @@ export declare function setLastSeenUserIdAfterAuth(id: string): void;
  */
 export declare function getLastSeenAuthMethod(): Promise<AuthMethod>;
 export declare function setLastSeenAuthMethod(method: AuthMethod): void;
-export declare function setCommandSessionId(sessionId: string | undefined): void;
 export interface EnsureAuthenticatedAdditionalOptions {
     noPrompt?: boolean;
     forceRefresh?: boolean;
packages/cli-kit/dist/public/node/base-command.d.ts
@@ -16,7 +16,6 @@ declare abstract class BaseCommand extends Command {
     protected parse<TFlags extends FlagOutput & {
         path?: string;
         verbose?: boolean;
-        'auth-alias'?: string;
     }, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(options?: Input<TFlags, TGlobalFlags, TArgs>, argv?: string[]): Promise<ParserOutput<TFlags, TGlobalFlags, TArgs> & {
         argv: string[];
     }>;
packages/cli-kit/dist/public/node/cli.d.ts
@@ -39,9 +39,6 @@ export declare const globalFlags: {
 export declare const jsonFlag: {
     json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
 };
-export declare const authAliasFlag: {
-    'auth-alias': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
-};
 /**
  * Builds a  flag that only accepts a valid port number. The flag parses its
  * value as an integer and rejects anything that isn't a whole number between 1 and
packages/cli-kit/dist/public/node/session.d.ts
@@ -22,19 +22,6 @@ export type AccountInfo = UserAccountInfo | ServiceAccountInfo | UnknownAccountI
  * @param userId - User identifier to report on the command analytics event.
  */
 export declare function setLastSeenUserId(userId: string): void;
-/**
- * Finds a stored Shopify account session by alias without changing the current session.
- *
- * @param alias - The account alias to find.
- * @returns The matching session ID, or undefined if no session matches.
- */
-export declare function findSessionIdByAlias(alias: string): Promise<string | undefined>;
-/**
- * Selects a stored Shopify account session by alias for the current command process.
- *
- * @param alias - The account alias to select. Passing undefined clears the command selection.
- */
-export declare function setCurrentSessionAlias(alias?: string): Promise<void>;
 interface UserAccountInfo {
     type: 'UserAccount';
     email: string;
packages/cli-kit/dist/public/node/context/local.d.ts
@@ -63,6 +63,13 @@ export declare function alwaysLogAnalytics(env?: NodeJS.ProcessEnv): boolean;
  * @returns True if SHOPIFY_CLI_ALWAYS_LOG_METRICS is truthy.
  */
 export declare function alwaysLogMetrics(env?: NodeJS.ProcessEnv): boolean;
+/**
+ * Returns true if the CLI User is 1P.
+ *
+ * @param env - The environment variables from the environment of the current process.
+ * @returns True if SHOPIFY_CLI_1P is truthy.
+ */
+export declare function firstPartyDev(env?: NodeJS.ProcessEnv): boolean;
 /**
  * Returns true if the CLI can run the "doctor-release" command.
  *

@amcaplan amcaplan force-pushed the unhide-store-commands branch from c6cddfa to e69c6a6 Compare July 9, 2026 11:40
@amcaplan amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 2337ab2 to 6017086 Compare July 9, 2026 11:40
@github-actions github-actions Bot added no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. and removed Area: @shopify/cli @shopify/cli package issues labels Jul 9, 2026
isaacroldan and others added 3 commits July 9, 2026 11:48
…ion-support

Remove dashboard managed extension support flag
Unhide `shopify store auth list`, `shopify store open`, `shopify store list`,
and `shopify store create preview` ahead of their public release. `shopify
store create dev` remains hidden.

Regenerated the oclif manifest and README, updated tests, and added a
changeset per newly-public command.

Assisted-By: devx/64aec273-1f35-4e4f-be5f-883631f97c64
Assisted-By: devx/64aec273-1f35-4e4f-be5f-883631f97c64
@amcaplan amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 6017086 to 79a9328 Compare July 9, 2026 12:48
@amcaplan amcaplan force-pushed the unhide-store-commands branch from e69c6a6 to 5e141f3 Compare July 9, 2026 12:48
amcaplan added 8 commits July 9, 2026 16:10
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Extracts and shares the country-code validation already used by
store create preview: countryFlag, isCountryCode, and a shared
invalidCountryCodeMessage in flags.ts, plus devStoreFlags.country.

The flag is validated, plumbed into createDevStore options, and shown
in JSON/success output, but is NOT yet sent to the BP
createAppDevelopmentStore mutation -- the published schema does not
expose a country argument until shop/world#671185 (part of
shop/world#22968) merges. GraphQL wiring is a trivial follow-up.

Command is hidden; no changeset (not functional end-to-end yet).

Assisted-By: devx/bf777827-dc69-4993-9b11-c401dc19c4be
The --country flag was collected and shown in output but never sent
to the createAppDevelopmentStore mutation. Wire it through as the
'country' argument now that the backend supports it.

Assisted-By: devx/de0d96e7-211c-4a8b-991d-240b9f675823
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
@amcaplan amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 79a9328 to cca2e79 Compare July 9, 2026 13:10
@amcaplan amcaplan force-pushed the unhide-store-commands branch 3 times, most recently from fa7747b to b2ebd9e Compare July 9, 2026 16:30
Base automatically changed from unhide-store-commands to stable/4.5 July 9, 2026 20:01
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.

7 participants