29 — Milestone 1 Delivery Plan (Blueprint §9.1)
Cursor-ready execution plan for Milestone 1: schema/migrations, campaign CRUD, and webhook-driven request creation.
29 — Milestone 1 Delivery Plan (Blueprint §9.1)
Section titled “29 — Milestone 1 Delivery Plan (Blueprint §9.1)”Source: 02-Implementation-Blueprint.md — §9 Release Plan → Milestone 1 (2 weeks).
Milestone 1 blueprint scope:
- DB schema + migrations
- Campaign CRUD
- Request creation from order webhook
This document is a build spec only. No code changes are implied until a task references this file.
Related: 20 (DB), 17/18 (campaign screens), 07 (request pipeline), 21 (route map), 24 (build standards).
0) Goal (one sentence)
Section titled “0) Goal (one sentence)”Ship a stable foundation where merchants can configure campaigns and order webhooks reliably create scheduled per-product testimonial request rows.
1) Scope lock (what is included)
Section titled “1) Scope lock (what is included)”In scope
Section titled “In scope”-
Prisma testimonial base schema and migrations:
TestimonialCampaignTestimonialCampaignProductTestimonialTemplate(minimum defaults)TestimonialRequestTestimonialRequestEvent- required
Shoptestimonial config fields
-
Campaign management:
- list screen
- create/edit screen
- pause/resume/archive/duplicate
-
Order webhook ingestion:
- webhook verification
- campaign eligibility
- one request row per eligible product line item
- idempotent writes
Out of scope
Section titled “Out of scope”- Public submission page (
/t/:token) - Media upload/processing
- Moderation screens
- Storefront widgets
- Analytics and billing pages
2) Deliverables
Section titled “2) Deliverables”D1 — Schema and migrations
Section titled “D1 — Schema and migrations”- Migration files applied on dev/staging
- Prisma client regenerated
- nullable-first strategy for phased rollout
D2 — Campaign CRUD
Section titled “D2 — Campaign CRUD”Routes:
/app/testimonial-campaigns/app/testimonial-campaigns/:id
Capabilities:
- create campaign
- edit settings
- set status active/paused/archived
- duplicate with target cloning
D3 — Webhook request creator
Section titled “D3 — Webhook request creator”Routes:
webhooks.orders.paidwebhooks.orders.fulfilled
Behavior:
- verify HMAC
- load active campaigns
- evaluate audience/trigger
- persist
TestimonialRequest+ initialTestimonialRequestEvent
3) Technical acceptance criteria
Section titled “3) Technical acceptance criteria”-
Schema
- Migrations run cleanly on fresh DB and upgraded DB.
- Unique constraints enforce no duplicate campaign-product mappings and no duplicate tokens.
-
Campaign CRUD
- Merchant can create active campaign with valid rules.
- Invalid config blocked by server validation.
- Duplicate campaign starts paused by default.
-
Webhook flow
- Valid webhook creates expected request rows.
- Replay of same webhook creates zero duplicates.
- Inactive campaign does not generate requests.
-
scheduledForrespectsdelayDays(UTC).
4) Test matrix (minimum)
Section titled “4) Test matrix (minimum)”Webhook scenarios
Section titled “Webhook scenarios”- order paid, one eligible product, one campaign -> 1 request
- order fulfilled, 3 eligible products -> 3 requests
- order paid, no active campaign -> 0 requests
- webhook replay -> no additional requests
- bad HMAC -> no writes
Campaign scenarios
Section titled “Campaign scenarios”- all-products campaign save
- targeted products campaign save
- pause/resume status transitions
- duplicate campaign copies mappings
5) Risks and mitigations
Section titled “5) Risks and mitigations”-
Duplicate sends from duplicate requests
- Mitigation: unique business key + idempotent webhook logic.
-
Campaign misconfiguration
- Mitigation: activation guardrails and required field checks.
-
Timezone drift in scheduling
- Mitigation: persist and compute all schedule timestamps in UTC.
6) Suggested implementation order (Cursor)
Section titled “6) Suggested implementation order (Cursor)”- Implement schema migration subset for Milestone 1 only.
- Scaffold campaign list/create-edit routes and validations.
- Implement webhook routes with verification and idempotency.
- Add request creation service and event writes.
- Add minimal seed/default templates for pipeline compatibility.
- Run integration tests and webhook replay tests.
7) Done definition (Milestone 1)
Section titled “7) Done definition (Milestone 1)”Milestone 1 is complete when:
- campaigns are merchant-editable and status-controlled,
- order events generate deterministic request rows,
- duplicate deliveries are safe,
- groundwork is ready for Milestone 2 public submission flow.
8) References
Section titled “8) References”02-Implementation-Blueprint.md— §9 Milestone 120-database-design-and-migrations-blueprint-section-5.md17-campaigns-list-screen-2.md18-campaign-create-edit-screen-3.md07-email-sms-request-delivery-pipeline.md
9) Note on numbering
Section titled “9) Note on numbering”This folder already includes 05 through 28 plans. This file is 29-....