This commit is contained in:
2026-03-14 01:10:29 +01:00
parent ac0e07916e
commit 62a68e9ec2
23 changed files with 908 additions and 239 deletions

View File

@@ -1,74 +0,0 @@
# PAUL Handoff
**Date:** 2026-03-13
**Status:** paused — session complete, plans ready for execution
---
## READ THIS FIRST
You have no prior context. This document tells you everything.
**Project:** orderPRO — aplikacja do zarządzania zamówieniami z wielu źródeł sprzedaży (Allegro, Erli, shopPRO) z generowaniem etykiet przewozowych.
**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 State
**Milestone:** v0.2 Pre-Expansion Fixes
**Phase:** 7 — pre-expansion-fixes
**Plan:** 07-01..07-05 CREATED, żaden nie wykonany
**Loop Position:**
```
PLAN ──▶ APPLY ──▶ UNIFY
✓ ○ ○ [Plan gotowy — czeka na APPLY]
```
---
## What Was Done (ta sesja)
- UNIFY 06-05: god classes split — ShopproOrdersSyncService 39→9 metod, AllegroIntegrationController 35→25 metod
- Faza 06 zamknięta: 6/6 planów, SonarQube quality baseline
- /paul:complete-milestone: v0.1 Initial Release zamknięty, git tag v0.1.0
- CONCERNS.md skategoryzowany — "przed rozbudową" vs "odroczić"
- Faza 07 zaplanowana: 5 planów (07-01..07-05) gotowe do APPLY
---
## What's Next
**Immediate:** `/paul:apply .paul/phases/07-pre-expansion-fixes/07-01-PLAN.md`
Kolejność:
1. 07-01 — autonomiczny (Performance: N+1, static cache, DB indexes)
2. 07-02 — autonomiczny (SSL verify, cron→DB, migration 000014b)
3. 07-03 — ma checkpoint:human-verify (UX: disable orderpro_to_allegro, UI items 14-17)
4. 07-04 — autonomiczny (Tests: AllegroTokenManager + import)
5. 07-05 — ma checkpoint:decision (InPost ShipmentProviderInterface)
---
## Key Files
| File | Purpose |
|------|---------|
| `.paul/STATE.md` | Live project state |
| `.paul/phases/07-pre-expansion-fixes/07-01-PLAN.md` | Performance fixes |
| `.paul/phases/07-pre-expansion-fixes/07-02-PLAN.md` | SSL + cron + migration |
| `.paul/phases/07-pre-expansion-fixes/07-03-PLAN.md` | UX fixes (checkpoint) |
| `.paul/phases/07-pre-expansion-fixes/07-04-PLAN.md` | Unit tests |
| `.paul/phases/07-pre-expansion-fixes/07-05-PLAN.md` | InPost provider (checkpoint:decision) |
---
## Resume Instructions
1. `/paul:resume` — odczyta STATE.md i pokaże aktualny stan
2. Zatwierdź: `/paul:apply .paul/phases/07-pre-expansion-fixes/07-01-PLAN.md`
---
*Handoff created: 2026-03-13*

View File

