# Instructions

- Following Playwright test failed.
- Explain why, be concise, respect Playwright best practices.
- Provide a snippet of code with the fix, if possible.

# Test info

- Name: e2e-negative-invalid.spec.ts >> NEG intent / knowledge must not stop chat (HARD RULES 2,5) >> NEG-HEALTH-INTENT I need health insurance does not stop
- Location: test/process-test/e2e-negative-invalid.spec.ts:187:7

# Error details

```
Error: must not stop chat

expect(received).not.toBe(expected) // Object.is equality

Expected: not "stopped"
```

# Test source

```ts
  1   | /**
  2   |  * NEGATIVE / INVALID Chat-API process tests (HARD RULES).
  3   |  * Does not change application code. Cases that document current product gaps use
  4   |  * test.fail(...) so the requirement stays visible until the app is fixed.
  5   |  */
  6   | import { expect, test } from "@playwright/test";
  7   | import { createCase, sendChat, sendMany } from "./helpers";
  8   | 
  9   | function assertEditable(c: {
  10  |   status: string;
  11  |   stopPath?: string | null;
  12  |   process: { blocked?: boolean; missingRequired: string[] };
  13  | }) {
> 14  |   expect(c.status, "must not stop chat").not.toBe("stopped");
      |                                              ^ Error: must not stop chat
  15  |   expect(c.process.blocked).toBeFalsy();
  16  |   expect(c.stopPath || "").not.toMatch(/EMERGENCY/i);
  17  |   expect(c.process.missingRequired.join(",")).not.toMatch(/EMERGENCY/i);
  18  | }
  19  | 
  20  | test.describe("NEG field rejection — invalid not saved, session stays open", () => {
  21  |   test("NEG-API-NAME numeric then valid name recovery", async ({ request }) => {
  22  |     const created = await createCase(request);
  23  |     let c = await sendChat(request, created.caseId, "My name is 123456");
  24  |     assertEditable(c);
  25  |     expect(c.profile.name).toBeFalsy();
  26  |     c = await sendChat(request, created.caseId, "My name is John Smith");
  27  |     assertEditable(c);
  28  |     expect(c.profile.name).toBe("John Smith");
  29  |   });
  30  | 
  31  |   test("NEG-API-NAME symbols then valid name", async ({ request }) => {
  32  |     const created = await createCase(request);
  33  |     let c = await sendChat(request, created.caseId, "My name is !!!");
  34  |     assertEditable(c);
  35  |     expect(c.profile.name).toBeFalsy();
  36  |     c = await sendChat(request, created.caseId, "My name is Pat Lee");
  37  |     expect(c.profile.name).toBe("Pat Lee");
  38  |   });
  39  | 
  40  |   test("NEG-API-PHONE short then valid phone", async ({ request }) => {
  41  |     const created = await createCase(request);
  42  |     let c = await sendChat(request, created.caseId, "my phone is 123");
  43  |     assertEditable(c);
  44  |     expect(c.profile.phone).toBeFalsy();
  45  |     c = await sendChat(request, created.caseId, "call me at 555-123-4567");
  46  |     assertEditable(c);
  47  |     expect(c.profile.phone).toBeTruthy();
  48  |   });
  49  | 
  50  |   test("NEG-API-PHONE letters not saved", async ({ request }) => {
  51  |     const created = await createCase(request);
  52  |     const c = await sendChat(request, created.caseId, "my phone is abcdefg");
  53  |     assertEditable(c);
  54  |     expect(c.profile.phone).toBeFalsy();
  55  |   });
  56  | 
  57  |   test("NEG-API-EMAIL invalid then valid", async ({ request }) => {
  58  |     const created = await createCase(request);
  59  |     let c = await sendChat(request, created.caseId, "email is not-an-email");
  60  |     assertEditable(c);
  61  |     expect(c.profile.email).toBeFalsy();
  62  |     c = await sendChat(request, created.caseId, "email is john@example.com");
  63  |     assertEditable(c);
  64  |     expect(c.profile.email).toBe("john@example.com");
  65  |   });
  66  | 
  67  |   test("NEG-API-STATE non-US then Texas", async ({ request }) => {
  68  |     const created = await createCase(request);
  69  |     let c = await sendChat(request, created.caseId, "Ontario, Canada");
  70  |     assertEditable(c);
  71  |     expect(c.profile.state).toBeFalsy();
  72  |     c = await sendChat(request, created.caseId, "Texas");
  73  |     assertEditable(c);
  74  |     expect(c.profile.state).toBe("TX");
  75  |   });
  76  | 
  77  |   test("NEG-API-STATE city Houston does not set state", async ({ request }) => {
  78  |     const created = await createCase(request);
  79  |     const c = await sendChat(request, created.caseId, "Houston");
  80  |     assertEditable(c);
  81  |     expect(c.profile.state).toBeFalsy();
  82  |   });
  83  | 
  84  |   test("NEG-API-AGE negative then valid age", async ({ request }) => {
  85  |     test.fail(true, "KNOWN BUG: 'I'm -10 years old' stores age 10 (minus ignored)");
  86  |     const created = await createCase(request);
  87  |     await sendMany(request, created.caseId, [
  88  |       "My name is Riley Chen",
  89  |       "Texas",
  90  |       "I want mortgage protection on me only",
  91  |     ]);
  92  |     let c = await sendChat(request, created.caseId, "I'm -10 years old");
  93  |     assertEditable(c);
  94  |     expect(c.profile.age).toBeFalsy();
  95  |     c = await sendChat(request, created.caseId, "I am 42 years old");
  96  |     assertEditable(c);
  97  |     expect(c.profile.age).toBe(42);
  98  |   });
  99  | 
  100 |   test("NEG-API-LOAN negative then valid loan", async ({ request }) => {
  101 |     const created = await createCase(request);
  102 |     await sendMany(request, created.caseId, [
  103 |       "My name is Riley Chen",
  104 |       "Texas",
  105 |       "I want mortgage protection on me only",
  106 |       "I am 42 years old",
  107 |     ]);
  108 |     let c = await sendChat(request, created.caseId, "loan balance -$50,000");
  109 |     assertEditable(c);
  110 |     expect(c.profile.loan_balance).toBeFalsy();
  111 |     c = await sendChat(request, created.caseId, "looking at a $200K mortgage");
  112 |     assertEditable(c);
  113 |     expect(c.profile.loan_balance).toBe(200000);
  114 |   });
```