Skip to content

Conversation

@onbuyuka
Copy link
Contributor

@onbuyuka onbuyuka commented Dec 23, 2025

Shopify GraphQL Cost Audit

Overview

The GetExpectedCost() values in the GraphQL codeunits were audited against Shopify's actual API costs using API version 2025-07.

Method

  1. Created GetShopifyCosts.ps1 script that:

    • Extracts GraphQL queries from each codeunit's GetGraphQL() method
    • Replaces placeholders ({{ProductId}}, {{OrderId}}, etc.) with dummy values
    • Sends each query to Shopify's GraphQL API
    • Reads requestedQueryCost from the response extensions.cost object
    • Compares against the codeunit's GetExpectedCost() value
  2. Script handles AL string escaping ('' for single quotes) to properly extract queries

  3. Updates files in-place when run with -UpdateFiles flag

Results

Metric Count
Files processed 128
Matches (correct) 52
Updated 76
Errors (need manual review) 8
Skipped (helper codeunits) 2

Notable Corrections

File Old Cost New Cost Savings
ShpfyGQLNextOpenOrdToImport 612 112 500
ShpfyGQLFindCustByPhone 420 3 417
ShpfyGQLProductImages 420 47 373
ShpfyGQLInventoryEntries 403 48 355
ShpfyGQLCatalogPrices 304 31 273
ShpfyGQLProductIds 220 12 208

Files Requiring Manual Review

These files couldn't be validated due to complex placeholder requirements:

  • ShpfyGQLCreatePriceList - B2B catalog mutation
  • ShpfyGQLMetafieldsSet - Requires metafields array input
  • ShpfyGQLOrderCancel - Requires boolean/enum placeholders
  • ShpfyGQLNextOrderReturns - Returns feature
  • ShpfyGQLRevFulfillOrderLines / ShpfyGQLNextRevFulfillOrdLns - Reverse fulfillment
  • ShpfyGQLTranslationsRegister - Translation mutation
  • ShpfyGQLUpdateOrderAttr - Order attributes mutation

Work Item(s)

Fixes AB#609930

@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Dec 23, 2025
@github-actions github-actions bot added this to the Version 28.0 milestone Dec 23, 2025
@onbuyuka onbuyuka marked this pull request as ready for review January 5, 2026 12:51
@onbuyuka onbuyuka requested a review from a team as a code owner January 5, 2026 12:51
@onbuyuka onbuyuka enabled auto-merge (squash) January 5, 2026 12:51
darjoo
darjoo previously approved these changes Jan 6, 2026
Copy link
Contributor

@AndreiPanko AndreiPanko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two queries have {{NumberOfLines}} pr alike parameter that seems to be set as 1. I suspect the real value is different

AndreiPanko
AndreiPanko previously approved these changes Jan 7, 2026
@haoranpb
Copy link
Contributor

haoranpb commented Jan 7, 2026

Why not check the powershell script in here?

@onbuyuka onbuyuka merged commit 72b8dc5 into main Jan 8, 2026
37 checks passed
@onbuyuka onbuyuka deleted the bugs/609930-ShpfyGQLCost branch January 8, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants