Skip to content

Add order-insensitive deep object comparison to cli-kit#8044

Open
isaacroldan wants to merge 1 commit into
mainfrom
deploy-split/01-cli-kit-order-insensitive-compare
Open

Add order-insensitive deep object comparison to cli-kit#8044
isaacroldan wants to merge 1 commit into
mainfrom
deploy-split/01-cli-kit-order-insensitive-compare

Conversation

@isaacroldan

@isaacroldan isaacroldan commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Part 1 of 8 — splitting #8040 (refactor of deploy extension matching) into a reviewable stack.

WHY are these changes introduced?

Later PRs render a deploy/release diff by comparing local vs. remote app configuration. Config arrays such as webhook subscriptions can be semantically equal while differing only in element order, so a plain deep-equal reports false differences.

WHAT is this pull request doing?

Adds deepCompareWithOrderInsensitiveArrays (and two private helpers) to @shopify/cli-kit/common/object — a deep comparison that treats arrays as unordered. Purely additive; no existing export changes.

How to test your changes?

pnpm --filter @shopify/cli-kit exec vitest run src/public/common/object.test.ts

Adds `deepCompareWithOrderInsensitiveArrays` (plus private helpers) to
`@shopify/cli-kit/common/object`. Deeply compares two values while treating
arrays as unordered, which the deploy/release config breakdown will use to
compare webhook subscriptions regardless of ordering.

Purely additive: no existing export is modified.

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

isaacroldan commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@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/public/common/object.d.ts
@@ -38,6 +38,14 @@ export declare function mapValues<T extends object, TResult>(source: T | null |
  * @returns True if the objects are equal, false otherwise.
  */
 export declare function deepCompare(one: object, two: object): boolean;
+/**
+ * Deeply compares two values and treats arrays as order-insensitive.
+ *
+ * @param one - The first value to be compared.
+ * @param two - The second value to be compared.
+ * @returns True if the normalized values are equal, false otherwise.
+ */
+export declare function deepCompareWithOrderInsensitiveArrays(one: unknown, two: unknown): boolean;
 /**
  * Return the difference between two nested objects.
  *

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.

1 participant