update
This commit is contained in:
132
.paul/phases/46-allegro-status-push/46-01-SUMMARY.md
Normal file
132
.paul/phases/46-allegro-status-push/46-01-SUMMARY.md
Normal file
@@ -0,0 +1,132 @@
|
||||
---
|
||||
phase: 46-allegro-status-push
|
||||
plan: 01
|
||||
subsystem: api
|
||||
tags: [allegro, status-sync, cron, mappings]
|
||||
requires:
|
||||
- phase: 45-shoppro-status-push
|
||||
provides: orderPRO to external marketplace status push pattern
|
||||
provides:
|
||||
- Allegro status push from orderPRO manual status changes
|
||||
- Active orderPRO_to_allegro direction in integration settings
|
||||
- Unit coverage for core push scenarios
|
||||
affects: [settings, cron, integrations]
|
||||
tech-stack:
|
||||
added: []
|
||||
patterns: [reverse status mapping, push cursor tracking, api retry on 401]
|
||||
key-files:
|
||||
created:
|
||||
- .paul/phases/46-allegro-status-push/46-01-SUMMARY.md
|
||||
- tests/Unit/AllegroStatusSyncServiceTest.php
|
||||
modified:
|
||||
- src/Modules/Settings/AllegroStatusSyncService.php
|
||||
- src/Modules/Settings/AllegroApiClient.php
|
||||
- src/Modules/Settings/AllegroStatusMappingRepository.php
|
||||
- src/Modules/Settings/AllegroOrderSyncStateRepository.php
|
||||
- src/Modules/Cron/CronHandlerFactory.php
|
||||
- resources/views/settings/allegro.php
|
||||
- resources/lang/pl.php
|
||||
- DOCS/ARCHITECTURE.md
|
||||
- DOCS/TECH_CHANGELOG.md
|
||||
key-decisions:
|
||||
- "Push only manual status changes (change_source=manual) to avoid sync loops."
|
||||
- "Reuse integration_order_sync_state with last_status_pushed_at cursor for incremental push."
|
||||
- "Retry once after token refresh on ALLEGRO_HTTP_401."
|
||||
patterns-established:
|
||||
- "First-match-wins reverse mapping: orderpro_status_code -> allegro_status_code."
|
||||
- "Per-order push result aggregation: pushed, skipped, failed."
|
||||
duration: ~4h
|
||||
started: 2026-03-28T12:20:50+01:00
|
||||
completed: 2026-03-28T13:20:00+01:00
|
||||
---
|
||||
|
||||
# Phase 46 Plan 01: Allegro Status Push Summary
|
||||
|
||||
orderPRO to Allegro status synchronization was implemented end-to-end and enabled in UI, with tests and documentation updates.
|
||||
|
||||
## Performance
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Duration | ~4h |
|
||||
| Started | 2026-03-28T12:20:50+01:00 |
|
||||
| Completed | 2026-03-28T13:20:00+01:00 |
|
||||
| Tasks | 3 completed |
|
||||
| Files modified | 10 |
|
||||
|
||||
## Acceptance Criteria Results
|
||||
|
||||
| Criterion | Status | Notes |
|
||||
|-----------|--------|-------|
|
||||
| AC-1: Cron pushes orderPRO manual status changes to Allegro | Pass | Implemented in AllegroStatusSyncService with API call, counters, and cursor updates. |
|
||||
| AC-2: Missing mapping does not stop processing | Pass | Unmapped statuses are counted as skipped; batch continues. |
|
||||
| AC-3: orderPRO -> Allegro direction active in UI | Pass | Disabled flag removed, option is selectable and persisted by existing settings flow. |
|
||||
|
||||
## Verification Results
|
||||
|
||||
| Command | Result |
|
||||
|--------|--------|
|
||||
| `php -l src/Modules/Settings/AllegroStatusSyncService.php` | PASS |
|
||||
| `php -l src/Modules/Settings/AllegroApiClient.php` | PASS |
|
||||
| `php -l src/Modules/Settings/AllegroStatusMappingRepository.php` | PASS |
|
||||
| `php -l src/Modules/Settings/AllegroOrderSyncStateRepository.php` | PASS |
|
||||
| `php -l src/Modules/Cron/CronHandlerFactory.php` | PASS |
|
||||
| `php -l tests/Unit/AllegroStatusSyncServiceTest.php` | PASS |
|
||||
| `C:/xampp/php/php.exe vendor/bin/phpunit --filter AllegroStatusSyncServiceTest --testdox` | PASS (4 tests, 39 assertions) |
|
||||
| `sonar-scanner` | PASS (analysis successful; Quality Gate failed due existing/new issues tracked in DOCS/todo.md) |
|
||||
|
||||
## Accomplishments
|
||||
|
||||
- Implemented real push path `orderpro_to_allegro` in sync service.
|
||||
- Added Allegro API fulfillment status update method and integrated it into cron flow.
|
||||
- Added reverse status mapping and push cursor support.
|
||||
- Enabled the direction in Allegro settings UI and adjusted PL hint text.
|
||||
- Added unit tests for success, skipped, failure, and 401 retry behavior.
|
||||
- Updated architecture and technical changelog docs.
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
| File | Change | Purpose |
|
||||
|------|--------|---------|
|
||||
| `src/Modules/Settings/AllegroStatusSyncService.php` | Modified | Added orderPRO->Allegro push execution and result aggregation. |
|
||||
| `src/Modules/Settings/AllegroApiClient.php` | Modified | Added PUT fulfillment status endpoint wrapper. |
|
||||
| `src/Modules/Settings/AllegroStatusMappingRepository.php` | Modified | Added reverse map builder for push direction. |
|
||||
| `src/Modules/Settings/AllegroOrderSyncStateRepository.php` | Modified | Added read/write support for `last_status_pushed_at`. |
|
||||
| `src/Modules/Cron/CronHandlerFactory.php` | Modified | Injected dependencies for new push logic and shared sync state repository. |
|
||||
| `resources/views/settings/allegro.php` | Modified | Enabled orderPRO->Allegro direction option. |
|
||||
| `resources/lang/pl.php` | Modified | Updated direction hint text (no "soon" wording). |
|
||||
| `tests/Unit/AllegroStatusSyncServiceTest.php` | Created | Added tests for key push flow behaviors. |
|
||||
| `DOCS/ARCHITECTURE.md` | Modified | Documented active push direction and API client method. |
|
||||
| `DOCS/TECH_CHANGELOG.md` | Modified | Logged technical change and rationale. |
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
| Type | Count | Impact |
|
||||
|------|-------|--------|
|
||||
| Scope additions | 1 | Low |
|
||||
| Deferred | 1 | Low |
|
||||
|
||||
- Scope addition: `src/Modules/Cron/CronHandlerFactory.php` was updated to wire dependencies for the new service behavior (not listed as a direct plan file, but required to activate runtime flow).
|
||||
- Plan file listed `src/Modules/Settings/AllegroIntegrationController.php` as a target, but no code change was needed there because existing save flow already persisted `allegro_status_sync_direction`.
|
||||
- Deferred: Sonar Quality Gate remediation intentionally postponed; full issue list captured in `DOCS/todo.md`.
|
||||
|
||||
## Key Patterns and Decisions
|
||||
|
||||
| Decision | Rationale | Impact |
|
||||
|----------|-----------|--------|
|
||||
| Manual-only push (`change_source=manual`) | Prevent import/sync feedback loops | Safe bidirectional architecture |
|
||||
| Cursor-based push (`last_status_pushed_at`) | Incremental processing and bounded batches | Better cron performance and idempotence |
|
||||
| Retry once on 401 after token refresh | Recover from expired access token | Improved operational resilience |
|
||||
|
||||
## Next Phase Readiness
|
||||
|
||||
Ready:
|
||||
- v1.8 milestone scope delivered for phase 46.
|
||||
- Operational status push path to Allegro can be validated in production cron logs.
|
||||
|
||||
Concerns:
|
||||
- Sonar issues remain open and are tracked in `DOCS/todo.md`.
|
||||
|
||||
Blockers:
|
||||
- None.
|
||||
|
||||
Reference in New Issue
Block a user