Analyzing Shaft Failures
Testing & Qualityanalyzing-shaft-failuresAnalyzing Shaft Failures is an Agent Skill for testing & quality published in the ShaftHQ/SHAFT_ENGINE repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Use when analyzing SHAFT Allure results, Doctor reports, trace evidence, healer output, flaky locator/wait/assertion failures, retries, or test-fix recommendations.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/ShaftHQ/SHAFT_ENGINE/blob/HEAD/shaft-skills/analyzing-shaft-failures/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/analyzing-shaft-failures, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Analyzing SHAFT Failures
Overview
Analyze populated evidence before changing tests. Separate product defects, test defects, and infrastructure problems; treat Doctor and healer patches as review-only until applied by the calling agent or user.
Evidence Workflow
- Count populated Allure
*-result.jsonfiles before trusting status, summaries, or screenshots. - Preserve the
allure-resultsroot; delete contents only when cleanup is explicitly needed. - Use
shaft-mcp:doctor_analyze_failed_allurefor WebDriver/Selenium SHAFT failures. - Use
shaft-mcp:playwright_doctor_analyze_failed_allurefor SHAFT Playwright failures. - Use
shaft-mcp:doctor_suggest_fixorshaft-mcp:playwright_doctor_suggest_fixonly after reviewing the Doctor report. - Prefer
shaft-mcp:trace_latest,shaft-mcp:trace_summarize, andshaft-mcp:doctor_analyze_tracewhen structured trace evidence exists. - Search the guide with
shaft-mcp:shaft_guide_searchbefore recommending SHAFT syntax changes. - Call
shaft-mcp:shaft_coding_partner_planwith the failed source path, selected failing code, and evidence paths before adding or moving repair code. - Run
shaft-mcp:test_code_guardrails_checkon any suggested Java patch.
Diagnosis Categories
| Symptom | First check |
|---|---|
| Locator not found or duplicate | Current DOM/tree, smart locator, app-owned attributes |
| Stale/hidden/covered/interactable | Page state, frame/window context, synchronized SHAFT action |
| Assertion mismatch | Expected behavior, test data, response/body state |
| Timeout/flaky retry | Deterministic wait condition, environment, network trace |
| Empty report | Test did not run or result path is wrong; do not infer pass/fail |
| Product behavior changed | Report suspected product bug, do not silently weaken assertions |
Healer Rules
shaft-mcp:healer_run_failed_testandshaft-mcp:playwright_healer_run_failed_testmay rerun and propose fixes, but they do not own source edits.- Require a headless, bounded Maven command and workspace-local evidence paths.
- Do not run cloud/external suites, publish PRs, or use provider advisories unless explicitly approved.
- Use
shaft_coding_partner_plan.reuseMatchesto keep repairs in the existing page/test owner instead of creating duplicate helper classes. - Validate applied fixes with
shaft-mcp:verify_run_focusedusing the smallest affected test or compile check; seeverifying-and-applying-shaft-changes.
Tool Catalog
Every shaft-mcp tool name and description is cached in
../references/shaft-mcp-tools.md. Read it to pick exact tool names instead of
listing tools at runtime, and load only the schemas you need — on clients that
defer tool schemas, batch the load in one lookup. When a shaft-cli launcher
is installed, prefer running the same tools as shell commands per
../references/shaft-cli-commands.md (shaft-cli call <tool>), falling back
to shaft-mcp:<tool> MCP calls otherwise.
Official Guide Routes
- Doctor:
https://shafthq.github.io/docs/agentic/doctor - MCP:
https://shafthq.github.io/docs/agentic/mcp - Flakiness:
https://shafthq.github.io/docs/testing/flakiness - Web locator strategy:
https://shafthq.github.io/docs/testing/web#locator-strategy - Element validations:
https://shafthq.github.io/docs/reference/actions/GUI/Element_Validations
Common Mistakes
| Mistake | Fix |
|---|---|
| Trusting empty Allure output | Count result JSON first |
| Fixing only the named test | Check shared page/API helper callers |
| Weakening assertion to pass | Confirm expected behavior or report product bug |
| Applying healer patch blindly | Review evidence and guardrails first |
Replacing allure-results directory | Preserve root and clean contents only |