Files
shopPRO/.paul/STATE.md
Jacek Pyziak 073069c303 fix: dziala aktualizacja systemu i Wyczysc cache na /admin/update/main_view/ (v0.353)
Zdalny changelog z shoppro.project-dc.pl/updates/changelog.php zwracal
niezbalansowany HTML (niezamkniety <script>/<style>/<textarea>/<!--),
ktory "polykal" reszte dokumentu - inline-script z handlerami
#confirm/#confirmUpdateAll i footer-script z main-layout.php
(#clear-cache-btn) nigdy nie parsowaly sie jako JS. Klienci nie mogli
aktualizowac shopPRO.

Fix w admin/templates/update/main-view.php:
1. Blok <script> z handlerami przeniesiony PRZED sekcje Changelog -
   handlery podpinaja sie niezaleznie od zdalnego HTML.
2. Sanityzacja zdalnego changeloga: preg_replace usuwa komentarze HTML,
   strip_tags z whitelista (<p><br><b><strong><i><em><u><ul><ol><li>
   <h1>-<h6><span><div><a><pre><code><hr>) wycina tagi strukturalne i
   wykonywalne (<script>, <style>, <iframe>, <textarea>).

Skutek uboczny: footer-script z main-layout.php (Wyczysc cache + globalne
wyszukiwanie + sprawdzanie aktualizacji) dziala teraz na podstronie update.

Po wgraniu na instancje: hard-reload (Ctrl+F5) + restart PHP-FPM /
wyczyszczenie OPcache.

Suita PHPUnit: 846 testow / 2348 assertions OK.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-13 23:10:08 +02:00

130 lines
10 KiB
Markdown

# Project State
## Project Reference
See: .paul/PROJECT.md (updated 2026-04-30)
**Core value:** Właściciel sklepu ma pełną kontrolę nad sprzedażą online w jednym systemie pisanym od podstaw, bez narzutów zewnętrznych platform.
**Current focus:** Phase 21 complete — loop closed
## Current Position
Milestone: Hotfix
Phase: 21 of 21 (Admin update view JS fix) — Complete
Plan: 21-01 complete
Status: UNIFY complete, ready for next PLAN loop (transition-phase git commit pending)
Last activity: 2026-05-13 — Closed loop for .paul/phases/21-admin-update-view-js-fix/21-01-PLAN.md
Progress:
- Milestone: [##########] 100% (Hotfix rolling)
- Phase 21: [##########] 100%
## Loop Position
Current loop state:
```
PLAN --> APPLY --> UNIFY
✓ ✓ ✓ [Loop complete - ready for next PLAN]
```
Previous phases:
```
Phase 4: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-12]
Phase 5: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-12]
Phase 6: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-12]
Phase 7: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-15]
Phase 8: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-16]
Phase 9: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-19]
Phase 10: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-19]
Phase 11: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-25]
Phase 12: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-25]
Phase 13: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-03-25]
Phase 14: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-04-16]
Phase 15: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-04-18]
Phase 16: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-04-19]
Phase 17: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-04-20]
Phase 18: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-04-30]
Phase 19: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-05-13]
Phase 20: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-05-13]
Phase 21: PLAN --> APPLY --> UNIFY ✓ ✓ ✓ [COMPLETE - 2026-05-13]
```
## Accumulated Context
### Decisions
- 2026-05-13: Phase 21 loop closed with SUMMARY at .paul/phases/21-admin-update-view-js-fix/21-01-SUMMARY.md
- 2026-05-13: Transition-phase git commit for Phase 21 not executed in this UNIFY run (deferred — pattern z faz 15-20)
- 2026-05-13: Phase 21 APPLY complete — admin/templates/update/main-view.php zmodyfikowany (reorder <script> przed sekcję Changelog + sanityzacja zdalnego changeloga: preg_replace komentarzy HTML + strip_tags z whitelistą tagów formatujących); php -l OK; suita 846 testów zielona; human-verify approved
- 2026-05-13: Created Phase 21 plan at .paul/phases/21-admin-update-view-js-fix/21-01-PLAN.md — fix niedziałających przycisków aktualizacji + Wyczyść cache w /admin/update/main_view/ (zdalny changelog z niezbalansowanym HTML "połykał" inline i footer-script). Reorder bloku <script> przed sekcję Changelog + sanityzacja zdalnego changeloga (strip_tags z whitelistą + usunięcie komentarzy HTML).
- 2026-05-13: Phase 20 loop closed with SUMMARY at .paul/phases/20-category-edit-mojibake-fix/20-01-SUMMARY.md
- 2026-05-13: Transition-phase git commit for Phase 20 not executed in this UNIFY run (deferred — pattern z faz 15-19)
- 2026-05-13: Phase 20 APPLY complete — 9 wystąpień mojibake w admin/templates/shop-category/category-edit.php naprawionych (Treść, Język domyślny x2, rozwinięcie, Sortowanie produktów, Wyświetlić podkategorie, Tytuł kategorii, Blokuj indeksację); suita 846 zielona; human-verify approved
- 2026-05-13: Created Phase 20 plan at .paul/phases/20-category-edit-mojibake-fix/20-01-PLAN.md — fix mojibake w labelkach formularza edycji kategorii (double-encoded UTF-8 w admin/templates/shop-category/category-edit.php, 9 wystąpień, jedyny dotknięty plik w repo)
- 2026-05-13: Phase 19 loop closed with SUMMARY at .paul/phases/19-frontend-meta-tags-fix/19-01-SUMMARY.md
- 2026-05-13: Transition-phase git commit for Phase 19 not executed in this UNIFY run (deferred — pattern z faz 15/16/17/18)
- 2026-05-13: Phase 19 APPLY complete — LayoutEngine.php zmodyfikowany (3 gałęzie + nowa metoda applyEntityMetaToPage), test LayoutEngineMetaTagsTest 5 testów/18 asercji, suita 846 zielona; weryfikacja na produkcji (curl) pokazuje poprawne tytuły dla /sen-i-otulenie, /kocyk-niemowlaka-... i /
- 2026-05-13: Phase 19 checkpoint:decision — wybrano `fix-engine-detection`. Root cause: LayoutEngine::show() w gałęziach category/article/product nadpisuje $page['language']['title'] ale NIE $page['language']['meta_title']. Wartość meta_title homepage ('Sklep z akcesoriami...') wycieka do linii 332. Dane DB klienta (literalne 'description'/'keywords' w kategorii) to oddzielny issue — admin uzupełnia.
- 2026-05-13: Created Phase 19 plan at .paul/phases/19-frontend-meta-tags-fix/19-01-PLAN.md — fix metatagów <title>/<meta description>/<meta keywords> dla kategorii i produktu (homepage tytuł wycieka na wszystkie podstrony)
- 2026-05-13: Phase 19 — najpierw diagnostyka (pp_routes + DB meta + session $page), checkpoint:decision, potem fix; ustalanie root cause przed implementacją (3 hipotezy: pp_routes destination bez category=/product=, sesyjny $page bleed, lub literalne zaślepki w DB)
- 2026-04-30: Phase 18 loop closed with SUMMARY at .paul/phases/18-google-feed-permutation-url-fix/18-01-SUMMARY.md
- 2026-04-30: Transition-phase git commit for Phase 18 not executed in this UNIFY run (deferred — pattern z faz 15/16/17)
- 2026-04-30: Phase 18 APPLY complete — 4 pliki silnika + 2 nowe pliki testów (HelpersRoutingTest 4 testy, ProductFeedLinkTest 3 testy); suita 841 zielona
- 2026-04-30: Created Phase 18 plan at .paul/phases/18-google-feed-permutation-url-fix/18-01-PLAN.md
- 2026-04-30: Phase 18 — separator URL permutacji `/``_`; konwersja `_``|` w warstwie front; regex `[0-9_-]+` w pp_routes
- 2026-04-30: Phase 18 — override /feature-dev (hotfix z konkretną instrukcją), brak redirectów 301, brak automatycznych akcji post-deploy
- 2026-04-20: Phase 17 loop closed with SUMMARY at .paul/phases/17-cart-summary-transport-cost-fix/17-01-SUMMARY.md
- 2026-04-20: Transition-phase git commit for Phase 17 not executed in this UNIFY run (deferred)
- 2026-04-20: Phase 17 APPLY complete - human-verify checkpoint approved, 834 testow zielonych (6 nowych)
- 2026-04-20: Created Phase 17 plan at .paul/phases/17-cart-summary-transport-cost-fix/17-01-PLAN.md
- 2026-04-20: Phase 17 bug root cause - summary-view.php blindly shows 0 zl gdy transport.delivery_free=1 bez sprawdzenia progu settings.free_delivery
- 2026-04-20: Phase 17 fix - nowa chroniona metoda ShopBasketController::calculateTransportCostForSummary zwraca transport_cost_effective + free_delivery_applies; szablon uzywa tych kluczy zamiast delivery_free
- 2026-04-19: Created Phase 16 plan at .paul/phases/16-product-list-custom-labels/16-01-PLAN.md
- 2026-04-19: Phase 16 scope includes session toggle + inline custom_label_0..4 edit + suggestions on product list
- 2026-04-19: Override approved by user - proceeded without required /feature-dev skill in Phase 16 APPLY
- 2026-04-19: /koniec-pracy acknowledged by user as available for session close workflow
- 2026-04-19: Human verify checkpoint approved after UX fixes (button style + autocomplete in single input)
- 2026-04-19: Product list custom labels final UX: single input with autocomplete, no separate select under field
- 2026-04-19: Transition-phase git commit for Phase 16 not executed in this UNIFY run
- 2026-04-18: Transition-phase git commit step pending (not executed during this UNIFY run)
- 2026-04-18: Phase 15 loop closed with SUMMARY at .paul/phases/15-scontainers-edit-save-fix/15-01-SUMMARY.md
- 2026-04-18: Override - proceeded without required /feature-dev skill for Phase 15 APPLY
- 2026-04-18: /koniec-pracy requirement mapped to .claude/commands/koniec-pracy.md guidance for end-of-session release flow
- 2026-04-18: Scontainers edit fix - ID from tabbed form can be omitted when hidden field is defined as FormField and not as hiddenFields
- Use existing `CouponRepository::markAsUsed()` instead of adding methods to stdClass
- 2026-03-16: Przyczyna braku wysyłki = brakujące $apiloRepository w use() closures cron.php (regresja z fazy 6)
- 2026-03-16: Retry -1 orders co 1h zamiast permanent failure
- 2026-03-16: Email notification o trwale failed Apilo jobach
- 2026-03-19: Order-related Apilo joby — infinite retry co 30 min (nigdy permanent failure)
- 2026-03-19: Email z danymi zamówienia + rozróżnienie PONAWIANY vs TRWAŁY BŁĄD
- 2026-03-19: Cleanup stuck sync_payment/sync_status jobów po udanym wysłaniu
- 2026-03-19: Edycja custom fields w koszyku — product_code przeliczany po zmianie, merge duplikatów przy identycznym hashu
- 2026-03-19: JS handlery koszyka w basket.php (nie basket-details.php) bo basket-details jest AJAX-replaceable
- 2026-03-25: view_cart event w basket.php (nie basket-details.php) — ten sam powód
- 2026-03-25: GA4 item format standard: item_id (string), item_name, price (number), quantity (int), google_business_vertical: "retail"
- 2026-03-25: Brak user_data w purchase — wymaga analizy RODO
- 2026-03-25: summaryView() redirect guard usunięty — blokował kolejne zamówienia po pierwszym (z change.md instancji klienta)
- 2026-03-25: Token zamówienia z jednorazowego na TTL 30 min — backward compat z plain string
- 2026-03-25: logOrder() — logowanie błędów zamówień do logs/logs-order-YYYY-MM-DD.log
- 2026-03-25: Redirect przy złym tokenie: /koszyk-podsumowanie zamiast /koszyk
- 2026-04-16: Custom fields delete fix — hidden marker `custom_field_name_present` zamiast `array_key_exists('custom_field_name')`
### Deferred Issues
None.
### Blockers/Concerns
None.
### Skill Audit (Phase 21)
| Expected | Invoked | Notes |
|----------|---------|-------|
| /feature-dev | ○ | Hotfix template-only z konkretną instrukcją w change.md — override per pattern poprzednich faz |
| /koniec-pracy | ○ | Pending — uruchomić przy release update package |
## Session Continuity
Last session: 2026-05-13
Stopped at: Phase 21 complete, loop closed
Next action: Start next phase plan (transition-phase git commit pending), lub uruchomić /koniec-pracy jeśli zamykamy sesję
Resume file: .paul/phases/21-admin-update-view-js-fix/21-01-SUMMARY.md
---
*STATE.md — Updated after every significant action*