Skip to content

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

Closed
NabDevs wants to merge 3 commits into
mainfrom
revert/pr-513-guard-invalid-carrier-settings
Closed

revert: "fix(checkout): guard invalid carrier settings" (#513)#520
NabDevs wants to merge 3 commits into
mainfrom
revert/pr-513-guard-invalid-carrier-settings

Conversation

@NabDevs

@NabDevs NabDevs commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Reverts #513 (squash commit 393ad70).

The change was merged prematurely — it still needs to be tested (see tester notes in the ticket). This temporary revert keeps main releasable: the scheduled "Publish new version" workflow would otherwise ship the untested change in the next release (last run failed, next run would pick it up).

Re-landing after testing: restore the original branch and either revert this revert or re-apply the commits on a fresh branch (the original commits remain in main's history, so a plain re-merge will report "nothing to merge").

NabDevs and others added 3 commits August 6, 2026 16:08
* Guard carrier settings

* test: clean carrier guard

* fix: validate carrier entries

* fix: ignore malformed carrier settings

* refactor: simplify carrier settings guard
Reverts squash commit 393ad70. The change was merged prematurely and still
needs to be tested. Temporary revert to keep main releasable (the scheduled
release workflow would otherwise publish this untested change).

Re-land after testing by reverting this revert or re-applying the branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 08:12
@NabDevs
NabDevs requested a review from a team as a code owner August 7, 2026 08:12
@github-project-automation github-project-automation Bot moved this to Todo in PDK Aug 7, 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 reverts PR #513 (“fix(checkout): guard invalid carrier settings”) because the original fix was merged before it was fully tested, with the intent of keeping main in a releasable state until testing is completed and the fix can be re-landed safely.

Changes:

  • Removes the regression tests that covered missing/malformed carrier settings scenarios introduced in #513.
  • Reverts defensive type-guards in settings retrieval/validation that prevented crashes when stored carrier settings are not well-formed arrays.
  • Restores the previous delivery-options behavior by removing carrier-settings sanitization and the early-bailout path in DeliveryOptionsService.

Reviewed changes

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

Show a summary per file
File Description
tests/Unit/Settings/Repository/AbstractSettingsRepositoryTest.php Removes unit coverage for skipping malformed collection entries in settings.
tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceInvalidCarrierSettingsTest.php Deletes regression suite for missing/invalid carrier settings behavior.
tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceCapabilitiesTest.php Removes coverage for “malformed carrier entry” handling during carrier capability output.
tests/Unit/App/Context/Model/DeliveryOptionsConfigTest.php Removes carrier-settings fixture setup used for delivery options config assertions.
src/Settings/Repository/AbstractPdkSettingsRepository.php Reverts malformed-entry guards when building settings collections from storage.
src/Carrier/Service/CapabilitiesValidationService.php Reverts array/type checks around enabled-carrier detection from settings.
src/App/DeliveryOptions/Service/DeliveryOptionsService.php Reverts carrier-settings sanitization/early return that prevented checkout crashes on invalid settings.

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

Comment on lines 138 to 142
$category = $this->get($this->createSettingsKey($settingsId)) ?? [];

if (! is_array($category)) {
$category = [];
}

foreach (array_keys($category) as $key) {
$values = $this->get($this->createSettingsKey("$settingsId.$key"));

if (! is_array($values)) {
continue;
}
foreach ($category as $key => $item) {
$values = ['id' => $key] + $this->get($this->createSettingsKey("$settingsId.$key"));

Comment on lines 134 to 141
$carrierSettings = Settings::get(CarrierSettings::ID) ?? [];

if (! is_array($carrierSettings)) {
return [];
}

return array_keys(
array_filter(
$carrierSettings,
static function ($settings): bool {
return is_array($settings)
&& ! empty($settings[CarrierSettings::DELIVERY_OPTIONS_ENABLED]);
return ! empty($settings[CarrierSettings::DELIVERY_OPTIONS_ENABLED]);
}
Comment on lines 232 to 236
$allCarriers = $this->carrierRepository->all();
$carrierSettings = Settings::get(CarrierSettings::ID);
$shippingAddress = $cart->shippingMethod->shippingAddress;
$cc = $shippingAddress->cc ?? null;
$isBusiness = $shippingAddress->isBusiness;
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.33%. Comparing base (d3bde62) to head (d7dab15).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #520      +/-   ##
============================================
+ Coverage     94.31%   94.33%   +0.01%     
+ Complexity     2420     2414       -6     
============================================
  Files           352      352              
  Lines          7738     7726      -12     
============================================
- Hits           7298     7288      -10     
+ Misses          440      438       -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.

@NabDevs

NabDevs commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Overbodig: main is teruggezet naar 4.7.0 + cherry-pick van #515 (history rewrite i.p.v. revert). #513 komt na het testen via een nieuwe PR terug.

@NabDevs NabDevs closed this Aug 7, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in PDK Aug 7, 2026
@NabDevs
NabDevs deleted the revert/pr-513-guard-invalid-carrier-settings branch August 7, 2026 08:30
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.

3 participants