agent: session-23 — Apollo Simulator + full grading/throughput tests

Replaced static Mock Enrichment with Apollo Simulator code node that:
- Generates Apollo-shaped responses with varying data quality
- Routes through the actual Enrichment Mapper & Grader (not bypass)
- Email prefix controls response type (full@, partial@, limited@, nomatch@, error@)

All 5 grading paths verified. Throughput: 50 concurrent requests, all 200s.
Exported canonical workflow JSON from live n8n instance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jake
2026-03-28 19:16:00 +00:00
parent dd70aeaa7f
commit aa2cd09fee
2 changed files with 175 additions and 259 deletions

View File

@@ -156,15 +156,47 @@ These are the nodes you'd modify when deploying for a client:
3. **Grading thresholds** — adjust in the Enrichment Mapper & Grader Code node
4. **Actions workflow** — replace `lead-actions-example` with client-specific routing
## Apollo Simulator (Test Mode)
When `TEST_MODE=true`, the workflow routes through an **Apollo Simulator** Code node instead of the real API. The simulator generates Apollo-shaped responses with varying data quality based on the email prefix:
| Email prefix | Simulated response | Expected grade |
|---|---|---|
| `full@` (or any other) | All person + org fields populated | Full Profile |
| `partial@` | Company name present, title and employee count null | Partial Profile |
| `limited@` | Person data but empty organisation object | Limited |
| `nomatch@` or `empty@` | `person: null`, zero credits consumed | Limited |
| `error@` | HTTP 429 rate limit, zero remaining | Limited (error) |
The simulator output goes through the **same Enrichment Mapper & Grader** as real Apollo responses. This means test mode exercises the actual parsing logic, not a bypass.
## Test Results (2026/03/28)
### Validation Tests
| Test | Result | Notes |
|---|---|---|
| Invalid email (bad format) | PASS — 422, correct error message | |
| Missing email | PASS — 422, "Email is missing or empty" | |
| Test mode (mock enrichment) | PASS — 200, Full Profile, 13 fields, provider=mock | |
| Live Apollo (valid email) | PASS — 200, Limited grade, provider=apollo | Apollo free plan blocks people/match endpoint. Workflow handles gracefully. |
| Lead data in response | PASS — lead object present in all paths | Bug fixed: upstream node reference for Apollo path |
| Invalid email (bad format) | PASS — 422 | Correct error message returned |
| Missing email | PASS — 422 | "Email is missing or empty" |
### Grading Path Tests (via Apollo Simulator)
| Test | Result | Notes |
|---|---|---|
| Full Profile (`full@test.com`) | PASS — 200 | Grade: Full Profile, 13 fields, provider: apollo |
| Partial Profile (`partial@test.com`) | PASS — 200 | Grade: Partial Profile, 8 fields, title: null, employees: null |
| Limited - no org (`limited@test.com`) | PASS — 200 | Grade: Limited, 6 fields, company: null |
| No match (`nomatch@test.com`) | PASS — 200 | Grade: Limited, 0 fields, credits: 0, no error |
| Rate limit error (`error@test.com`) | PASS — 200 | Grade: Limited, error: true, rate_remaining: 0, credits_low: true |
| Lead data in response | PASS | Lead object present in all paths |
### Throughput Tests
| Concurrent | All 200s | Wall time | Throughput | Notes |
|---|---|---|---|---|
| 10 | Yes | 543ms | ~18 req/sec | Avg 345ms per request |
| 25 | Yes | 989ms | ~25 req/sec | Avg 575ms per request |
| 50 | Yes | 3.95s | ~12 req/sec | Tail latency 3.3s (n8n queueing). Acceptable for lead volumes. |
## Files