Skip to content

Conversation

@NabDevs
Copy link
Contributor

@NabDevs NabDevs commented Oct 31, 2025

  • Add proposition references to Account model and UserAgent concern
  • Maintain platform references for legacy support
  • Add comprehensive tests

INT-1085

@NabDevs NabDevs requested a review from a team as a code owner October 31, 2025 12:49
Copilot AI review requested due to automatic review settings October 31, 2025 12:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces a new "Proposition" concept to replace the legacy "Platform" terminology throughout the codebase, while maintaining full backward compatibility. The change adds a new PropositionManager and Proposition facade as the preferred API, while keeping the Platform facade functional but deprecated.

Key changes:

  • New Proposition API: Added PropositionManager, PropositionManagerInterface, Proposition facade, and Proposition class with constants
  • Backward compatibility layer: Platform API remains functional via delegation, with deprecation notices added
  • Context model updates: GlobalContext and DeliveryOptionsConfig now contain both proposition (new) and platform (legacy) properties with identical data
  • Comprehensive test coverage: New test files ensure parity between old and new APIs

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Proposition/PropositionManager.php New manager implementing proposition-specific logic with runtime platform detection
src/Proposition/PropositionManagerInterface.php Interface defining proposition operations (all, get, getPropositionName, getCarriers)
src/Facade/Proposition.php New facade providing clean API for proposition operations
src/Account/Proposition.php New constants class for proposition IDs and names
src/Platform/PlatformManager.php Added deprecated getPropositionName() method delegating to getPlatform()
src/Facade/Platform.php Added deprecation notice to docblock
src/Context/Model/GlobalContext.php Added proposition property alongside platform for dual support
src/Context/Model/DeliveryOptionsConfig.php Added proposition property alongside platform for dual support
config/pdk-services.php Registered PropositionManagerInterface service binding
tests/Unit/Proposition/PropositionManagerTest.php Comprehensive test suite with parity tests
tests/Unit/Context/PropositionContextTest.php Tests for context models with dual property support
tests/snapshots/*.json Updated snapshots reflecting new proposition properties

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

Comment on lines +21 to +23
* 1. New 'proposition' properties work correctly
* 2. Legacy 'platform' properties remain functional
* 3. Both properties contain identical data (parity)
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider using proper punctuation. The comment block should end with a colon followed by proper list formatting.

Suggested change
* 1. New 'proposition' properties work correctly
* 2. Legacy 'platform' properties remain functional
* 3. Both properties contain identical data (parity)
*
* 1. New 'proposition' properties work correctly
* 2. Legacy 'platform' properties remain functional
* 3. Both properties contain identical data (parity)

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.16%. Comparing base (01450f0) to head (1aea3be).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/Proposition/PropositionManager.php 80.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #398      +/-   ##
============================================
- Coverage     95.21%   95.16%   -0.05%     
- Complexity     1890     1901      +11     
============================================
  Files           352      354       +2     
  Lines          6202     6230      +28     
============================================
+ Hits           5905     5929      +24     
- Misses          297      301       +4     

☔ View full report in Codecov by Sentry.
📢 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.

- Add proposition references to Account model and UserAgent concern

- Maintain platform references for legacy support

- Add comprehensive tests

INT-1085
@NabDevs NabDevs force-pushed the feature/refactor-platform-naming-to-proposition branch from 4dc4a99 to 1aea3be Compare November 4, 2025 10:13

// Check for SendMyParcel (BE)
// Note: Platform constants use 2, but we support both 2 and 3 during transition
if (Platform::SENDMYPARCEL_ID === $platformId || 3 === $platformId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Dit hoeft toch niet meer, omdat Platform is geüpdatet met de eerdere fix (die corrigeerde voor de verkeerd ingetypte id’s)? (1/2)

public const MYPARCEL_NAME = 'myparcel';

/**
* Note: Platform constants use 2, but platformId 3 is also supported during transition
Copy link
Contributor

Choose a reason for hiding this comment

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

Hoeft niet meer toch? (2/2)

public function getPropositionName(): string
{
// First check if platform is explicitly configured in PDK
$configuredPlatform = Pdk::get('platform');
Copy link
Contributor

Choose a reason for hiding this comment

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

Waarom is deze toegevoegd (tov de eerdere implementatie in platformManager)? Bij mijn weten wordt dit niet meer geplaatst in de plugins (als ze platform ‘agnostisch’ zijn), dus dan is het alleen maar ruis / afleiding, of mis ik iets?

expect($propositionName)->toBe(Platform::MYPARCEL_NAME);
});

it('uses configured platform over account settings', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Check even of dit echt moet, volgens mij niet namelijk. Ik denk dat het eerder tot problemen kan leiden (platform dat niet klopt met de api key bv)

* Test support for both platformId 2 and 3 during transition
*/

it('supports both platformId 2 and 3 for SendMyParcel', function (int $platformId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hoeft dus volgens mij ook niet.

})->with('platforms');

it('returns proposition name based on account', function () {
MockPdkFactory::create(['platform' => Platform::MYPARCEL_NAME]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Deze slaat de propositie niet op in de account maar in de config, volgens mij, dus wordt niet getest wat die zegt dat ie test, volgens mij.

// GlobalContext Tests

it('GlobalContext has both proposition and platform properties', function () {
MockPdkFactory::create(['platform' => Platform::MYPARCEL_NAME]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Het is slechts een testfile, maar ik zou toch niet de deprecated Platform gebruiken hier. Is er een courante manier om deze constante op te halen?

@myparcel-bot myparcel-bot bot added the changes requested (Auto) label Nov 4, 2025
@FreekVR FreekVR changed the base branch from main to v3-proposition November 18, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants