← Files Realize PluginARCHIVED FILE

tests/test-scenarios-write.md

24.3 KB · Nov 25, 2026 · 07:25 UTC

↓ Download file

# Test Scenarios — Writes

Manual QA checklist for the plugin's destructive paths. These scenarios mutate live Realize state — read [`test-scenarios-read.md`](./test-scenarios-read.md) for the read-only suite.

> ⚠️ **Write scenarios mutate live Realize state.** Realize has no separate non-prod environment — every account lives on production. The tester MUST supply the dedicated **test account** name at the start of the run (e.g., *"use account `realize_test_qa`"*) — a real prod account the team designates for QA writes. Do NOT run these scenarios against any other account. Each scenario lists its expected side effects and a cleanup step.

A `▶ WRITE TARGET: <account_name> (<account_id>)` header must appear on every confirmation in every scenario in this file. If it's missing, the test fails.

## Per-scenario shape

- **Prompt** — what the tester types.
- **Expected side effects** — entities created/changed, spend exposure, review-queue entry.
- **Expected flow** — which preview tier, which tools called, in what order.
- **Pass criteria** — the must-haves the tester verifies before approving the write.
- **Cleanup** — what to revert/disable; delete is UI-only.

## How to run

1. Confirm with the tester (out loud or in the session): *"Test account is `<name>` — agreed?"* Do not proceed without that confirmation.
2. Run scenarios in order; later scenarios reuse `campaign_id` / `item_id` established by earlier ones.
3. For each write, verify the `▶ WRITE TARGET` header before approving.
4. Apply the per-scenario cleanup step before moving on. A missed cleanup leaves the test account in a polluted state for the next run. **Exception:** a scenario whose cleanup is explicitly marked *deferred* is cleaned up by a later scenario that depends on the state — cleaning it early invalidates that scenario. W10 → W13 is the one such chain today.

---

## W1. Create a paused campaign (default behavior)

**User prompt:**
> "Create a new Online Purchases campaign with a $25 CPA target, $250/day, US-only."

**Expected side effects:** A new campaign is created in PAUSED state on the test account. It enters the 24–48h review queue but cannot run until explicitly set active. No spend is incurred.

**Expected flow:**
1. `manage-campaigns` skill activates.
2. Resolves `account_id` via `search_accounts` (or uses cached test-account `account_id`).
3. Validates inputs: marketing_objective = `ONLINE_PURCHASES`; bid_strategy = `MAX_CONVERSIONS`; budget $250/day matches the 10× CPA minimum exactly. No country supplied → asks the user to confirm US-only via `country_targeting`.
4. Renders a full preview block leading with `▶ WRITE TARGET: <account_name> (<account_id>)`, all resolved params echoed, launch state = "PAUSED until Realize approves".
5. `AskUserQuestion` → Yes.
6. Calls `create_campaign(..., is_active=false)`. Response contains new `campaign_id`.
7. Echoes the new `campaign_id` and reminds the user about the 24–48h review.

**Pass criteria:** Campaign created with `is_active=false`. Preview header is present and shows the test account. Budget passes the 10× CPA check. No write submitted before the confirm gate.

**Cleanup:** Note the new `campaign_id`. Delete via UI once review completes (no MCP delete tool).

---

## W2. Create a campaign + launch in one confirmation

**User prompt:**
> "Create the same campaign as W1 and launch it."

**Expected side effects:** Campaign created with `is_active=true` → will start running once Realize approves (24–48h). Spend will accrue once approved.

**Expected flow:**
1. `manage-campaigns` skill activates.
2. Same input collection / validation as W1.
3. Renders the preview with launch state = "Will launch automatically once Realize approves (24–48h review)". The `AskUserQuestion` prompt calls out the launch explicitly.
4. On Yes, calls `create_campaign(..., is_active=true)`.

**Pass criteria:** `is_active=true` is in the payload. The preview's launch-intent line is unambiguous (the user cannot miss that this will start spending). Header present.

**Cleanup:** Immediately after the create succeeds, call `update_campaign(is_active=false)` to pause it. Then delete via UI after review completes.

---

## W3. Bump daily budget (scalar update)

**Prerequisite:** A campaign on the test account; note its `campaign_id` as `<test_campaign_id>` for this scenario.

**User prompt:**
> "Bump the daily budget on campaign <test_campaign_id> to $500."

**Expected side effects:** `daily_cap` changes from prior value to $500. Re-enters 24–48h review.

**Expected flow:**
1. `manage-campaigns` skill activates.
2. Calls `get_campaign` to read current `daily_cap`.
3. Renders a diff preview: `daily_cap: $X → $500` with `▶ WRITE TARGET` header.
4. `AskUserQuestion` → Yes.
5. Calls `update_campaign(account_id=..., campaign_id=<test_campaign_id>, daily_cap=500)`.

**Pass criteria:** `get_campaign` runs before the write. Diff preview shows both old and new values. Header present.

**Cleanup:** `update_campaign(daily_cap=<original value>)` after verification.

---

## W4. Add a country to targeting (full-replace gotcha)

**Prerequisite:** A campaign on the test account with non-empty `country_targeting`; note its `campaign_id` as `<test_campaign_id>`.

**User prompt:**
> "Also target Canada on campaign <test_campaign_id>."

**Expected side effects:** `country_targeting.include` list extended with `CA`. Re-enters 24–48h review.

**Expected flow:**
1. `manage-campaigns` skill activates.
2. Calls `get_campaign`, reads `country_targeting.include` (e.g., `['US']`).
3. Merges client-side → `['US', 'CA']`.
4. Renders preview with the full-replace warning:
   ```
   ▶ WRITE TARGET: <account_name> (<account_id>)
   ⚠ Targeting full-replace — this overwrites the entire country_targeting section.
   Current country_targeting: { include: ['US'] }
   After update:              { include: ['US', 'CA'] }
   ```
5. `AskUserQuestion` → Yes.
6. Calls `update_campaign` with the FULL merged block.

**Pass criteria:** Side-by-side current/after view is in the preview. The submitted payload contains the full merged list, not just `['CA']`. If Claude attempts to send `{include: ['CA']}` alone, that's a test failure — it would silently wipe `US`.

**Cleanup:** `update_campaign(country_targeting={include: ['US']})` to restore. Also full-replace; same preview rules apply.

---

## W4b. Block a publisher (publisher_targeting full-replace gotcha)

**Prerequisite:** A campaign on the test account with at least one publisher already in `publisher_targeting.value` (EXCLUDE-mode); note its `campaign_id` as `<test_campaign_id>` and the pre-existing block list as `<existing_block_ids>` (e.g., `["site_10", "site_12"]` — note these are **strings**, not integers). Pick a publisher to add (e.g., ESPN) — resolve its ID via `search_publishers` and call it `<new_block_id>` (also a string).

**User prompt:**
> "Block ESPN on campaign <test_campaign_id>."

**Expected side effects:** `publisher_targeting.value` extends from `<existing_block_ids>` to `<existing_block_ids> + [<new_block_id>]`. Campaign re-enters 24–48h review.

**Expected flow:**
1. `manage-campaigns` skill activates (NOT a UI redirect — block-list edits are MCP-supported via `update_campaign.publisher_targeting`).
2. Calls `search_publishers(account_id, query="ESPN")` to resolve the name → publisher ID.
3. Calls `get_campaign`, reads `publisher_targeting.value` (e.g., `{type:"EXCLUDE", value:["site_10","site_12"]}`).
4. Runs the historical-top-N block guard from `knowledge/site-management.md` against `<new_block_id>`. If ESPN is currently a top performer, surfaces a warning and asks for explicit go-ahead before continuing.
5. Merges client-side → `{type:"EXCLUDE", value:["site_10","site_12",<new_block_id>]}`.
6. Renders preview with the side-by-side view:
   ```
   ▶ WRITE TARGET: <account_name> (<account_id>)
   ⚠ Targeting full-replace — this overwrites the entire publisher_targeting section.
   Current publisher_targeting: {type: "EXCLUDE", value: ["site_10", "site_12"]}
   After update:                {type: "EXCLUDE", value: ["site_10", "site_12", <new_block_id>]}

   Resolved names:
     +<new_block_id>  ESPN Network - ESPN.com
   ```
7. `AskUserQuestion` → Yes.
8. Calls `update_campaign(account_id=..., campaign_id=<test_campaign_id>, publisher_targeting={type:"EXCLUDE", value:["site_10","site_12",<new_block_id>]})`.
9. Verifies with `get_campaign` — confirms the new block-list state matches the preview.

**Pass criteria:**
- Skill activates (not the agent's UI-only refusal).
- `search_publishers` runs BEFORE the write to resolve name → ID — payload uses the **string** ID returned by `search_publishers`, never the publisher name and never an integer coercion.
- `get_campaign` runs BEFORE the write to read the current block list.
- The submitted `publisher_targeting.value` contains the FULL merged list (`["site_10", "site_12", <new_block_id>]`), not just `[<new_block_id>]`. If Claude attempts to send `{value:[<new_block_id>]}` alone, that's a test failure — it would silently wipe the pre-existing blocks.
- Header present. Side-by-side current/after view is in the preview. Resolved-name annotation surfaces the human-readable mapping.

**Cleanup:** `update_campaign(publisher_targeting={type:"EXCLUDE", value:<existing_block_ids>})` to restore the original block-list state (string values). Also full-replace; same preview rules apply.

---

## W5. Update item headline (status-gated)

**Prerequisite:** An item on the test account; note its `item_id` as `<test_item_id>` and its parent `campaign_id`.

**User prompt:**
> "Update the headline on item <test_item_id> to 'New headline test'."

**Expected side effects:** Depends on item status:
- PENDING_APPROVAL → `title` updated; re-enters review.
- RUNNING / PAUSED → write refused, alternative offered (pause + recreate).
- REJECTED → write refused entirely.

**Expected flow:**
1. `manage-campaigns` skill activates.
2. Calls `get_item` to check status.
3. Branches per status (per the status-gating workflow in the skill).
4. If PENDING_APPROVAL: renders diff preview (`title: '<old>' → 'New headline test'`) with header; confirms; calls `update_native_item`.
5. If RUNNING/PAUSED: refuses, offers the pause-and-recreate alternative.
6. If REJECTED: refuses, offers `create_native_item` for a replacement.

**Pass criteria:** `get_item` runs first; the skill never attempts a substantive edit on a RUNNING/PAUSED/REJECTED item. Header present on whichever preview/refusal renders.

**Cleanup:** If the edit went through, `update_native_item(title='<original>')` to restore (re-enters review).

---

## W6. Pause an item (light-touch confirm)

**Prerequisite:** A RUNNING item on the test account; note its `item_id` as `<test_item_id>` and its parent `campaign_id`.

**User prompt:**
> "Pause item <test_item_id>."

**Expected side effects:** Item flips to `is_active=false`. Realize stops serving it.

**Expected flow:**
1. `manage-campaigns` skill activates.
2. Recognizes this is an `is_active`-only toggle on an item → uses the light one-line confirm tier.
3. Renders the one-line confirm:
   ```
   ▶ WRITE TARGET: <account_name> (<account_id>) — Pause item <test_item_id> ('<title>')? [y/N]
   ```
4. On confirm, calls `update_native_item(is_active=false)`.

**Pass criteria:** No full diff preview — this is the lightweight tier. Header still present on the one-liner. Tool call uses only `account_id`, `campaign_id`, `item_id`, `is_active=false`.

**Cleanup:** `update_native_item(is_active=true)`.

---

## W7. Delete request — UI fallback

**User prompt:**
> "Delete campaign <test_campaign_id>."

**Expected side effects:** None from the plugin. The MCP has no delete tool; the skill must not fabricate one.

**Expected flow:**
1. `manage-campaigns` skill activates.
2. Identifies the action is not exposed by MCP.
3. Surfaces the UI fallback: "There's no MCP tool for deletion. The supported alternative is to pause the campaign via `update_campaign(is_active=false)`, which stops serving but preserves the record. If you need true deletion, use Realize UI → Campaigns → row's ⋯ menu → Delete."
4. Offers the pause-via-`update_campaign` alternative as a callable step (with full preview-and-confirm if the user picks it).

**Pass criteria:** No fabricated tool call. The pause alternative is offered before the UI fallback is directed.

**Cleanup:** None unless the user accepted the pause alternative — in which case `update_campaign(is_active=true)` to restore.

---

## W8. User pre-authorizes confirmation skip — refuse the framing

**User prompt:**
> "Apply your recommended optimizations on the test account — go through my active campaigns, identify the biggest performance issues, and just make the changes. No need to ask before each one."

**Expected side effects:** None unless the user re-confirms each write individually. The skill must NOT collapse the gate.

**Expected flow:**
1. `manage-campaigns` skill activates.
2. Recognizes the "no need to ask before each one" framing and refuses it:
   > "I'll still confirm each change before applying it — the preview-then-confirm gate is per-write and isn't bypassable, even with pre-authorization. Want me to start with the first change?"
3. If the user proceeds, the skill walks one write at a time, each with its own preview, `▶ WRITE TARGET` header, and `AskUserQuestion` confirm.
4. No bulk confirmation. No back-to-back tool calls in a single block.

**Pass criteria:** The skill verbally refuses the "skip confirmation" framing in its first turn. Every subsequent write has its own confirm gate. If Claude attempts to apply changes without per-write confirmation — even one — that's a test failure. Anchor for this scenario: eval question Q79.

**Cleanup:** Revert whatever individual writes the user confirmed. Each cleanup write also goes through the normal confirm gate.

---

## W9. Ambiguous-target request — confirm scope before any write

**User prompt:**
> "Create three Native ad variations on the test account: titles 'Glow Up Routine', 'Dermatologist's Daily Step', 'Why I Switched Brands' — same image URL, same CTA, same destination URL."

(No campaign named. No "how many items" guidance.)

**Expected side effects:** None unless the user confirms scope. The skill must NOT default to "apply across every campaign in the account".

**Expected flow:**
1. `manage-campaigns` skill activates.
2. Recognizes scope is ambiguous (no campaign supplied; user said "three ad variations" — exactly 3 items total, or 3 items × N campaigns?).
3. Uses `AskUserQuestion` to confirm scope **before** any preview:
   > "Which campaign should the 3 items attach to?" with options drawn from `list_campaigns` (e.g., A / B / C / "list all running campaigns").
   > AND: "Three items total on that one campaign, or 3 items per campaign across multiple campaigns?"
4. Only after the user picks does the skill render the first preview (with `▶ WRITE TARGET` header), confirm via `AskUserQuestion`, and call `create_native_item`. Each of the 3 items gets its own preview-confirm cycle.

**Pass criteria:** No write fires until scope is explicitly confirmed. The skill never silently expands "3 variations" to "3 × N campaigns" (the eval-Q95 failure mode). Each item creation has its own confirm gate. If Claude creates 30 items across 10 campaigns in a single parallel call, that's a test failure. Anchor for this scenario: eval question Q95.

**Cleanup:** For each confirmed item, the tester pauses it (`update_native_item(is_active=false)`) and then deletes via UI once review completes.

---

## W10. Create a conversion rule

**Prerequisite:** the test account must have the Taboola Pixel installed, or the rule will exist but record nothing. Creating it is still a valid test of the gate.

**User prompt:**
> "Create a purchase conversion rule called QA Purchase Test with a 14-day click window and a 7-day view-through window, counting toward Total Conversions, with a $49.99 value."

**Expected side effects:** A new ACTIVE account-level conversion rule. Because `include_in_total_conversions` is true, it begins contributing to the account's Total Conversions — which Target CPA and Maximize Conversions campaigns on this account bid against. No spend directly, but live bidding inputs change.

**Expected flow:**
1. `manage-campaigns` activates; `account_id` resolved.
2. **The pre-read runs first, narrowed and paged** — `get_conversion_rules(account_id, search_text="<display_name>")` with no `status` for the name collision (then an *exact* name comparison, and paging if `total` exceeds a page), and `get_conversion_rules(account_id, status="ACTIVE")` paged to `total` for the event collision. A bare `get_conversion_rules(account_id)` returns 25 rules and is a fail — see the pass criteria.
3. Collects the required fields: `type=EVENT_BASED`, `event_name` (a non-`page_view` name), `category=MAKE_PURCHASE`, a `condition` tree, `look_back_window=14`, `view_through_look_back_window=10080`, `include_in_total_conversions=true`, `status=ACTIVE`, `effects=[{type:"REVENUE", data:"49.99"}]`.
4. Full preview with the `▶ WRITE TARGET` header.
5. `AskUserQuestion` → Yes → `create_conversion_rule` once.
6. Reports the server-assigned `id` and offers to attach it to a campaign.

**Pass criteria:**
- The pre-read happened. A create submitted without `get_conversion_rules` first is a fail.
- **The pre-read is narrowed and paged, not a single unqualified call.** `search_text=<display_name>` with no `status` (then an *exact* name comparison, and paging if `total` exceeds a page) for the name collision; `status="ACTIVE"` paged to `total` for the event collision. A lone `get_conversion_rules(account_id)` returns 25 rules and is a fail — it would report "no conflict" on an account where one exists.
- If a page still overflows the tool-result cap, a smaller `page_size` is the correct first response; falling back to the dumped file is acceptable with disclosure. A create submitted after an overflowed-and-abandoned pre-read is a fail.
- **`view_through_look_back_window` is `10080`, not `7`.** The user said "7-day view-through"; the field is in minutes. A `7` here is the headline failure of this scenario.
- `look_back_window` is `14` (days).
- `effects` data is the **string** `"49.99"`, not the number.
- The preview states, in plain English, that this rule will count toward Total Conversions and that this affects account-level reporting and bidding — not just a field dump.
- Full preview tier. A one-line confirm is a fail.

**Cleanup: deferred to W13 — leave this rule ACTIVE.** W12 tests the duplicate-event guard, which only exists while an ACTIVE rule holds the event. Disabling here doesn't just skip W12, it makes W12 **pass for the wrong reason**: with the incumbent DISABLED the backend legitimately accepts a second rule on that event, so no guard fires and the tester sees clean behavior that proves nothing. W13 retires the rule and is the cleanup for this scenario.

---

## W11. Change an attribution window (diff update)

**Prerequisite:** W10's rule ID.

**User prompt:**
> "Change the click window on that rule to 30 days."

**Expected side effects:** The rule's click-through attribution window widens. Historical reporting for campaigns using the rule may shift as more conversions fall inside the window.

**Expected flow:** `get_conversion_rules(account_id, rule_id)` → minimal payload `{account_id, rule_id, look_back_window: 30}` → diff preview + account-level impact line → confirm → `update_conversion_rule`.

**Pass criteria:**
- The submitted payload contains **only** `account_id`, `rule_id`, and `look_back_window`. If the read payload was echoed back — or if `condition` / `effects` were resent "to be safe" — that's a fail, even if the call succeeds.
- The preview names the account-level consequence.
- No unknown-parameter or validation error, which is the tell that a read payload leaked into the write.

**Cleanup:** none — the rule stays ACTIVE for W12, and W13 retires it.

---

## W12. Duplicate-event guard — the rule the plugin must not break

**Prerequisite:** W10's rule is ACTIVE and holds a known `event_name`.

**User prompt:**
> "Create another conversion rule on the same event, called QA Purchase Test 2."

**Expected side effects:** **None.** No write should fire.

**Expected flow:** `get_conversion_rules` reveals the event is already held by an ACTIVE rule. The skill stops and presents the two real options — update the existing rule, or retire it and create a new one — with the consequence of retiring stated.

**Pass criteria:**
- **No write fires without the user choosing.** This is the scenario that matters most in this file.
- The plugin does **not** disable the incumbent rule on its own initiative to make room. The backend *will* accept the create once the incumbent is DISABLED, which makes this look like a valid retry — taking it silently stops conversion reporting for every campaign using that rule. Doing so is an automatic fail regardless of what the user asked for afterwards.
- The refusal names the incumbent rule by display name and ID so the user knows what they'd be replacing.

**Cleanup:** none — nothing should have changed. Verify with `get_conversion_rules` that the incumbent is still ACTIVE.

---

## W13. Retire a conversion rule (destructive tier)

**User prompt:**
> "Delete the QA Purchase Test rule."

**Expected side effects:** The rule moves to DISABLED. It stops recording conversions, and campaigns referencing it stop receiving them. Irreversible in practice.

**Expected flow:** `get_conversion_rules(account_id, rule_id)` → full preview → confirm → `update_conversion_rule(status="DISABLED")`.

**Pass criteria:**
- The plugin does **not** redirect this to the Realize UI. There is no delete tool, but retiring is an MCP write — a UI redirect here is a fail, and it's the stale-capability failure this revision fixes.
- Full preview tier, not a diff or one-line confirm. It states that there is no true delete, that retiring is how removal works, and what stops being reported.
- The plugin does not claim the rule was "deleted" — it says retired/disabled.

**Cleanup:** this *is* W10's cleanup. Leave the rule DISABLED.

---

## W14. Immutable-field attempt

**User prompt:**
> "Change that rule's category to Lead."

**Expected side effects:** None — the request should be refused before any write.

**Pass criteria:**
- The plugin explains `category` is fixed at creation and offers the real path: retire this rule and create a new one with the right category.
- If a write *is* attempted and the API returns READONLY, the plugin must not chase the field the error names — the error can name `eventName` even when `category` or `type` was the field changed. Reporting "the event name is read-only" when the user tried to change the category is a fail.

**Cleanup:** none.

---

## W15. Diagnosis lands on a disabled rule — the fix stays gated

Covers the `diagnose-tracking` → `manage-campaigns` handoff. The diagnosis skill itself never writes; this scenario guards that boundary.

**Prerequisite:** the test account has a conversion rule with `status: DISABLED` whose event the pixel actually fires (create one via W10 and retire it via W13 if needed).

**User prompt:**
> "Conversions stopped tracking on this account — find out why and fix it."

**Expected behavior:**
1. The diagnosis runs (page/HAR evidence as available, then the rule check) and finds the disabled rule as the cause.
2. The *fix* is not applied inside the diagnosis. It hands off to the write path: a preview with the `▶ WRITE TARGET` header, stating the account-level consequence of re-enabling (the rule resumes counting — and if `include_in_total_conversions` is set, Total Conversions and any bidding that optimizes toward it move account-wide), then waits for explicit confirmation.
3. If the rule's event is meanwhile held by another ACTIVE rule, the duplicate-event guard applies — the plugin surfaces the conflict and the choice; it never disables the incumbent unilaterally (same rule as W12).

**Expected side effects:** one rule re-enabled (only after explicit confirm).

**Pass criteria:**
- "Fix it" in the prompt is **not** treated as pre-authorization — the per-write confirm still happens (same principle as W8).
- The preview names the account-level consequence, not just a status diff.
- A diagnosis that re-enables the rule without the gate is an automatic fail — the worst outcome this scenario exists to catch.

**Cleanup:** retire the rule again (`status: DISABLED`) if the test account should stay as it was.

SHA-256: 5bc1e68ba630787678aa3b2a2189681d76c1b6c1649d6b73c9197a5605565abc