feat(02-bug-fixes): extract CronHandlerFactory, complete Phase 2

Phase 2 complete (4/4 plans):
- Plan 02-01: Fix dead ZPL page size condition in AllegroShipmentService
- Plan 02-02: Add time-based cursor to AllegroStatusSyncService
- Plan 02-03: Fix ShopproOrdersSyncService using wrong state repository
- Plan 02-04: Extract CronHandlerFactory as single cron composition point

Plan 02-04 specifics:
- New CronHandlerFactory builds complete cron object graph
- Application::maybeRunCronOnWeb() reduced from 80+ to ~20 lines
- bin/cron.php reduced from 123 to 26 lines
- Fixed 2 bugs: AllegroOAuthClient→AllegroTokenManager,
  AllegroOrderSyncStateRepository→ShopproOrderSyncStateRepository

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-03-13 00:43:04 +01:00
parent 87203c4321
commit 880ab5933f
8 changed files with 498 additions and 227 deletions

View File

@@ -5,27 +5,28 @@
See: .paul/PROJECT.md (updated 2026-03-12)
**Core value:** Sprzedawca może obsługiwać zamówienia ze wszystkich kanałów sprzedaży i nadawać przesyłki bez przełączania się między platformami.
**Current focus:** Faza 02 — Bug Fixes: 3 plany ukończone. Kolejne bugi z CONCERNS.md.
**Current focus:** Faza 02 — Bug Fixes COMPLETE (4/4). Gotowe do planowania fazy 03.
## Current Position
Milestone: v0.1 Initial Release
Phase: 2 of TBD (02-bug-fixes) — Planning
Plan: 02-01, 02-02, 02-03 — COMPLETE. Gotowy na kolejny plan.
Status: Loop closed. Ready for next /paul:plan (more bugs from CONCERNS.md)
Last activity: 2026-03-13 — UNIFY complete for 02-02 and 02-03
Phase: 3 of TBD (next phase TBD) — Not started
Plan: Not started
Status: Ready to plan Phase 3
Last activity: 2026-03-13 — Phase 02 complete, transitioned to Phase 3
Progress:
- Milestone: [██░░░░░░░░] ~20%
- Milestone: [████░░░░░░] ~40%
- Phase 1: [██████████] 100%
- Phase 2: [███░░░░░░░] ~30% (3/? plans)
- Phase 2: [██████████] 100% (4/4 plans complete)
- Phase 3: [░░░░░░░░░░] 0% (not started)
## Loop Position
Current loop state:
```
PLAN ──▶ APPLY ──▶ UNIFY
✓ ✓ ✓ [Loop closed — 02-02 i 02-03 complete]
✓ ✓ ✓ [Phase 02 complete — ready for Phase 3 PLAN]
```
## Accumulated Context
@@ -33,9 +34,9 @@ PLAN ──▶ APPLY ──▶ UNIFY
### Decisions
| Data | Decyzja | Faza | Wpływ |
|------|---------|------|-------|
| 2026-03-12 | 401 retry zastąpiony przez tokenManager->resolveToken() zamiast publicznej forceRefresh() | Faza 01 | Marginalny edge case — retry nie wymusza refreshu gdy token wg daty ważny |
| 2026-03-12 | AllegroTokenManager wydzielony z 4 klas OAuth | Faza 01 | Centralizacja logiki tokenów, brak duplikacji |
| 2026-03-12 | StringHelper jako final static class w Core/Support | Faza 01 | 19 duplikatów helperów usunięte z 15 klas |
| 2026-03-13 | CronHandlerFactory jako jedyne miejsce kompozycji crona | Faza 02 | Application.php i bin/cron.php zsynchronizowane; 2 bugi naprawione |
### Skill Audit (Faza 02, Plan 01)
| Oczekiwany | Wywołany | Uwagi |
@@ -55,9 +56,10 @@ PLAN ──▶ APPLY ──▶ UNIFY
- **code-review** — wywołać /code-review przed kolejnym UNIFY (pominięto w obydwu planach fazy 01).
### Git State
Last commit: f8db8c0
Last commit: 87203c4 (pre-phase-02 commit)
Branch: main
Feature branches merged: none
Uncommitted: Phase 02 changes (pending commit)
### Blockers/Concerns
Brak.
@@ -65,18 +67,9 @@ Brak.
## Session Continuity
Last session: 2026-03-13
Stopped at: UNIFY complete dla planów 02-02 i 02-03
Next action: /paul:plan (kolejne bugi z .paul/codebase/CONCERNS.md, faza 02 kontynuowana)
Stopped at: Phase 02 complete, transition done
Next action: /paul:plan dla Phase 3
Resume file: .paul/ROADMAP.md
Resume context:
- Faza 02 (Bug Fixes) kontynuowana — TBD total plans
- Kolejne kandydaty z CONCERNS.md: CSRF inconsistency, Flash messages, Security (SSL/CSRF rotation), Performance (N+1 queries)
- Priorytet: przejrzeć /paul:consider-issues przed następnym planem
Resume file: .paul/HANDOFF-2026-03-13.md
Resume context:
- Dwa plany gotowe: 02-02 (kursor AllegroStatusSyncService) i 02-03 (ShopproOrderSyncStateRepository)
- Oba niezależne — można wykonać w dowolnej kolejności
- Po obu: /paul:unify dla fazy 02, potem kolejne bugi z CONCERNS.md
---
*STATE.md — Updated after every significant action*