--- created: '2026-07-02' path: Sources/Dev project: pbs-case-tester tags: - n8n - automation - pbs type: project-plan --- ## Goal Two pieces on the **pbs-wp-test sandbox** (VM 202, `pbs.herbylab.dev`), built unattended overnight: 1. **Case Tester** — a small web UI to exercise the Instagram auto-reply pipeline end-to-end against the existing mocks: - **Stage a mock post** by giving it a caption (A1–A4 preset *or* free-type), pushed through the **REAL n8n ingest via fbmock** so the caption is actually parsed (`ID:` / `comment KEYWORD`). - **Fire a mock user comment** (C-case preset or free-type) at the reply webhook. - **See n8n's response** pulled from the sink: the DM + public reel reply + any Google Chat alert card. - **Test the alert-card buttons live** — the override button fires the real `override-reply` webhook (watch the forced DM land in the sink); the deep-link opens the hub post page. Simulate a button only if it can't be faithfully wired. - **Reset** to a clean state between runs. 2. **Pause-and-Hold** — complete the `pending_comments` hold/flush mechanism: - Comments that can't auto-resolve (unmatched post / no recipe / near-miss) get **parked in `pending_comments` + alert**, instead of just alerting and moving on. - A manual **"flush held comments for this post"** action replays them once the mapping is fixed (via the resolution path already built). Auto-flush-on-fix is a fast-follow, not tonight. ## Locked Decisions - **(a) Real ingest via fbmock** — the tester drives the actual n8n ingest so caption parsing (the A3/A4 failure surface) is exercised for real, not staged directly in the DB. - **Tester first** — it's self-contained and becomes the harness that *proves* hold-and-flush; pause-and-hold is built second and demonstrated *through* the tester. - **Reuse existing substrate** — fbmock, the sink, the inject/matrix scripts, and the earlier read-only results viewer, rather than reinventing. - **Hold set** = the "needs attention" cases (unmatched post / no recipe / near-miss). - **Flush** = manual per-post for now; auto-flush-on-fix deferred. - **Sandbox only**, snapshot-first, scp deploy, no gitea push, no prod. ## Open Items - Auto-flush-on-fix (deferred to a fast-follow). - Live cutover of all sandbox work (rides with the RW test-server move). - Wider A/B/C case coverage in the tester beyond the A1·C1 happy path (as time allows). ## Phases 1. **Snapshot** VM 202 (`vmstate=1`) as the rollback net. 2. **Case Tester** — stage-post (via fbmock→real ingest) → send-comment → render sink response; Reset; alert-card button testing (override + deep-link). Prove **A1·C1 happy path end-to-end**. 3. **Pause-and-Hold** — park unresolvable comments in `pending_comments`; manual per-post flush that replays once the mapping is fixed. Demonstrate through the tester. **Halt-and-document** if hold/flush logic hits ambiguity against live reply behavior. 4. **Validate** — zero-check on code diffs; a-review if `agy` is up (do not block on it). ## Notes - Success condition: tester is **up on the box** and drives A1·C1 end-to-end with the response visible and buttons testable; pause-and-hold at least holds + manual-flushes the unmatched case. Other cases wired if time. - Substrate on the box: mock harness (`~/n8n-mock/`, `~/mock-sink/`, `~/fbmock/`), results viewer (`~/results-web/`), n8n workflows, `pending_comments` table already in schema. - Connection + PVE-snapshot reference lives in Trellis thread **pbs-dev-connect (995)**; run contract in thread **pbs-case-tester (999)**. - Related: builds on the resolution path (recipe panel + both handoffs + deep-link fix) shipped to the sandbox earlier the same day.