@@ -5,26 +5,26 @@
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 07 — Pre-Expansion Fixes. 5 planów utworzonych, gotowe do APPLY.
**Current focus:** Faza 07 — Pre-Expansion Fixes. Plan 07-03 UNIFY complete, 07-04 następny.
## Current Position
Milestone: v0.2 Pre-Expansion Fixes
Phase: 7 of TBD (07-pre-expansion-fixes) — Planning
Plan: 07-01 do 07-05 CREATED, awaiting approval
Status: PLANy gotowe — wybrać plan do APPLY
Last activity: 2026-03-13Faza 07 zaplanowana (5 planów)
Phase: 7 of TBD (07-pre-expansion-fixes) — Executing
Plan: 07-01 ✓, 07-02 ✓, 07-03 ✓, 07-04..07-05 awaiting
Status: Loop 07-03 zamknięty — następny /paul:apply 07-04
Last activity: 2026-03-14Plan 07-03 loop closed (UX fixes + SSL hotfix)
Progress:
- v0.1 Initial Release: [██████████] 100% ✓
- v0.2 Pre-Expansion Fixes: [░░░░░░░░░░] 0% (0/5 planów)
- v0.2 Pre-Expansion Fixes: [██████░░░░] 60% (3/5 planów)
## Loop Position
Current loop state:
```
PLAN ──▶ APPLY ──▶ UNIFY
[07-01 plan gotowy — zacznij od /paul:apply 07-01]
[07-03 complete — next: /paul:apply 07-04]
```
## Accumulated Context
@@ -39,6 +39,21 @@ PLAN ──▶ APPLY ──▶ UNIFY
| 2026-03-13 | Flash messages: Flash::set('module.type') / Flash::get('module.type', '') | Faza 05 | OrdersController i ShipmentController zmigrowane; jeden wzorzec w całej aplikacji |
| 2026-03-13 | validateXxxInput(): ?string i validateXxxAccess(): ?Response jako wzorce helperów walidacji | Faza 06 | Redukcja return statements do ≤3; wzorzec do użycia w kolejnych planach |
### Skill Audit (Faza 07, Plan 03)
| Oczekiwany | Wywołany | Uwagi |
|------------|---------|-------|
| sonar-scanner | ○ | Pominięto — brak instalacji w PATH |
### Skill Audit (Faza 07, Plan 02)
| Oczekiwany | Wywołany | Uwagi |
|------------|---------|-------|
| sonar-scanner | ○ | Pominięto — brak instalacji w PATH |
### Skill Audit (Faza 07, Plan 01)
| Oczekiwany | Wywołany | Uwagi |
|------------|---------|-------|
| sonar-scanner | ○ | Pominięto — brak instalacji w PATH |
### Skill Audit (Faza 06, Plan 06)
| Oczekiwany | Wywołany | Uwagi |
|------------|---------|-------|
@@ -80,6 +95,7 @@ PLAN ──▶ APPLY ──▶ UNIFY
### Deferred Issues
- **CI/CD SonarQube** — dodać GitHub Actions workflow (`.github/workflows/sonarqube.yml`) który odpala `sonar-scanner` automatycznie przy każdym pushu. Token projektu: `sqp_8ef2748d037777cf00cf1b38534f8d435b762d7d` (dodać jako GitHub Secret `SONAR_TOKEN`). Przypisać do fazy związanej z infrastrukturą/DevOps gdy tylko fazy zostaną zdefiniowane.
- **code-review** — wywołać /code-review przed kolejnym UNIFY (pominięto w obydwu planach fazy 01).
- **Delivery mapping "Szukaj..." layout** — JS `attachSelectFilter()` w allegro.php tworzy input search dla InPost/Apaczka selectów, wizualnie wygląda jakby należał do wiersza powyżej. Pre-existing bug, do naprawy osobno.
### Git State
Last commit: fbb3020 (docs: close loop 06-05 — UNIFY complete)
@@ -91,14 +107,14 @@ Brak.
## Session Continuity
Last session: 2026-03-13
Stopped at: Faza 07 zaplanowana — 5 planów gotowych do wykonania
Next action: /paul:apply .paul/phases/07-pre-expansion-fixes/07-01-PLAN.md
Resume file: .paul/phases/07-pre-expansion-fixes/07-01-PLAN.md
Last session: 2026-03-14
Stopped at: Loop 07-03 zamknięty — SUMMARY utworzony
Next action: /paul:apply .paul/phases/07-pre-expansion-fixes/07-04-PLAN.md
Resume file: .paul/phases/07-pre-expansion-fixes/07-03-SUMMARY.md
Resume context:
- 07-01: Performance (N+1 subqueries, information_schema static, DB indexes)
- 07-02: SSL verification + cron throttle DB + migration 000014b
- 07-03: UX fixes (orderpro_to_allegro disable, items 14-17) — ma checkpoint
- 07-01: COMPLETE ✓ (N+1→LEFT JOIN, static cache, migration 000048)
- 07-02: COMPLETE ✓ (SSL verification, cron→DB, migration 000014b)
- 07-03: COMPLETE ✓ (UX fixes + SSL hotfix CA bundle nullable)
- 07-04: Tests (AllegroTokenManager + AllegroOrderImportService)
- 07-05: InPost ShipmentProviderInterface — ma checkpoint:decision

View File

@@ -1,7 +1,7 @@
# PAUL Handoff
**Date:** 2026-03-13
**Status:** paused
**Status:** paused — session complete, plans ready for execution
---
@@ -9,50 +9,45 @@
You have no prior context. This document tells you everything.
**Project:** orderPRO — aplikacja do zarządzania zamówieniami z wielu kanałów sprzedaży (Allegro, Erli, własne sklepy). Generowanie etykiet kurierskich.
**Core value:** Sprzedawca obsługuje wszystkie kanały i nadaje przesyłki bez przełączania platform.
**Project:** orderPRO — aplikacja do zarządzania zamówieniami z wielu źródeł sprzedaży (Allegro, Erli, shopPRO) z generowaniem etykiet przewozowych.
**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 State
**Version:** v0.1.0 (In Progress)
**Phase:** 6 of TBD — 06-sonarqube-quality
**Plan:** 06-01 ✓ DONE, 06-03 ✓ DONE, 06-02/04/05/06 awaiting
**Milestone:** v0.2 Pre-Expansion Fixes
**Phase:** 7 — pre-expansion-fixes
**Plan:** 07-01..07-05 CREATED, żaden nie wykonany
**Loop Position:**
```
PLAN ──▶ APPLY ──▶ UNIFY
[loop closed — ready for next plan]
[Plan gotowy — czeka na APPLY]
```
---
## What Was Done (this session)
## What Was Done (ta sesja)
- **UNIFY 06-01** — zamknięto pętlę dla exception hierarchy (commit 3c27c4e)
- **APPLY 06-03** — IntegrationSources + RedirectPaths constants created; 30+ literals replaced (commit d7d3f99)
- Auto-fix: naprawiono złamane `use AppCoreExceptions...` z planu 06-01 w AllegroOrderImportService + AllegroIntegrationController
- **UNIFY 06-03** — pętla zamknięta, SUMMARY.md utworzony
- Phase 6 progress: 2/6 plans complete (33%)
---
## What's In Progress
Nic — obie pętle zamknięte, codebase w stabilnym stanie.
- UNIFY 06-05: god classes split — ShopproOrdersSyncService 39→9 metod, AllegroIntegrationController 35→25 metod
- Faza 06 zamknięta: 6/6 planów, SonarQube quality baseline
- /paul:complete-milestone: v0.1 Initial Release zamknięty, git tag v0.1.0
- CONCERNS.md skategoryzowany — "przed rozbudową" vs "odroczić"
- Faza 07 zaplanowana: 5 planów (07-01..07-05) gotowe do APPLY
---
## What's Next
**Immediate:** `/paul:apply .paul/phases/06-sonarqube-quality/06-02-PLAN.md`
— php:S1142 redukcja return statements (save() z 5→≤3 w AllegroIntegrationController + ShopproIntegrationsController)
**Immediate:** `/paul:apply .paul/phases/07-pre-expansion-fixes/07-01-PLAN.md`
**Kolejność pozostałych planów:** 06-02 → 06-06 → 06-04 → 06-05
- 06-05 (god classes) zależy od 06-04 i ma `checkpoint:human-verify` (nie autonomous)
**Uwaga:** Warto sprawdzić czy broken `use` statements z 06-01 są w innych plikach Modules/Settings/ (wzorzec: `use AppCore...` bez backslashy)
Kolejność:
1. 07-01 — autonomiczny (Performance: N+1, static cache, DB indexes)
2. 07-02 — autonomiczny (SSL verify, cron→DB, migration 000014b)
3. 07-03 — ma checkpoint:human-verify (UX: disable orderpro_to_allegro, UI items 14-17)
4. 07-04 — autonomiczny (Tests: AllegroTokenManager + import)
5. 07-05 — ma checkpoint:decision (InPost ShipmentProviderInterface)
---
@@ -61,19 +56,18 @@ Nic — obie pętle zamknięte, codebase w stabilnym stanie.
| File | Purpose |
|------|---------|
| `.paul/STATE.md` | Live project state |
| `.paul/ROADMAP.md` | Phase overview |
| `.paul/phases/06-sonarqube-quality/06-02-PLAN.md` | S1142: Redukcja return statements |
| `.paul/phases/06-sonarqube-quality/06-03-SUMMARY.md` | Ostatni UNIFY — context dla 06-02 |
| `src/Core/Constants/IntegrationSources.php` | Nowa klasa stałych (ALLEGRO, SHOPPRO, etc.) |
| `src/Core/Constants/RedirectPaths.php` | Nowa klasa stałych (redirect paths) |
| `.paul/codebase/CONCERNS.md` | Pełna lista concerns |
| `.paul/phases/07-pre-expansion-fixes/07-01-PLAN.md` | Performance fixes |
| `.paul/phases/07-pre-expansion-fixes/07-02-PLAN.md` | SSL + cron + migration |
| `.paul/phases/07-pre-expansion-fixes/07-03-PLAN.md` | UX fixes (checkpoint) |
| `.paul/phases/07-pre-expansion-fixes/07-04-PLAN.md` | Unit tests |
| `.paul/phases/07-pre-expansion-fixes/07-05-PLAN.md` | InPost provider (checkpoint:decision) |
---
## Resume Instructions
1. Przeczytaj `.paul/STATE.md` — potwierdź pozycję w loop
2. Uruchom `/paul:apply .paul/phases/06-sonarqube-quality/06-02-PLAN.md`
1. `/paul:resume` — odczyta STATE.md i pokaże aktualny stan
2. Zatwierdź: `/paul:apply .paul/phases/07-pre-expansion-fixes/07-01-PLAN.md`
---

View File

@@ -0,0 +1,122 @@
---
phase: 07-pre-expansion-fixes
plan: 01
subsystem: database
tags: [performance, n+1, sql-optimization, indexes, static-cache]
requires:
- phase: 06-sonarqube-quality
provides: OrdersRepository refactored (god class split)
provides:
- Aggregating LEFT JOINs replacing N+1 correlated subqueries in orders list
- Static cache for information_schema check
- Performance indexes on orders table
affects: [07-02, 07-03, 07-04]
tech-stack:
added: []
patterns: [aggregating-left-join, static-property-cache]
key-files:
created:
- database/migrations/20260314_000048_add_orders_performance_indexes.sql
modified:
- src/Modules/Orders/OrdersRepository.php
key-decisions:
- "allegro_order_status_mappings index skipped — already has UNIQUE KEY on allegro_status_code"
- "Migration date 20260314 (execution date, not plan date)"
patterns-established:
- "Aggregating LEFT JOIN zamiast correlated subqueries dla countów/sum w listach"
- "Static property cache dla information_schema lookups"
duration: ~8min
started: 2026-03-14
completed: 2026-03-14
---
# Phase 7 Plan 01: Performance Fixes Summary
**Eliminacja N+1 subqueries w liście zamówień, static cache dla information_schema, indeksy wydajnościowe na tabeli orders**
## Performance
| Metric | Value |
|--------|-------|
| Duration | ~8min |
| Started | 2026-03-14 |
| Completed | 2026-03-14 |
| Tasks | 3 completed |
| Files modified | 2 (1 modified, 1 created) |
## Acceptance Criteria Results
| Criterion | Status | Notes |
|-----------|--------|-------|
| AC-1: Brak correlated subqueries w liście zamówień | Pass | 4 subqueries zastąpione aggregating LEFT JOINs; grep potwierdza zero `SELECT COUNT(*) FROM order_items WHERE oi.order_id` |
| AC-2: information_schema nie odpytywany per-request | Pass | `private static ?bool $supportsMappedMedia` + `self::$supportsMappedMedia` — max 1× na cykl PHP |
| AC-3: Brakujące indeksy dodane migracją | Pass | Migracja 000048: source, external_status_id, ordered_at, composite (source, external_status_id); IF NOT EXISTS |
## Accomplishments
- 4 correlated subqueries (items_count, items_qty, shipments_count, documents_count) → 3 aggregating LEFT JOINs — eliminacja ~200 dodatkowych zapytań przy 50 wierszach na stronę
- `canResolveMappedMedia()` z instance na static property — information_schema odpytywany max 1× na cykl PHP
- 4 brakujące indeksy na tabeli orders dla typowych filtrów/sortowań
## Files Created/Modified
| File | Change | Purpose |
|------|--------|---------|
| `src/Modules/Orders/OrdersRepository.php` | Modified | LEFT JOINs zamiast subqueries w buildListSql(); static cache w canResolveMappedMedia() |
| `database/migrations/20260314_000048_add_orders_performance_indexes.sql` | Created | Indeksy: source, external_status_id, ordered_at, composite (source, external_status_id) |
| `DOCS/DB_SCHEMA.md` | Modified | Wpis o migracji 000048 |
| `DOCS/TECH_CHANGELOG.md` | Modified | Wpis 2026-03-14 o optymalizacjach |
## Decisions Made
| Decision | Rationale | Impact |
|----------|-----------|--------|
| Pominięto indeks na allegro_order_status_mappings.allegro_status_code | Tabela już ma UNIQUE KEY na tej kolumnie (migracja 000025) | Brak duplikatu indeksu |
| Data migracji 20260314 zamiast 20260313 | Wykonanie w dniu 2026-03-14 | Numeracja zgodna z datą faktycznego utworzenia |
## Deviations from Plan
### Summary
| Type | Count | Impact |
|------|-------|--------|
| Auto-fixed | 0 | - |
| Scope additions | 0 | - |
| Deferred | 0 | - |
**Total impact:** Plan wykonany zgodnie ze specyfikacją. Jedyna różnica: pominięcie zbędnego indeksu na allegro_order_status_mappings (UNIQUE KEY już istniał).
## Issues Encountered
None
## Verification Results
```
✓ php -l src/Modules/Orders/OrdersRepository.php — No syntax errors
✓ grep correlated subqueries — 0 matches (eliminated)
✓ grep supportsMappedMedia — static + self:: confirmed
✓ Migration 000048 — exists, non-empty, idempotent (IF NOT EXISTS)
```
## Next Phase Readiness
**Ready:**
- OrdersRepository zoptymalizowany — lista zamówień gotowa na wzrost danych
- Plan 07-02 (SSL + cron + migration) niezależny, może być wykonany natychmiast
**Concerns:**
- Migracja 000048 wymaga uruchomienia na środowisku docelowym
**Blockers:**
- None
---
*Phase: 07-pre-expansion-fixes, Plan: 01*
*Completed: 2026-03-14*

