# Phase Handover — Loyalty 7.4 Campaign Engine

## Metadata

| Field | Value |
| --- | --- |
| Phase ID | loyalty-7.4 |
| Title | Campaign Engine |
| Status | Complete |
| Service(s) | loyalty (`loyalty-service`, port 8004) |
| Version | 0.7.4.0 |
| Date | 2026-07-26 |
| ADR(s) | ADR-001, ADR-003, ADR-006, ADR-011 |

## Reusable Components

| Component | Location | Reuse notes |
| --- | --- | --- |
| CampaignEngineService | `app/services/campaign_engine.py` | Lifecycle + apply grants |
| CampaignApplication | `app/models/campaigns.py` | Application tracking pattern |

## Public APIs

Lifecycle + rules + apply + applications list under `/api/v1/campaigns/{id}/…`

## Events

`loyalty.campaign.scheduled|activated|paused|resumed|expired|rules_updated|applied`

## Extension Points

| Extension point | How to extend | Forbidden uses |
| --- | --- | --- |
| Rules JSON | Extend validators + grant math | Mutate balances directly |
| Referral bonuses | Call CampaignEngine or PointEngine from 7.5 | Bypass application tracking |

## Known Limitations

- No scheduled auto-activate/expire worker
- Rules are JSON document, not a visual rule builder

## Migration Notes

| Item | Detail |
| --- | --- |
| Alembic | `0005_phase_74_campaigns` |
| Breaking | None |

## Next Phase Entry

| Field | Value |
| --- | --- |
| Recommended next phase | loyalty-7.5 |
| Blockers | None |
| Entry checklist | Reuse PointEngine for referral rewards |

## Completion Sign-Off

- [x] Tests green (87)
- [x] Docs + snapshot + manifests
- [x] Quality gates

## Related Documents

- [loyalty-phase-7-4.md](../loyalty-phase-7-4.md)
- [loyalty-phase-7-3.md](../loyalty-phase-7-3.md)
