Skip to content

Commit c2719e1

Browse files
caseylockerclaude
andcommitted
docs(promo-codes): add D10/D11 deviations for CSV import and migration rollback
D10: blank CSV cell for allowed_email_domains produced [''] which silently bricked promo codes by rejecting all emails. D11: migration down() DELETE cascaded through SummitAttendeeTicket FK, destroying ticket history. Replaced with UPDATE to base types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c3f8df7 commit c2719e1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

doc/promo-codes-for-early-registration-access.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,15 @@ Deviations from the SDS captured during implementation. Each entry is either **O
232232
| D7 | `addAllowedTicketType` overrides are no-ops | NIT | ACCEPTED | 3, 4 | SDS specifies overriding `addAllowedTicketType()` on both types. The override just calls `parent::addAllowedTicketType()` which already accepts any ticket type. Present for documentation intent per SDS, but functionally dead code. |
233233
| D8 | `AutoApply` included in new joined-table CREATE statements | NIT | ACCEPTED | 1 | Task 1 Key Decisions enumerates only `ID`, `AllowedEmailDomains`, `QuantityPerAccount` as columns on `DomainAuthorizedSummitRegistrationDiscountCode` and `DomainAuthorizedSummitRegistrationPromoCode`. Migration additionally creates `AutoApply TINYINT(1) NOT NULL DEFAULT 0` on both new tables. Required by Task 2's `AutoApplyPromoCodeTrait` being mixed into the domain-authorized types; folding it into CREATE is cleaner than a follow-up ALTER. Acceptable — consistent with SDS intent (per-subtype joined-table storage, not base class). |
234234
| D9 | `AllowedEmailDomains` column is `JSON DEFAULT NULL` | NIT | ACCEPTED | 1 | SDS (Task 2) specifies trait default `[]`. MySQL 5.7/8.0 JSON columns cannot take a non-NULL literal default, so `DEFAULT NULL` is the only workable column-level default. The trait getter coerces NULL → `[]` at the application layer, preserving the documented default. |
235+
| D10 | CSV import: `allowed_email_domains` blank cell bricks promo code | MUST-FIX | RESOLVED | 6 | CSV import `explode('\|', '')` on a blank cell produces `['']`. The array is non-empty so `matchesEmailDomain()` enters the loop, skips the empty pattern, finds no match, and rejects every email — silently bricking the code. API path is unaffected (validated by `AllowedEmailDomainsArray`). Fixed: CSV import now trims, filters empty strings, and unsets the key if no valid domains remain. |
236+
| D11 | Migration `down()` DELETE cascades through ticket history | MUST-FIX | RESOLVED | 1 | `SummitAttendeeTicket.PromoCodeID` has `ON DELETE CASCADE` referencing `SummitRegistrationPromoCode(ID)`. The original `DELETE` in `down()` would silently destroy attendee ticket records linked to domain-authorized promo codes. Fixed: replaced with `UPDATE` to remap rows to base types (`SummitRegistrationDiscountCode` / `SummitRegistrationPromoCode`), preserving FK references while safely narrowing the ENUM. |
235237

236238
### Resolution Plan
237239

238240
- **D3 (RESOLVED):** `AllowedEmailDomainsArray` custom rule created at `app/Rules/AllowedEmailDomainsArray.php` and wired into `PromoCodesValidationRulesFactory.php` for both add and update paths on both domain-authorized types.
239241
- **D4 (RESOLVED):** All three review follow-ups applied: check relocated to `ApplyPromoCodeTask` inside the locked transaction, saga reordered (`ApplyPromoCodeTask` after `ReserveOrderTask`), count query widened to include `'Reserved'` status orders.
242+
- **D10 (RESOLVED):** CSV `allowed_email_domains` explode now trims, filters empties, and unsets if no valid domains remain. Both add and update import paths in `SummitPromoCodeService.php`.
243+
- **D11 (RESOLVED):** Migration `down()` uses `UPDATE ... SET ClassName = CASE` instead of `DELETE` to remap domain-authorized rows to base types, preserving `SummitAttendeeTicket` FK references.
240244

241245
## Implementation Tasks
242246

0 commit comments

Comments
 (0)