View File

@@ -0,0 +1,132 @@
---
phase: 07-pre-expansion-fixes
plan: 02
subsystem: security, infra
tags: [ssl, curl, cron-throttle, migration-dedup, app-settings]
requires:
- phase: 06-sonarqube-quality
provides: ApiClient classes refactored
provides:
- SSL verification in all 4 ApiClient classes
- DB-backed cron web throttle (no more $_SESSION dependency)
- Deduplicated migration sequence (000014b)
affects: [07-03, 07-04, 07-05]
tech-stack:
added: []
patterns: [getCaBundlePath-per-client, app-settings-as-kv-store]
key-files:
created:
- database/migrations/20260314_000049_add_cron_last_run_at_setting.sql
modified:
- src/Modules/Settings/AllegroApiClient.php
- src/Modules/Settings/AllegroOAuthClient.php
- src/Modules/Settings/ShopproApiClient.php
- src/Modules/Settings/ApaczkaApiClient.php
- src/Core/Application.php
- .env.example
- database/migrations/20260301_000014b_add_products_sku_format_setting.sql (renamed)
key-decisions:
- "getCaBundlePath() per class — no shared trait, acceptable duplication for 4 classes"
- "ON DUPLICATE KEY UPDATE with named params :ts/:ts2 (PDO limitation — no repeated named params)"
patterns-established:
- "SSL: CURLOPT_SSL_VERIFYPEER=true + CURLOPT_SSL_VERIFYHOST=2 + CURLOPT_CAINFO in every curl call"
- "app_settings as key-value store for cross-session state"
duration: ~10min
started: 2026-03-14
completed: 2026-03-14
---
# Phase 7 Plan 02: SSL + Cron Throttle + Migration Dedup Summary
**SSL verification w 4 ApiClient klasach, cron throttle przeniesiony z $_SESSION do app_settings DB, deduplikacja migracji 000014**
## Performance
| Metric | Value |
|--------|-------|
| Duration | ~10min |
| Started | 2026-03-14 |
| Completed | 2026-03-14 |
| Tasks | 3 completed |
| Files modified | 8 (6 modified, 1 created, 1 renamed) |
## Acceptance Criteria Results
| Criterion | Status | Notes |
|-----------|--------|-------|
| AC-1: SSL weryfikowany w każdym cURL wywołaniu | Pass | 6 curl_setopt_array blocks w 4 plikach mają CURLOPT_SSL_VERIFYPEER=true + VERIFYHOST=2 + CAINFO |
| AC-2: Web cron throttle oparty na DB | Pass | $_SESSION['cron_web_last_run_at'] usunięty; getWebCronLastRunAt()/setWebCronLastRunAt() czytają/piszą app_settings |
| AC-3: Migracja 000014 zdeduplikowana | Pass | git mv → 000014b; INSERT ON DUPLICATE KEY UPDATE (idempotentna) |
## Accomplishments
- 4 klasy ApiClient (6 miejsc cURL) zabezpieczone SSL verification z fallback chain: ENV → XAMPP → system
- Cron web throttle nie zależy od sesji — działa poprawnie przy wielu aktywnych sesjach
- Sekwencja migracji czysta — brak duplikatów numerów
## Files Created/Modified
| File | Change | Purpose |
|------|--------|---------|
| `src/Modules/Settings/AllegroApiClient.php` | Modified | SSL opts w postJson(), postBinary(), requestJson() + getCaBundlePath() |
| `src/Modules/Settings/AllegroOAuthClient.php` | Modified | SSL opts w requestToken() + getCaBundlePath() |
| `src/Modules/Settings/ShopproApiClient.php` | Modified | SSL opts w requestJson() + getCaBundlePath() |
| `src/Modules/Settings/ApaczkaApiClient.php` | Modified | SSL opts w executeRequest() + getCaBundlePath() |
| `src/Core/Application.php` | Modified | isWebCronThrottled() → app_settings; +getWebCronLastRunAt(), +setWebCronLastRunAt() |
| `.env.example` | Modified | Dodano CURL_CA_BUNDLE_PATH |
| `database/migrations/20260314_000049_add_cron_last_run_at_setting.sql` | Created | Seed cron_web_last_run_at w app_settings |
| `database/migrations/20260301_000014b_...` | Renamed | git mv z 000014 na 000014b |
## Decisions Made
| Decision | Rationale | Impact |
|----------|-----------|--------|
| getCaBundlePath() w każdej klasie osobno | Brak wspólnego traita/klasy bazowej; 4 kopie to akceptowalna duplikacja vs. przedwczesna abstrakcja | Przyszła refaktoryzacja może wydzielić trait |
| PDO named params :ts/:ts2 w ON DUPLICATE KEY | PDO nie pozwala na powtórzenie tego samego named param; użyto dwóch nazw | Standardowy workaround |
## Deviations from Plan
### Summary
| Type | Count | Impact |
|------|-------|--------|
| Auto-fixed | 1 | Minimal |
| Scope additions | 0 | - |
| Deferred | 0 | - |
**Total impact:** Minimalna odchyłka — data pliku migracji zmieniona z 20260313 na 20260314.
### Auto-fixed Issues
**1. Data migracji**
- **Found during:** Task 2
- **Issue:** Plan proponował `20260313_000049`, ale wykonanie było 2026-03-14
- **Fix:** Użyto `20260314_000049` zgodnie z datą wykonania
- **Verification:** Plik istnieje, spójna konwencja nazewnicza
## Issues Encountered
None
## Next Phase Readiness
**Ready:**
- Wszystkie ApiClienty bezpieczne pod SSL — nowe integracje mogą kopiować wzorzec
- Cron throttle stabilny dla wielu sesji
- Plan 07-03 (UX fixes) niezależny, może być wykonany natychmiast
**Concerns:**
- Migracja 000049 wymaga uruchomienia na środowisku docelowym
**Blockers:**
- None
---
*Phase: 07-pre-expansion-fixes, Plan: 02*
*Completed: 2026-03-14*

View File

@@ -0,0 +1,145 @@
---
phase: 07-pre-expansion-fixes
plan: 03
subsystem: ui, security
tags: [ux, status-colors, ssl-hotfix, delivery-mapping-bug]
requires:
- phase: 07-pre-expansion-fixes
provides: Plan 07-02 SSL verification (hotfixed here)
provides:
- orderpro_to_allegro sync disabled (ok:false + UI disabled)
- Orders list: source before ID, "ID:" prefix, sourceLabel()
- Status badges colored by group color_hex from config
- Darker form borders (#e2e8f0#b0bec5)
- SSL getCaBundlePath() hotfix — nullable, CAINFO only when file exists
affects: [07-04, 07-05]
tech-stack:
added: []
patterns: [statusColorMap, sourceLabel, conditional-curlopt-cainfo]
key-files:
modified:
- src/Modules/Settings/AllegroStatusSyncService.php
- resources/views/settings/allegro.php
- src/Modules/Orders/OrdersController.php
- resources/scss/shared/_ui-components.scss
- public/assets/css/app.css
- src/Modules/Settings/AllegroApiClient.php
- src/Modules/Settings/AllegroOAuthClient.php
- src/Modules/Settings/ShopproApiClient.php
- src/Modules/Settings/ApaczkaApiClient.php
key-decisions:
- "sourceLabel() z match expression — mapuje shoppro→shopPRO, allegro→Allegro, erli→Erli"
- "statusColorMap() z group color_hex — status badge inline style gdy kolor dostępny, fallback na CSS klasy"
- "SSL CURLOPT_CAINFO warunkowy — null gdy żaden CA bundle nie znaleziony, cURL używa systemowego"
patterns-established:
- "Status coloring: statusColorMap() + inline style background-color + color:#fff"
- "SSL: getCaBundlePath() nullable + withSslOptions() helper (AllegroApiClient)"
duration: ~20min
started: 2026-03-14
completed: 2026-03-14
---
# Phase 7 Plan 03: UX Fixes Summary
**Disable orderpro_to_allegro sync, source/ID swap w liście zamówień, kolorowanie statusów, ciemniejsze bordery + hotfix SSL CA bundle**
## Performance
| Metric | Value |
|--------|-------|
| Duration | ~20min |
| Started | 2026-03-14 |
| Completed | 2026-03-14 |
| Tasks | 3 completed (+ checkpoint) |
| Files modified | 10 |
## Acceptance Criteria Results
| Criterion | Status | Notes |
|-----------|--------|-------|
| AC-1: orderpro_to_allegro nie daje false-positive | Pass | `ok: false` w early return |
| AC-2: Opcja UI disabled | Pass | `disabled` + "(wkrótce)" na option |
| AC-3: Source przed ID + prefix "ID:" | Pass | sourceLabel() + swap kolejności spanów |
| AC-4: Statusy kolorowane | Pass | statusColorMap() → inline style background-color |
| AC-5: Ciemniejsze obramowanie | Pass | --c-border: #e2e8f0#b0bec5, CSS rebuilt |
## Accomplishments
- orderpro_to_allegro sync zwraca ok:false (nie ok:true), opcja UI disabled z "(wkrótce)"
- Lista zamówień: source (Allegro/shopPRO/Erli) przed ID z prefixem "ID:"
- Statusy kolorowane kolorem grupy z konfiguracji, fallback na CSS klasy dla niezamapowanych
- Ciemniejsze obramowanie formularzy w całej aplikacji
- **Hotfix SSL:** getCaBundlePath() zwraca null gdy żaden CA bundle nie znaleziony — cURL używa systemowego domyślnego, eliminuje błąd na serwerze
## Files Created/Modified
| File | Change | Purpose |
|------|--------|---------|
| `src/Modules/Settings/AllegroStatusSyncService.php` | Modified | ok:true → ok:false dla orderpro_to_allegro |
| `resources/views/settings/allegro.php` | Modified | disabled + "(wkrótce)" na opcji sync direction |
| `src/Modules/Orders/OrdersController.php` | Modified | sourceLabel(), statusColorMap(), statusBadge() z kolorem, swap source/ID |
| `resources/scss/shared/_ui-components.scss` | Modified | --c-border: #b0bec5 |
| `public/assets/css/app.css` | Rebuilt | CSS z nowym border color |
| `src/Modules/Settings/AllegroApiClient.php` | Modified | getCaBundlePath() nullable + withSslOptions() |
| `src/Modules/Settings/AllegroOAuthClient.php` | Modified | getCaBundlePath() nullable, warunkowy CAINFO |
| `src/Modules/Settings/ShopproApiClient.php` | Modified | getCaBundlePath() nullable, warunkowy CAINFO |
| `src/Modules/Settings/ApaczkaApiClient.php` | Modified | getCaBundlePath() nullable, warunkowy CAINFO |
## Decisions Made
| Decision | Rationale | Impact |
|----------|-----------|--------|
| sourceLabel() match expression | Czytelne mapowanie 3 znanych źródeł + ucfirst fallback | Łatwe do rozszerzenia o nowe źródła |
| Status color inline style | group color_hex z konfiguracji; brak kolumny color w wierszu zamówienia | Nie wymaga migracji, kolor pochodzi z istniejącej tabeli order_status_groups |
| SSL CAINFO warunkowy | Serwer produkcyjny nie ma lokalnych CA bundle paths, cURL ma wbudowany systemowy | Eliminuje błąd "error setting certificate verify locations" |
## Deviations from Plan
### Summary
| Type | Count | Impact |
|------|-------|--------|
| Auto-fixed | 1 | Critical — SSL hotfix z planu 07-02 |
| Scope additions | 0 | - |
| Deferred | 1 | Pre-existing bug |
### Auto-fixed Issues
**1. SSL CA bundle path error na serwerze**
- **Found during:** Checkpoint verification (user report)
- **Issue:** getCaBundlePath() zwracał hardcoded path który nie istnieje na serwerze → cURL error
- **Fix:** getCaBundlePath() zwraca null gdy brak pliku; CURLOPT_CAINFO ustawiany warunkowo
- **Files:** 4 ApiClient klasy
- **Verification:** User potwierdzi po deploy
### Deferred Items
- **Pre-existing:** Pole "Szukaj..." w mapowaniu form dostawy Allegro — JS `attachSelectFilter()` tworzy input search dla InPost/Apaczka selectów, layout myląco wygląda jakby należał do wiersza powyżej
## Issues Encountered
| Issue | Resolution |
|-------|------------|
| SSL error na serwerze produkcyjnym | getCaBundlePath() → nullable, CAINFO warunkowy |
## Next Phase Readiness
**Ready:**
- UX fixes wdrożone, lista zamówień czytelniejsza
- Plan 07-04 (testy) niezależny
**Concerns:**
- Delivery mapping "Szukaj..." layout — pre-existing, do naprawy osobno
**Blockers:**
- None
---
*Phase: 07-pre-expansion-fixes, Plan: 03*
*Completed: 2026-03-14*