Skip to content

[major] Replay auto-heals silently with no opt-out — extraction precision degrades and wrong-target healing can false-pass #157

Description

@anmolsoin1

Summary

During testmd run replay, Kane CLI auto-heals locator/extraction failures silently and without any configuration to disable it. Two concrete problems result:

  1. Observed: after a semantically-neutral DOM change, the analyzer's extraction precision silently degraded from a single element to a large page blob — and the assertion still passed.
  2. Scenario: when multiple elements share a label (e.g. a "Sign In" link in the header nav and a "Sign In" button in the page body), healing can retarget an action to the wrong element — a silent false positive.

Auto-heal in replay should be configurable (opt-out), and healing events should be visible in run output so CI can gate on them.

Environment

  • kane-cli: 0.6.4 (npm @testmuai/kane-cli)
  • macOS (arm64), Chrome target, headless

Finding 1 — observed: extraction precision degrades under healing, run still reports "passed"

Repro

  1. Author a test asserting a page heading, e.g. dashboard shows Welcome back! inside an <h1>. The authored TEXTUAL_ANALYZER step freezes a role-based locator (role=heading[name="Welcome back!"i]) plus the NL query.
  2. Change the markup from <h1>Welcome back!</h1> to a <div> styled identically (visually pixel-same page).
  3. kane-cli testmd run <test>.md --headless --agent

Actual

Run reports overall_status: passed (replay_decisions: 1, no author decisions). However the extracted memory variable changed character completely — at authoring it captured just the heading text; after the tag change it captured a large blob of the page's main content:

dashboard_welcome_message = "Welcome back!\n\nYou are logged in as demo@acme.shop.\n\n3\n\nOrders\n\n$1,040\n\nTotal Spent\n\n120\n\nReward Points\n\nRecent Orders\n..."

The assertion passed only because "shows 'Welcome back!'" is satisfied as a contains-style match against the blob.

Evidence: session 80937943-b78b-4d0d-851c-35df5f36569b (run_end, variables_out).

Why this is a problem

  • The healed extraction is materially fuzzier than the authored one, with no signal in the output that precision changed.
  • False-pass risk: if the target text moves to a different component, or the same string exists elsewhere on the page (footer, nav), the assertion can still pass while the actual component under test is broken.

Finding 2 — scenario: wrong-target healing with duplicate labels

Pages commonly have duplicate action labels: e.g. "Sign In" in the header nav and another "Sign In" button in the hero/body. If the body button is removed in a new build, replay healing can retarget the click to the header nav link — the test passes while the component it was written against is gone. This is a silent false positive on exactly the class of regression tests exist to catch.

Expected behavior

  1. Configurable healing in replay — e.g. a frontmatter flag (heal: false), a CLI flag (--no-heal), and/or per-step strict mode. Default could stay heal-on, but CI pipelines need a strict mode.
  2. Healing visibility — when healing triggers, the run should say so: a distinct step/run status (e.g. passed_healed), an event in --agent NDJSON output, and a count in test_md_summary (alongside replay_decisions). CI must be able to fail or alert on "passed but healed".
  3. Extraction drift detection — when an analyzer's healed extraction differs substantially in scope from the authored one (single element → container blob), flag it as a warning at minimum.

Actual behavior

Healing is silent, always on, and indistinguishable from a clean pass in both the console summary and the NDJSON stream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions