Skip to content

Unify MCP, guardrail, and skill locator guidance on the three-tier ladder #5412

Description

@MohabMohie

Parent

Subtask of #5408. Shipped on draft PR #5409.

Spec

One locator policy everywhere generated Java is taught:

  1. Unique author-written id: SHAFT.GUI.Locator.hasAnyTagName().hasId(...).build()
  2. ARIA: SHAFT.GUI.Locator.hasRole(...)
  3. Native relative By.xpath(...) only when neither exists
  4. Never SHAFT.GUI.Locator.xpath(...) or raw Locator.id/name/cssSelector/className/tagName(...)

Must delete the inverted MCP rule “ARIA first, then the SHAFT.GUI.Locator XPath builder”.

GeneratedCodeGuardrails.NO_ABSOLUTE_XPATH must not recommend a Locator XPath builder.

shaft-locator-design valid examples stay legal builder calls. Playbook practice 5 names the xpath factory without the exact call shape that false-triggered RECORD.

shaft-page-objects practice 3 states the same ladder.

Files

  • shaft-mcp/src/main/java/com/shaft/mcp/TestAutomationService.java
  • shaft-mcp/src/test/java/com/shaft/mcp/TestAutomationServiceTest.java
  • shaft-capture/src/main/java/com/shaft/capture/guardrail/GeneratedCodeGuardrails.java
  • shaft-skills/shaft-locator-design/references/playbook.md
  • shaft-skills/shaft-page-objects/references/playbook.md
  • tests/scripts/test_shaft_skills_content.py

Proof

mvn -pl shaft-mcp,shaft-capture -Dtest=TestAutomationServiceTest,GeneratedCodeGuardrailsTest test
python3 -m unittest tests.scripts.test_shaft_skills_content

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions