Phase 02 plans 02-01, 02-02, 02-03: - fix(02-01): dead condition in AllegroShipmentService ZPL page size Both ternary branches returned 'A6'; ZPL now correctly returns 'ZPL' - fix(02-02): add last_status_checked_at cursor to AllegroStatusSyncService New migration adds orders.last_status_checked_at DATETIME NULL with composite index (source, source_updated_at). findOrdersNeedingStatusSync() filters by cursor; markOrderStatusChecked() records timestamp on success. - fix(02-03): replace AllegroOrderSyncStateRepository in ShopproOrdersSyncService New ShopproOrderSyncStateRepository (same table, correct class name). Application.php wires correct repository to correct service. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
162 lines
5.2 KiB
Markdown
162 lines
5.2 KiB
Markdown
---
|
||
phase: 02-bug-fixes
|
||
plan: 01
|
||
type: execute
|
||
wave: 1
|
||
depends_on: []
|
||
files_modified:
|
||
- src/Modules/Shipments/AllegroShipmentService.php
|
||
- .paul/codebase/CONCERNS.md
|
||
autonomous: true
|
||
---
|
||
|
||
<objective>
|
||
## Cel
|
||
Naprawa martwego warunku w `AllegroShipmentService::downloadLabel()` — obie gałęzie ternary zwracają `'A6'`, przez co etykiety ZPL są zawsze pobierane z nieprawidłowym rozmiarem strony.
|
||
|
||
## Uzasadnienie
|
||
Etykiety ZPL są przeznaczone dla drukarek termicznych (InPost, kurierzy), które używają innego formatu niż PDF. Prawidłowy rozmiar dla ZPL to `A6` (etykieta termiczna 105×148 mm), natomiast PDF powinien być pobierany z rozmiarem `A4` dla standardowej kartki. Aktualnie obie gałęzie zwracają `'A6'`, co sprawia że:
|
||
- PDF jest pobierany jako A6 zamiast A4 (etykieta za mała dla normalnej drukarki)
|
||
- Conditional jest martwym kodem — nie ma żadnego rozróżnienia między formatami
|
||
|
||
## Output
|
||
- Poprawiony plik `AllegroShipmentService.php` z działającym warunkiem
|
||
- Usunięty wpis błędu z `.paul/codebase/CONCERNS.md`
|
||
</objective>
|
||
|
||
<context>
|
||
## Kontekst projektu
|
||
@.paul/PROJECT.md
|
||
@.paul/ROADMAP.md
|
||
@.paul/STATE.md
|
||
|
||
## Plik źródłowy
|
||
@src/Modules/Shipments/AllegroShipmentService.php
|
||
</context>
|
||
|
||
<acceptance_criteria>
|
||
|
||
## AC-1: Warunek ternary jest aktywny i rozróżnia formaty
|
||
```gherkin
|
||
Given metoda downloadLabel() otrzymuje pakiet z label_format = 'ZPL'
|
||
When wywoływane jest getShipmentLabel()
|
||
Then pageSize przekazany do API to 'A6' (format termiczny)
|
||
```
|
||
|
||
## AC-2: PDF pobierany z poprawnym rozmiarem
|
||
```gherkin
|
||
Given metoda downloadLabel() otrzymuje pakiet z label_format = 'PDF' (lub pustym)
|
||
When wywoływane jest getShipmentLabel()
|
||
Then pageSize przekazany do API to 'A4' (format A4 dla PDF)
|
||
```
|
||
|
||
## AC-3: Brak martwego kodu w warunku
|
||
```gherkin
|
||
Given obie gałęzie ternary
|
||
When dokonano zmiany
|
||
Then obie gałęzie zwracają różne wartości — brak dead code
|
||
```
|
||
|
||
</acceptance_criteria>
|
||
|
||
<tasks>
|
||
|
||
<task type="auto">
|
||
<name>Naprawa martwego warunku page size w AllegroShipmentService</name>
|
||
<files>src/Modules/Shipments/AllegroShipmentService.php</files>
|
||
<action>
|
||
W pliku `src/Modules/Shipments/AllegroShipmentService.php`, linia 251:
|
||
|
||
Aktualna (błędna) linia:
|
||
```php
|
||
$pageSize = $labelFormat === 'ZPL' ? 'A6' : 'A6';
|
||
```
|
||
|
||
Poprawić na:
|
||
```php
|
||
$pageSize = $labelFormat === 'ZPL' ? 'A6' : 'A4';
|
||
```
|
||
|
||
Uzasadnienie wartości:
|
||
- `'ZPL'` → `'A6'`: Etykiety termiczne ZPL używają formatu 105×148 mm (A6). Allegro API akceptuje `'A6'` dla drukarek termicznych.
|
||
- `'PDF'` (i inne) → `'A4'`: Etykiety PDF powinny być pobierane w formacie A4 dla standardowych drukarek.
|
||
|
||
Nie zmieniać nic poza tą jedną linią. Nie refaktoryzować otaczającego kodu.
|
||
</action>
|
||
<verify>
|
||
Przeszukaj plik greppem pod kątem martwego warunku:
|
||
```
|
||
grep "? 'A6' : 'A6'" src/Modules/Shipments/AllegroShipmentService.php
|
||
```
|
||
Wynik powinien być pusty (linia nie istnieje).
|
||
|
||
Sprawdź że nowa linia jest poprawna:
|
||
```
|
||
grep "pageSize" src/Modules/Shipments/AllegroShipmentService.php
|
||
```
|
||
Powinno zwrócić: `$pageSize = $labelFormat === 'ZPL' ? 'A6' : 'A4';`
|
||
</verify>
|
||
<done>AC-1, AC-2, AC-3 spełnione: warunek jest aktywny, ZPL → A6, PDF → A4</done>
|
||
</task>
|
||
|
||
<task type="auto">
|
||
<name>Usunięcie naprawionego błędu z CONCERNS.md</name>
|
||
<files>.paul/codebase/CONCERNS.md</files>
|
||
<action>
|
||
W pliku `.paul/codebase/CONCERNS.md`, usuń całą sekcję:
|
||
|
||
```
|
||
### [HIGH] ZPL Label Page Size: Dead Conditional `'ZPL' ? 'A6' : 'A6'`
|
||
...
|
||
---
|
||
```
|
||
|
||
Czyli wszystko od nagłówka `### [HIGH] ZPL Label Page Size` do (włącznie z) linii `---` kończącej tę sekcję w bloku "Known Bugs".
|
||
|
||
Nie usuwać innych sekcji. Nie zmieniać numeracji ani struktury pliku.
|
||
</action>
|
||
<verify>
|
||
```
|
||
grep "ZPL Label Page Size" .paul/codebase/CONCERNS.md
|
||
```
|
||
Wynik powinien być pusty — sekcja usunięta.
|
||
</verify>
|
||
<done>Wpis błędu usunięty z CONCERNS.md po jego naprawieniu</done>
|
||
</task>
|
||
|
||
</tasks>
|
||
|
||
<boundaries>
|
||
|
||
## DO NOT CHANGE
|
||
- `src/Modules/Settings/AllegroApiClient.php` — nie zmieniać sygnatury `getShipmentLabel()`
|
||
- Pozostałe sekcje `.paul/codebase/CONCERNS.md` — usuwamy tylko naprawiony błąd
|
||
- Żaden inny plik w `src/Modules/Shipments/`
|
||
|
||
## SCOPE LIMITS
|
||
- Ten plan naprawia wyłącznie martwy warunek `pageSize`
|
||
- Nie refaktoryzujemy `downloadLabel()` ani nie zmieniamy logiki zapisu pliku
|
||
- Nie implementujemy obsługi innych formatów etykiet (np. PNG)
|
||
|
||
</boundaries>
|
||
|
||
<verification>
|
||
Przed zamknięciem planu:
|
||
- [ ] `grep "? 'A6' : 'A6'" src/Modules/Shipments/AllegroShipmentService.php` zwraca puste
|
||
- [ ] `grep "pageSize" src/Modules/Shipments/AllegroShipmentService.php` pokazuje `'ZPL' ? 'A6' : 'A4'`
|
||
- [ ] `grep "ZPL Label Page Size" .paul/codebase/CONCERNS.md` zwraca puste
|
||
- [ ] Plik PHP jest poprawny składniowo: `php -l src/Modules/Shipments/AllegroShipmentService.php`
|
||
</verification>
|
||
|
||
<success_criteria>
|
||
- Wszystkie zadania ukończone
|
||
- Martwy warunek `'ZPL' ? 'A6' : 'A6'` nie istnieje w kodzie
|
||
- ZPL → A6, PDF → A4 (różne wartości, aktywny warunek)
|
||
- Wpis błędu usunięty z CONCERNS.md
|
||
- Brak błędów składniowych w PHP
|
||
</success_criteria>
|
||
|
||
<output>
|
||
Po ukończeniu utwórz `.paul/phases/02-bug-fixes/02-01-SUMMARY.md`
|
||
</output>
|