Skip to content

[Shopify] Migrate test mocking from IsTestInProgress to HttpClientHandler#7204

Merged
onbuyuka merged 15 commits into
mainfrom
private/onbuyuka/shpfytestmock
Apr 7, 2026
Merged

[Shopify] Migrate test mocking from IsTestInProgress to HttpClientHandler#7204
onbuyuka merged 15 commits into
mainfrom
private/onbuyuka/shpfytestmock

Conversation

@onbuyuka
Copy link
Copy Markdown
Contributor

@onbuyuka onbuyuka commented Mar 17, 2026

Summary

  • Remove the legacy IsTestInProgress event-based mocking infrastructure from the Shopify Connector
  • Migrate all tests to use the framework-level [HttpClientHandler] pattern with TestHttpRequestPolicy = BlockOutboundRequests
  • Delete ShpfyCommunicationEvents codeunit and 15 legacy subscriber codeunits
  • Net reduction of ~1,057 lines of code

Production code changes

  • Remove IsTestInProgress / SetTestInProgress / GetTestInProgress from ShpfyCommunicationMgt and all if IsTestInProgress branches
  • Delete ShpfyCommunicationEvents.Codeunit.al (5 legacy test-only events)
  • Remove GetTestInProgress() early-exit guards from 5 order/fulfillment codeunits
  • Remove IsTestInProgress parameter from OnBeforeUploadImage event
  • Add InputSize > 0 guard in InventoryAPI.ExportStock to skip empty mutations

Test code changes

  • Migrate ~40 test codeunits to [HttpClientHandler] with Library - Variable Storage for response queue routing
  • Delete 15 legacy subscriber codeunits; strip 2 others to non-HTTP business events only
  • Standardize initialization: CreateShop() + RegisterAccessTokenForShop()

Test plan

  • Shopify Connector app compiles
  • Shopify Connector Test app compiles
  • All Shopify Connector tests pass

Fixes AB#625871

🤖 Generated with Claude Code

…ientHandler

Remove the legacy IsTestInProgress event-based mocking infrastructure from
the Shopify Connector and migrate all tests to use the framework-level
HttpClientHandler pattern.

Production code changes:
- Remove IsTestInProgress/SetTestInProgress/GetTestInProgress from
  ShpfyCommunicationMgt and all if-branches that routed HTTP to events
- Delete ShpfyCommunicationEvents codeunit (5 legacy test events)
- Remove GetTestInProgress early-exit guards from 5 order/fulfillment codeunits
- Remove IsTestInProgress parameter from OnBeforeUploadImage event
- Add InputSize > 0 guard in InventoryAPI.ExportStock

Test code changes:
- Migrate ~40 test codeunits to TestHttpRequestPolicy = BlockOutboundRequests
  with [HttpClientHandler] procedures and [HandlerFunctions] annotations
- Delete 15 legacy subscriber codeunits; strip 2 others to non-HTTP events only
- Use Library - Variable Storage for response queue routing in handlers
- Standardize initialization: CreateShop + RegisterAccessTokenForShop

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Mar 17, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Mar 17, 2026
- Remove 35 local Shop variable declarations that shadow codeunit-level Shop
- Rename Shop parameters to ShopParam to avoid AA0244
- Convert bare StrSubstNo format strings to Label constants (AA0217)
- Fix unassigned DefaultVariantId variable (AA0205)
- Remove unused ProductId variables (AA0206)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@onbuyuka onbuyuka force-pushed the private/onbuyuka/shpfytestmock branch from a0927ba to 6ca6dcb Compare March 18, 2026 10:51
onbuyuka and others added 6 commits March 18, 2026 12:17
…event

- Remove OnBeforeUploadImage event from ShpfyProductAPI (no longer needed
  with HttpClientHandler intercepting the PUT call directly)
- Add PUT upload call to image sync handler response queues
- Fix CreateUploadUrl fixture with valid https:// URIs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use data.node instead of data.currentBulkOperation to match
what GetBulkRequest reads in production code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All order-importing tests trigger RegisterFulfillmentService which
makes a GraphQL call. Added [HandlerFunctions('OrdersAPIHttpHandler')]
to 27 tests and a fallback else clause returning {"data":{}} for
unrecognized API calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Return {"data":{}} for unrecognized API calls when queue is empty.
Use CompanyLocationId as signal for company location response instead
of queue-based routing. Remove unused OutboundHttpRequests variable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

onbuyuka and others added 3 commits March 30, 2026 12:46
…ytestmock

# Conflicts:
#	src/Apps/W1/Shopify/Test/Inventory/ShpfyInventoryExportTest.Codeunit.al
#	src/Apps/W1/Shopify/Test/Inventory/ShpfyInventorySubscriber.Codeunit.al
Bootstrap CLAUDE.md, business-logic.md, and patterns.md at the app level,
plus subfolder docs for Products, Companies, Inventory, and Bulk Operations.
Covers test infrastructure patterns (HttpClientHandler mocking, lazy init,
resource-based mock responses, retry state machines, Variable Storage queue).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

AL Documentation Audit

Documentation gaps were detected in the following apps:

  • Shopify-Connector-Test: 62% documentation coverage
  • Shopify-Connector: 79% documentation coverage

To generate documentation, run /al-docs init or /al-docs update using GitHub Copilot CLI or Claude Code.
This review is for awareness to help keep documentation in sync with code changes. It is okay to dismiss this request.

@onbuyuka onbuyuka marked this pull request as ready for review March 30, 2026 13:20
@onbuyuka onbuyuka requested a review from a team as a code owner March 30, 2026 13:20
Resolve modify/delete conflicts on ShpfyProductCollectionSubs and
ShpfySalesChannelSubs by keeping deletions -- these subscriber codeunits
were replaced by HttpClientHandler mocking on this branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@onbuyuka onbuyuka enabled auto-merge (squash) March 30, 2026 13:49
darjoo
darjoo previously approved these changes Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 5, 2026

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@onbuyuka onbuyuka closed this Apr 7, 2026
auto-merge was automatically disabled April 7, 2026 08:02

Pull request was closed

@onbuyuka onbuyuka reopened this Apr 7, 2026
@onbuyuka onbuyuka enabled auto-merge (squash) April 7, 2026 08:02
@onbuyuka onbuyuka merged commit 38dbba4 into main Apr 7, 2026
54 checks passed
@onbuyuka onbuyuka deleted the private/onbuyuka/shpfytestmock branch April 7, 2026 12:00
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.

4 participants