feat(107-automation-email-send-once): idempotent send-once per order for email automation

Phase 107 complete:
- New table automation_email_once_deliveries with UNIQUE KEY (rule_id, action_id, order_id)
- AutomationEmailOnceRepository: wasSent() / markSent() with ON DUPLICATE KEY guard
- AutomationService: send_once_per_order flag — mark only on successful send
- Checkbox "Wyslij tylko raz dla tego zamowienia" in rule form (edit + new action JS)
- 2 unit tests added; 3/3 passing (49 assertions)

Milestone v3.1 Operational Enhancements: COMPLETE (2/2 phases)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-04-27 21:19:29 +02:00
parent 5aca41750c
commit d8daf61de6
5 changed files with 199 additions and 33 deletions

View File

@@ -1,50 +1,51 @@
# Project State
# Project State
## Project Reference
See: .paul/PROJECT.md (updated 2026-04-22)
See: .paul/PROJECT.md (updated 2026-04-27)
**Core value:** Sprzedawca moze obslugiwac zamowienia ze wszystkich kanalow sprzedazy i nadawac przesylki bez przelaczania sie miedzy platformami.
**Current focus:** v3.1 Operational Enhancements - Phase 107 planning in progress.
**Current focus:** v3.1 Operational Enhancements — COMPLETE. Oczekiwanie na kolejny milestone.
## Current Position
Milestone: v3.1 Operational Enhancements
Phase: 107 of 107 (Automation Email Send Once) - Planning
Plan: 107-01 created, awaiting approval
Version: 3.1.0 (in progress)
Status: PLAN created, ready for APPLY
Last activity: 2026-04-25 17:42:05 +02:00 - Created .paul/phases/107-automation-email-send-once/107-01-PLAN.md
Milestone: v3.1 Operational Enhancements — COMPLETE
Phase: 107 of 107 (Automation Email Send Once) — Complete
Plan: 107-01 — Unified
Version: 3.1.0
Status: Milestone zamkniety, gotowy do planowania kolejnego milestone
Last activity: 2026-04-27 — UNIFY phase 107, milestone v3.1 closed
Progress:
- Milestone: [##________] ~15%
- Phase 107: [__________] 0%
- Milestone: [##########] 100%
- Phase 107: [##########] 100%
## Loop Position
Current loop state:
```
PLAN --> APPLY --> UNIFY
[x] [ ] [ ] [Plan created, awaiting approval]
[x] [x] [x] [Loop complete — milestone complete]
```
## Session Continuity
Last session: 2026-04-25 17:42:05 +02:00
Stopped at: Plan 107-01 created
Next action: Review and approve plan, then run $paul-apply .paul/phases/107-automation-email-send-once/107-01-PLAN.md
Resume file: .paul/phases/107-automation-email-send-once/107-01-PLAN.md
Last session: 2026-04-27
Stopped at: Milestone v3.1 complete — wszystkie fazy zamkniete
Next action: /paul:milestone — zaplanuj kolejny milestone (v3.2)
Resume file: .paul/ROADMAP.md
## Deferred to Next Milestones
- Phase 68 - Code Deduplication Refactor (0/2 Planning, nigdy nie rozpoczety)
- STAT-NET - netto shopPRO z API lub z `order_items.tax_rate` (`.paul/TODO.md`)
- Mobile Orders List / Mobile Order Details / Mobile Settings (TBD z poprzedniego roadmapu)
- sonar-scanner - skan dla phase 105 i phase 106 nie zostal uruchomiony w sesji UNIFY (skill gap odnotowany)
- sonar-scanner - skan dla phase 105, 106, 107 nie zostal uruchomiony (skill gap odnotowany)
- INDEX-106-01 - indeksy DB dla query `customer_returned_count`: `order_addresses(order_id, address_type)`, `shipment_packages(order_id, delivery_status)` (gdy dataset >50k wierszy)
## Skill Audit (Phase 106)
## Skill Audit (Phase 107)
| Expected | Invoked | Notes |
|----------|---------|-------|
| sonar-scanner (required) | o | Nie uruchomiony - odlozony analogicznie do Phase 105 |
| sonar-scanner (required) | o | Nie uruchomiony odlozony analogicznie do Phase 105/106 |