# Synthetic test plan for a Canvas

A Canvas is ready when synthetic profiles prove every intended send and every intended suppression, with evidence an operator can re-read later. The template is [../assets/canvas-test-plan.yaml](../assets/canvas-test-plan.yaml); draft payloads for the worked example are in [../assets/example-acme-users-track.json](../assets/example-acme-users-track.json). Propose the finished plan for `martech-context/tracking-plan/<journey>.md` and write it only after the user approves.

## Choose the environment

In order of preference:

1. A separate test workspace with its own API key. Braze's integration guide recommends separate development and production environments so test data does not reach production.
2. Braze's documented live method: duplicate the Canvas, restrict its Entry Audience so only test profiles qualify (Braze's example uses an Email Address filter), shorten delays to seconds or minutes, and leave two to three minutes between runs so each action maps to one journey.
3. The production Canvas itself, only for a final smoke test with one or two test profiles, after 1 or 2 passed.

### Containment checklist before option 2 or 3

Restricting the duplicate's entry audience does not contain the fixtures. Their profiles and events also reach every other journey, report and export in the workspace. Before running in production:

- List every live campaign and Canvas that a fixture event triggers, or whose segment the fixtures would match (scheduled sends included). Use the dashboard; the MCP list tools (`get_canvas_list`, `get_campaign_list`) help find candidates, but entry audiences and triggers are read in the dashboard.
- Confirm each one excludes `qa_fixture` profiles or a test-user group. If one cannot, use the test workspace.
- The test workspace is mandatory when any other live Canvas or campaign uses a fixture event as its trigger or exit event, unless fixtures cannot enter it (API-triggered by another producer, or an entry audience that excludes `qa_fixture`).
- Keep fixtures unsubscribed, or unreachable, on every channel not under test.
- Ask the warehouse or reporting owner to filter `qa_fixture` profiles out of conversion reports, Currents and data share outputs.
- Record the expected usage of the run (fixture profiles and events count toward MAU, or toward data points on legacy data point contracts).

### What each tool proves

- "Test Canvas" (preview user paths): test users enter even when they are not eligible, assumed trigger events do not persist, and step types missing from the supported list are skipped (the list on 2026-10-17 omits Feature Flag, Send to Destination and JSON-editor User Update). Liquid may evaluate against the current time, not the simulated entry time. Use it for branch logic and content only.
- Context steps in Test Canvas: Braze's docs conflict. The preview page's supported-step list omits Context, while its Agent step guidance says to run Test Canvas so context variables are populated, and the Message Activity Log page suggests Preview user paths to check whether a context variable was set. Confirm on the live Canvas before relying on preview results that involve context variables.
- Test sends and Seed Groups: prove rendering, not eligibility. Seed Groups do not evaluate Context steps or context variables.
- Live synthetic profiles: the only way to prove entry, re-eligibility, exits, delays, permissions, caps, quiet hours and control groups.

## Fixture design rules

- Fictional identities in the plan file: `@example.com` addresses, placeholder phones such as `+15555550100`, external_ids built from a fixed placeholder (`qa-f2-00000000-0000-4000-8000-000000000002`). Fixtures that must physically receive email, push or SMS use inboxes, devices and phones the tester owns; their real values stay out of the plan and out of the conversation.
- One profile and one address per fixture. Use plus-addressing (`qa+f2@...`) when the tester routes every fixture to one inbox. Braze updates received, opened and clicked data on every profile that shares an email address, a profile can appear in Canvas messages received without entering, and a shared address still gets the email when one of its profiles is in the Global Control Group. Shared addresses mix evidence across fixtures.
- Name the fixture in a custom attribute (`qa_fixture: F2`) and in the external_id prefix (`qa-f2-`) in every environment, so containment filters and warehouse filters can exclude fixtures by either.
- Add every fixture profile and test device to an internal group with User Events recording turned on before the run. The Event User Log shows logs only for such members.
- Braze suggests putting the step name or user ID in test message titles with Liquid. Add the fixture ID too, so a received message identifies its own path. Do this only in the duplicated test Canvas.
- Every fixture states the expected outcome as a send or a suppression, the gate that should cause it, and the evidence that proves it.
- Every write (profile creation, events, Canvas triggers, subscription changes, Canvas setting changes) is drafted, approved by the user, and run by the user or with their approval against test profiles only. Event timestamps are set to the current UTC time at send, never copied from a draft.
- Before running, check each fixture's Global Control Group status on the Engagement tab. A fixture in the group cannot test sends; reassign it or record it as a control group test.

## Standard fixtures

Adapt names to the journey; drop fixtures that do not apply and record why.

- F1 happy path: eligible, no completion. Expect each message in order. Evidence: `steps_received`, Messaging History sends.
- F2 completes during the delay: exception event before the reminder. Expect exit, no reminder. Evidence: `last_exited`, no send for the step.
- F3 alternate outcome: failure event routes to the troubleshooting branch. Expect the branch message only.
- F4 cancels: cancellation event for the entry object. Expect exit for that object only.
- F5 globally unsubscribed from email. Expect no email; user advances. Evidence: no send, later steps reached.
- F6 unsubscribed from the email group used by the Canvas, globally subscribed. Expect suppression for that group only.
- F7 at frequency cap: a tagged message sent first to reach the cap. Expect a frequency cap event, the user advancing, and the next message reading correctly without the capped one.
- F8 inside quiet hours: profile timezone chosen so the send falls in the window. Expect hold and later send, or abort, as configured.
- F9 duplicate trigger: the same business event sent twice (a retry). Expect one entry.
- F10 re-entry: a second qualifying event inside and then after the re-eligibility window. Expect the configured policy.
- F11 two objects in flight: two orders or workspaces for one person; complete the first. Expect only the first journey to stop and the second to still send.
- F12 missing data: the attribute used in Liquid is absent. Expect the documented default or a Liquid abort recorded in the Message Activity Log, never a broken message.
- F13 backfill: a historical event imported with an old timestamp through the backfill route. Expect no entry.
- F14 partial API failure: a request with one invalid object (bad email format). Expect the object-level error logged with its code, every other fixture in the request created, and a recorded answer to whether Braze dropped the field or the whole object.
- F15 no timezone: profile without a timezone on a local-time delay. Expect the documented company-time fallback; record whether the user exits.
- F16 identity: anonymous activity then `changeUser` to a new ID, and a second device with an existing ID. Expect the specimen results recorded in the identity contract.
- F17 unsubscribes during the delay: after entry and before the send, the fixture unsubscribes through the real unsubscribe path. Expect no send for the step and the user advancing. Evidence: subscription change in the Engagement tab timestamped before the send time, no send in Messaging History.
- F18 paused Canvas: trigger while the QA copy is paused. Expect a 201 carrying a `notice`, no entry, and the sender logging and alerting on the notice. Evidence: response body, sender log row, no `last_entered`.
- F19 entrance limit reached: set the QA copy's "Maximum entries" to two and trigger three fixtures. Expect two entries. Record whether Braze drops the third or admits it later, and confirm the sender recorded the dropped business key.
- F20 no profile yet: trigger with `send_to_existing_only` true for an external_id that has no profile. Expect nothing sent and the sender logging it. Evidence: response body, `/users/export/ids` returning no user, sender log row.

## Run and record

1. Confirm the environment, the containment checklist, the Canvas copy and its entry restriction.
2. Read back each fixture profile with `/users/export/ids` before triggering (state at start).
3. Trigger fixtures one at a time, two to three minutes apart, in the order the plan lists.
4. After the longest shortened delay plus a margin, read back `canvases_received` and the Messaging History tab, and capture Message Activity Log rows within 60 hours.
5. Mark each fixture pass or fail with its evidence. A failed fixture becomes a diagnosis case starting at gate 1.
6. Restore nothing by hand in production. In a duplicated Canvas, stop and archive it after the run; delete test profiles only with the user's approval.

