Skip to content

fix(checkout): guard invalid carrier settings - #513

Merged
NabDevs merged 6 commits into
mainfrom
feat/guard-invalid-carrier-settings
Aug 6, 2026
Merged

fix(checkout): guard invalid carrier settings#513
NabDevs merged 6 commits into
mainfrom
feat/guard-invalid-carrier-settings

Conversation

@NabDevs

@NabDevs NabDevs commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Prevents the checkout from crashing when carrier settings are missing or invalid. In that case, the delivery options service uses the default package type and returns no carriers. Includes regression coverage for missing and malformed settings.

Relates to: Woo PR

fixes INT-1730

Copilot AI review requested due to automatic review settings July 30, 2026 07:56
@NabDevs
NabDevs requested a review from a team as a code owner July 30, 2026 07:56
@github-project-automation github-project-automation Bot moved this to Todo in PDK Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the checkout delivery options flow against missing/invalid carrier settings so the checkout doesn’t crash and instead falls back to the default package type while exposing no carriers.

Changes:

  • Added a guard in DeliveryOptionsService::getValidCarrierOptions() to early-return when carrier settings are missing/invalid.
  • Added a regression test matrix for missing/invalid carrier settings.
  • Updated an existing delivery options config unit test to explicitly store enabled carrier settings for PostNL.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/App/DeliveryOptions/Service/DeliveryOptionsService.php Adds an early-return fallback when carrier settings are empty/invalid to prevent checkout crashes.
tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceInvalidCarrierSettingsTest.php Introduces regression coverage for invalid carrier settings inputs.
tests/Unit/App/Context/Model/DeliveryOptionsConfigTest.php Ensures carrier settings exist/enabled so config expectations remain valid with the new guard behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/App/DeliveryOptions/Service/DeliveryOptionsService.php
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.34%. Comparing base (82a9650) to head (3f415a2).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../Carrier/Service/CapabilitiesValidationService.php 75.00% 1 Missing ⚠️
...tings/Repository/AbstractPdkSettingsRepository.php 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #513      +/-   ##
============================================
+ Coverage     94.32%   94.34%   +0.02%     
- Complexity     2409     2443      +34     
============================================
  Files           352      352              
  Lines          7716     7782      +66     
============================================
+ Hits           7278     7342      +64     
- Misses          438      440       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/App/DeliveryOptions/Service/DeliveryOptionsService.php Outdated
@github-project-automation github-project-automation Bot moved this from Todo to Needs work in PDK Aug 5, 2026
@NabDevs
NabDevs requested a review from FreekVR August 5, 2026 13:45
Comment thread src/App/DeliveryOptions/Service/DeliveryOptionsService.php
@NabDevs
NabDevs merged commit 393ad70 into main Aug 6, 2026
12 of 13 checks passed
@NabDevs
NabDevs deleted the feat/guard-invalid-carrier-settings branch August 6, 2026 14:08
@github-project-automation github-project-automation Bot moved this from Needs work to Done in PDK Aug 6, 2026
@NabDevs
NabDevs restored the feat/guard-invalid-carrier-settings branch August 7, 2026 08:35
myparcel-bot Bot pushed a commit that referenced this pull request Aug 7, 2026
* Guard carrier settings

* test: clean carrier guard

* fix: validate carrier entries

* fix: ignore malformed carrier settings

* refactor: simplify carrier settings guard
myparcel-bot Bot pushed a commit that referenced this pull request Aug 7, 2026
* Guard carrier settings

* test: clean carrier guard

* fix: validate carrier entries

* fix: ignore malformed carrier settings

* refactor: simplify carrier settings guard
myparcel-bot Bot pushed a commit that referenced this pull request Aug 7, 2026
* Guard carrier settings

* test: clean carrier guard

* fix: validate carrier entries

* fix: ignore malformed carrier settings

* refactor: simplify carrier settings guard
myparcel-bot Bot pushed a commit that referenced this pull request Aug 7, 2026
* Guard carrier settings

* test: clean carrier guard

* fix: validate carrier entries

* fix: ignore malformed carrier settings

* refactor: simplify carrier settings guard
myparcel-bot Bot pushed a commit that referenced this pull request Aug 7, 2026
* Guard carrier settings

* test: clean carrier guard

* fix: validate carrier entries

* fix: ignore malformed carrier settings

* refactor: simplify carrier settings guard
myparcel-bot Bot pushed a commit that referenced this pull request Aug 7, 2026
* Guard carrier settings

* test: clean carrier guard

* fix: validate carrier entries

* fix: ignore malformed carrier settings

* refactor: simplify carrier settings guard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants