Skip to content

Expose structured local configuration issues in app config validate JSON#7090

Open
dmerand wants to merge 1 commit intodlm-app-validate-errorsfrom
dlm-app-validate-error-layer
Open

Expose structured local configuration issues in app config validate JSON#7090
dmerand wants to merge 1 commit intodlm-app-validate-errorsfrom
dlm-app-validate-error-layer

Conversation

@dmerand
Copy link
Contributor

@dmerand dmerand commented Mar 24, 2026

What

Expose structured local configuration issues in shopify app config validate --json.

This PR turns the internal structured issue data into the public {valid, issues} JSON contract for loader-backed local configuration failures.

Why

app config validate --json is meant to be machine-readable for automation and repair loops.

The earlier work preserved structured issues internally, but the JSON path was still too tied to rendered CLI text and command-shaped abort handling. This PR moves to a shared lower-level LocalConfigError so loader-backed local configuration failures can flow into the public JSON contract without reconstructing issues from human-readable output.

How

  • emit the public validation result as {valid, issues}
  • add a small shared helper for the public JSON result shape
  • use LocalConfigError as the shared lower-layer local configuration error
  • make loader-backed configuration failures use LocalConfigError
  • serialize only LocalConfigError in JSON mode
  • keep unrelated operational failures on the normal CLI error path

Notes

This PR covers the loader / validation pipeline path.

Project-backed discovery, app-config selection, and malformed discovered config failures stay in the next PR.

Copy link
Contributor Author

dmerand commented Mar 24, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
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
@@ -8,7 +8,6 @@ export declare const environmentVariables: {
     env: string;
     firstPartyDev: string;
     noAnalytics: string;
-    cliToken: string;
     partnersToken: string;
     runAsUser: string;
     serviceEnv: string;
packages/cli-kit/dist/public/node/environment.d.ts
@@ -10,12 +10,17 @@
  */
 export declare function getEnvironmentVariables(): NodeJS.ProcessEnv;
 /**
- * Returns the value of the SHOPIFY_CLI_TOKEN environment variable,
- * falling back to the deprecated SHOPIFY_CLI_PARTNERS_TOKEN.
+ * Returns the value of the SHOPIFY_CLI_PARTNERS_TOKEN environment variable.
  *
- * @returns The CLI token value, or undefined if neither env var is set.
+ * @returns Current process environment variables.
+ */
+export declare function getPartnersToken(): string | undefined;
+/**
+ * Check if the current proccess is running using the partners token.
+ *
+ * @returns True if the current proccess is running using the partners token.
  */
-export declare function getCliToken(): string | undefined;
+export declare function usePartnersToken(): boolean;
 /**
  * Returns the value of the organization id from the environment variables.
  *
packages/cli-kit/dist/private/node/session/exchange.d.ts
@@ -25,7 +25,7 @@ export declare function exchangeAccessForApplicationTokens(identityToken: Identi
  */
 export declare function refreshAccessToken(currentToken: IdentityToken): Promise<IdentityToken>;
 /**
- * Given a custom CLI token passed as ENV variable, request a valid Partners API token.
+ * Given a custom CLI token passed as ENV variable, request a valid Partners API token
  * This token does not accept extra scopes, just the cli one.
  * @param token - The CLI token passed as ENV variable 
  * @returns An instance with the application access tokens.
@@ -35,7 +35,7 @@ export declare function exchangeCustomPartnerToken(token: string): Promise<{
     userId: string;
 }>;
 /**
- * Given a custom CLI token passed as ENV variable, request a valid App Management API token.
+ * Given a custom CLI token passed as ENV variable, request a valid App Management API token
  * @param token - The CLI token passed as ENV variable 
  * @returns An instance with the application access tokens.
  */
@@ -44,7 +44,7 @@ export declare function exchangeCliTokenForAppManagementAccessToken(token: strin
     userId: string;
 }>;
 /**
- * Given a custom CLI token passed as ENV variable, request a valid Business Platform API token.
+ * Given a custom CLI token passed as ENV variable, request a valid Business Platform API token
  * @param token - The CLI token passed as ENV variable 
  * @returns An instance with the application access tokens.
  */

@dmerand
Copy link
Contributor Author

dmerand commented Mar 24, 2026

Stack context: this series builds app validate --json in layers:

  • #7069: JSON mode disables color
  • #7065: add app validate --json
  • #7066: keep structured issues internally
  • #7070: expose {valid, issues}
  • #7090: make early local config/load failures use the same structured path via AppConfigurationAbortError

Please review in order. This top PR is the architectural follow-up that removes command-layer text parsing for early failures.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2026

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 82.33% 15163/18418
🟡 Branches 74.9% 7489/9999
🟢 Functions 81.4% 3816/4688
🟢 Lines 82.71% 14332/17327

Test suite run success

4011 tests passing in 1530 suites.

Report generated by 🧪jest coverage report action from f9b868c

@dmerand dmerand force-pushed the dlm-app-validate-error-layer branch from 7417593 to edb96a0 Compare March 25, 2026 15:15
@dmerand dmerand force-pushed the dlm-app-validate-error-shape branch from b34f147 to 4cbff46 Compare March 25, 2026 15:15
@dmerand dmerand changed the title Introduce AppConfigurationAbortError for app validate json Introduce AppConfigurationAbortError for app config validate json Mar 25, 2026
@dmerand dmerand force-pushed the dlm-app-validate-error-layer branch from edb96a0 to b82d4c6 Compare March 25, 2026 15:50
@dmerand dmerand force-pushed the dlm-app-validate-error-shape branch from 4cbff46 to 28f8829 Compare March 25, 2026 15:50
@dmerand dmerand changed the title Introduce AppConfigurationAbortError for app config validate json Introduce AppConfigurationAbortError for loader-backed config validate JSON Mar 25, 2026
@dmerand dmerand force-pushed the dlm-app-validate-error-layer branch from b82d4c6 to a1bb168 Compare March 26, 2026 01:11
@dmerand dmerand force-pushed the dlm-app-validate-error-shape branch from 28f8829 to 0456af0 Compare March 26, 2026 01:11
@dmerand dmerand changed the base branch from dlm-app-validate-error-shape to graphite-base/7090 March 26, 2026 14:33
@dmerand dmerand changed the title Introduce AppConfigurationAbortError for loader-backed config validate JSON Expose structured local configuration issues in app config validate JSON Mar 26, 2026
@dmerand dmerand changed the base branch from graphite-base/7090 to dlm-app-validate-errors March 26, 2026 15:02
@dmerand dmerand force-pushed the dlm-app-validate-errors branch from 964455a to 123cec3 Compare March 26, 2026 15:27
@dmerand dmerand force-pushed the dlm-app-validate-error-layer branch from a1bb168 to f321549 Compare March 26, 2026 15:59
@dmerand dmerand force-pushed the dlm-app-validate-errors branch from 123cec3 to 30acf6b Compare March 26, 2026 18:18
@dmerand dmerand force-pushed the dlm-app-validate-error-layer branch from f321549 to d19c2e9 Compare March 26, 2026 18:18
@dmerand dmerand force-pushed the dlm-app-validate-error-layer branch from 834c24c to f9b868c Compare March 26, 2026 18:56
@dmerand dmerand force-pushed the dlm-app-validate-errors branch from 30acf6b to a7602f8 Compare March 26, 2026 18:56
@dmerand dmerand marked this pull request as ready for review March 26, 2026 20:30
@dmerand dmerand requested a review from a team as a code owner March 26, 2026 20:30
@github-actions
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

Caution

DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant