feat(112): re-import data protection — delta-only re-import + project_generated preservation

Phase 112 / Plan 112-01 complete (v3.6):
- OrderImportRepository::upsertOrderAggregate split into create vs re-import paths
- replaceAddresses/Items/Notes/Shipments/StatusHistory invoked only on first import
- new updateOrderDelta() narrows UPDATE to status_code (cond.), payment_status,
  total_paid, is_canceled_by_buyer, source_updated_at, payload_json, fetched_at
- source-side cancellation override (is_canceled_by_buyer=1 OR pull status_code='anulowane')
- identical-payload no-op guard via normalizePayloadJson()
- fixes case #882: order_items.id stable, project_generated (Phase 97) preserved
- Phase 111 payment.status_changed emit retained without regression

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-07 23:22:37 +02:00
parent 0e457aed38
commit 782a291210
10 changed files with 638 additions and 73 deletions

View File

@@ -2,49 +2,56 @@
## Project Reference
See: .paul/PROJECT.md (updated 2026-04-28)
See: .paul/PROJECT.md (updated 2026-05-07)
**Core value:** Sprzedawca moze obslugiwac zamowienia ze wszystkich kanalow sprzedazy i nadawac przesylki bez przelaczania sie miedzy platformami.
**Current focus:** Brak aktywnego milestone - v3.4 zamkniety
**Current focus:** Brak aktywnego milestone - v3.6 zamkniety
## Current Position
Milestone: v3.5 Payment Transition Event (hotfix) — COMPLETE
Phase: 111 of 111 (Payment Transition Event) — COMPLETE
Plan: 111-01 — COMPLETE
Status: v3.5 shipped, awaiting transition (commit) i nastepny milestone
Last activity: 2026-05-05UNIFY Phase 111 / Plan 111-01 complete
Milestone: v3.6 Re-import Data Protection (hotfix) — COMPLETE
Phase: 112 of 112 (Re-import Data Protection) — COMPLETE
Plan: 112-01 — COMPLETE
Status: v3.6 shipped, oczekiwanie na nastepny milestone
Last activity: 2026-05-07Transition Phase 112 / Plan 112-01 complete (PROJECT.md + ROADMAP.md updated, git commit)
Progress:
- Milestone v3.5: [##########] 100% (1/1 phases, 1/1 plans)
- Phase 111: [##########] 100%
- Milestone v3.6: [##########] 100% (1/1 phases, 1/1 plans)
- Phase 112: [##########] 100%
## Loop Position
Current loop state:
```
v3.5 milestone:
Phase 111 (Payment Transition Event):
Plan 111-01: PLAN done APPLY done UNIFY done
-> Phase 111 closed
-> v3.5 milestone closed (pending transition commit)
v3.6 milestone:
Phase 112 (Re-import Data Protection):
Plan 112-01: PLAN ✓ → APPLY ✓ → UNIFY
-> Phase 112 closed
-> v3.6 milestone closed (pending transition commit)
```
```
PLAN ──▶ APPLY ──▶ UNIFY
✓ ✓ ✓ [Loop complete]
```
## Session Continuity
Last session: 2026-05-05
Stopped at: v3.5 milestone closed
Next action: transition-phase (PROJECT/ROADMAP update + git commit), nastepnie /paul:milestone
Resume file: .paul/phases/111-payment-transition-event/111-01-SUMMARY.md
Last session: 2026-05-07
Stopped at: v3.6 milestone closed (Phase 112 transitioned)
Next action: manualne testy AC-1..AC-7 na zywej bazie (XAMPP), backfill #882, nastepnie /paul:milestone (nowy milestone)
Resume file: .paul/phases/112-reimport-data-protection/112-01-SUMMARY.md
## Git State
Last commit: feat(110): statistics summary
Last commit: 0e457ae update
Branch: main
Feature branches merged: none
## Pending Actions
- Manualne testy AC-1..AC-7 dla Phase 112 na zywej bazie (XAMPP online)
- Backfill zamowienia #882 — operator robi recznie po wdrozeniu (poza zakresem planu)
- Uruchom migracje gdy XAMPP online: `php bin/migrate.php` (delivery_statuses)
- Recznie odtworzyc istniejace reguly automatyzacji z grupowymi kluczami (BREAKING z 108-02)
@@ -72,4 +79,4 @@ Feature branches merged: none
- Local HTTP verification blocked by MySQL/XAMPP connection refused.
- PHPUnit not run: `composer` unavailable in PATH and `vendor/` absent.
- Sonar issue import to `DOCS/todo.md` not performed because SonarQube MCP/resources are unavailable in this session.
- Sonar issue import to `DOCS/todo.md` not performed because SonarQube MCP/resources are unavailable in this session.