Sign-off: ready only when every executed fixture passes and every not-exercised fixture has a reason. An open failure blocks launch unless a named release owner accepts it in writing with a compensating control (for example a sender ledger or an entrance limit), proposed for `martech-context/decisions.md`. `ready` stays false while `open_failures` is not empty.

## Change control for a live Canvas

Treat an edit to a live Canvas as a release. Braze advises avoiding edits to live Canvases because behaviour can be unexpected.

- Save a version first (Canvas version history: "Update Canvas" creates a new version without overwriting the previous one).
- Behaviour to plan for, from Braze's editing-after-launch page on 2026-10-17: users already in a Delay keep the delay they entered with; users already enqueued for a Message step may not pick up the change; deleting a Delay or Action Paths step can redirect the users waiting in it; changes to entry properties apply only to new entrants. Verify live how users in edited or removed steps are treated before changing a step people are waiting in.
- Retest with one in-flight fixture (entered before the edit) and one new entrant, using the fixtures that cover the changed step.

## Worked example: Acme first import reminder

Fictional journey: Acme is a B2B analytics product. A workspace admin should get a reminder 24 hours after workspace creation if the first data import has not succeeded. The unit is the workspace. The trigger is API-triggered from the import service with `workspace_id` in `context`. Exits: `first_import_succeeded` and `workspace_cancelled`, each matched on `workspace_id` with "Personalize value". The send-time recheck is object-scoped: the reminder's Liquid looks up that workspace's import state through Connected Content to the import service, keyed on the context `workspace_id`, and calls `abort_message` when the import has succeeded or the lookup fails. No profile-level attribute is used, because one admin can have several workspaces in flight. Quiet hours 21:00 to 08:00 local, "Send at next available time". Global cap: two optional lifecycle messages per calendar day.

Environment: duplicated Canvas "QA - Acme first import reminder", entry audience restricted to `qa_fixture` exists, 24-hour delay shortened to 3 minutes. Containment: no other live Canvas or campaign uses `first_import_succeeded` or `workspace_cancelled` as a trigger or exit; the original Canvas is API-triggered by the import service only, so fixtures cannot enter it; the warehouse owner filters `qa_fixture`.

Run on 2026-10-17 (illustrative results, not a real account):

- F1 qa+f1@example.com, workspace ws-000101: entered 10:02, reminder sent 10:05. Pass.
- F2 qa+f2@example.com, ws-000102: `first_import_succeeded` sent at 10:04 (current time at send) for ws-000102. `last_exited` 10:05, no reminder. Pass.
- F7 qa+f7@example.com, ws-000107: two tagged messages sent at 09:30. Frequency cap event at the reminder step, user advanced. Pass for the cap. The next step's copy said "as we mentioned in our last email"; logged as a copy fix.
- F8 qa+f8@example.com, timezone set so local time was 22:10: reminder held, sent at 08:00 local. Pass.
- F9 qa+f9@example.com, ws-000109: trigger sent twice 20 seconds apart. Two entries. Fail: the import service had no ledger, and re-entry with window 0 accepted both. Fix drafted: ledger keyed on `workspace_id` plus `canvas_id` in the import service.
- F11 qa+f11@example.com, ws-000111 and ws-000112: completed ws-000111. Expected: ws-000111 exits and ws-000112 still receives its reminder. Observed: both journeys exited. Fail: the exit event filter on `workspace_id` was not set to "Personalize value". Fix drafted.
- F14 request with five fixtures, one email `not-an-email`: response 201 with `EMAIL_BAD_FORMAT` in `errors`, plus `request_status_not_tracked` because the workspace is not in the status tracking beta; the other four profiles created; the sender's log showed the rejected object and listed the status entry separately. The read-back recorded whether the F14 profile exists without an email, and reconciliation counted it accordingly. Pass.

Result: not ready. Two fixes drafted with owners; F9 and F11 to be re-run after the fixes, then F1 and F2 as regression. No owner has accepted either failure, so `open_failures` lists both.
