Notes
What breaks
First, what self healing is meant to fix. We renamed the coupon field's id on ShopRung, a harmless refactor a developer might do. The test using a CSS id locator timed out. The test using a role and label locator, the textbox named Coupon code, kept working and applied the coupon. Most of the breakage self healing repairs never happens with role, label and test id locators. Fix the locators before buying a healer.
locator('#coupon')
TimeoutError: locator.fill:
Timeout 3000ms exceeded
waiting for locator('#coupon')
getByRole('textbox',
{ name: 'Coupon code' })
→ filled, FLAT5 applied
→ passed Healing values
Healing values is more dangerous than healing locators. We recorded an ARIA snapshot of the cart totals for a seventy five dollar order. Notice the generated baseline turned the amounts into patterns for any number, so it never checked them. Then we switched on the free shipping bug: the test went red, correctly. Running update snapshots made it green again with a one line change, and the bug became the expected result.
generated baseline: /Subtotal \$\d+\.\d+ ... Shipping Free Total \$\d+\.\d+/ free-shipping-boundary bug on: "Shipping $4.99" → test red npx playwright test --update-snapshots → green - Shipping Free + Shipping \$\d+\.\d+
Heal safely
So set rules for any healing tool, an AI agent or a snapshot update. Heal locators, never expected values or assertions. Every heal is a diff someone reviews; nothing is merged automatically. A snapshot update needs a reason in the pull request. Read generated baselines, because patterns can quietly stop checking amounts. And prefer locators that do not need healing.
- heal locators, never expected values or assertions
- every heal is a reviewed diff, never auto-merged
- a snapshot update needs the reason in the pull request
- check generated baselines: patterns can hide amounts
- role and label locators first
Triage test
Now triage. We built twelve failure logs with known causes, taken from failures earlier in this course: four product bugs, three test bugs, three environment problems and two flaky tests. A local model, llama three point two at temperature zero, labelled each one in JSON. First with a naive prompt listing the four categories, then with a guided prompt that defined each category, required a quoted line of evidence and allowed unsure.
- 4 product bugs: coupon edge, order leak, stock, slow search
- 3 test bugs: wrong expectation, locator typo, missing fixture
- 3 environment: server down, Ollama down, no browser
- 2 flaky: passed on retry, fails only in parallel
- llama3.2:3b, temperature 0, JSON
Measured
Both prompts got eight of twelve right. The careful prompt was slower and never once used unsure. Both made the same important mistake: a test that expected the five dollar coupon on a fifteen dollar cart, when the rule says twenty, was called a product bug, even though the log quoted the rule. A team acting on that label would file a bug against correct code.
naive guided correct 8/12 8/12 answered UNSURE - 0 time per log 2.1 s 3.0 s both wrong: the test that expected FLAT5 at $15.00, log included the rule ($20.00) → "PRODUCT_BUG"
The costly errors
Look at which mistakes cost most. The slow search bug was labelled environment, with evidence that was just the start of a log line. Environment failures get retried or ignored, so a real performance bug would disappear. The locator typo became environment, and the parallel data clash became a product bug. With the naive prompt, a server that was not running became a product bug. Quoted evidence did not make the reasoning right.
slow search (k6 thresholds) → ENVIRONMENT, evidence: "level=error msg=" shared data in parallel → PRODUCT_BUG locator typo "Add to basket" (page shows "Add to cart") → ENVIRONMENT naive: server down → PRODUCT_BUG
Use triage well
Use triage the way Part ten used judges. Put deterministic rules first: a test that passed on retry is flaky, a connection error in every test is the environment. Let AI suggest a label and a reason for the rest, shown to a person, never acted on automatically. A person confirms before a bug is filed or a test is muted. And measure the triage against labelled failures before trusting it.
- rules first: passed on retry → flaky; ConnectError in every test → environment
- AI: a suggested label and reason, shown, not acted on a person confirms before a bug is filed or a test muted
- measure the triage on labelled failures, like a judge
Common mistakes
Mistakes. Healing expected values instead of locators. Merging heals automatically. Updating snapshots on a red build without a reason. Acting on AI triage labels without a person, especially when environment means nobody looks. Never measuring how often the triage is right. And using a healer to paper over fragile locators that role and label locators would have avoided.
- healing expected values
- auto-merged heals
- --update-snapshots on a red build without a reason
- acting on AI triage labels
- "environment" means ignore it
- never measuring the triage
- fragile locators "fixed" by a healer
Say it like this
In the interview: useful for locators, dangerous for values. Role and label locators avoid most breakage in the first place. When we updated a snapshot while a bug was on, the bug became the baseline in a one line change. For triage, a local model was right on eight of twelve failure logs and called a performance bug an environment problem. So rules come first, AI suggests, and a person decides.
- "Useful for locators, dangerous
- for values. Role locators avoid
- most breakage. A snapshot update
- during a bug made the bug the baseline in one line. For triage, a local model was right on 8 of 12 logs and called a slow-search
- bug environment, so rules come
- first, AI suggests, and a person
- decides."