Pattern Overview

Cross-Surface Consistency ensures that the same behavior executes identically regardless of which interface (web, mobile, API, CLI) it runs on.

This is the practical implementation of Orthogonal Orchestration.

The Problem

Traditional automation is tightly coupled to a specific interface:

Web UI Automation → Breaks when UI changes
Mobile App Automation → Different code than web
API Automation → Yet another implementation

Result: Same behavior, three different implementations, three times the maintenance.

The Solution

Separate behavior from interface:

Behavior (Gherkin) → Canonical Form (DAG)

        ┌─────────┼─────────┐
        ↓         ↓         ↓
      Web      Mobile     API
    Interface  Interface  Interface

The DAG is executed the same way on all surfaces. Only the interface mapping changes.

Example

Behavior (Gherkin)

Scenario: Login
  Given a user with valid credentials
  When the user submits the login form
  Then the user is authenticated
  And the dashboard is displayed

Interface Mappings

Web Interface (Figma)

Login Form
├── Email Input
├── Password Input
└── Submit Button

Mobile Interface (Figma)

Login Screen
├── Email Field
├── Password Field
└── Login Button

API Interface (OpenAPI)

POST /auth/login
{
  "email": "string",
  "password": "string"
}

Canonical Form (DAG)

validate_credentials

create_session

return_auth_token

Execution

The runtime maps:

All three execute the same DAG. The behavior is consistent.

Implementation

1. Define the Behavior (Gherkin)

Scenario: Login
  Given a user with valid credentials
  When the user submits the login form
  Then the user is authenticated

2. Define Interface Mappings (Figma + OpenAPI)

Web Mapping

{
  "email_input": "Email Input",
  "password_input": "Password Input",
  "submit_button": "Submit Button"
}

Mobile Mapping

{
  "email_input": "Email Field",
  "password_input": "Password Field",
  "submit_button": "Login Button"
}

API Mapping

{
  "email_input": "email",
  "password_input": "password",
  "submit_button": "POST /auth/login"
}

3. Execute on Any Surface

def execute_login(behavior, interface_mapping, surface):
    dag = parse_behavior(behavior)
    mapped_dag = map_to_interface(dag, interface_mapping[surface])
    return execute_dag(mapped_dag)

Benefits

  1. Single Source of Truth: Behavior is defined once
  2. Consistency: Same behavior on all surfaces
  3. Maintainability: Change behavior once, all surfaces update
  4. Testability: Test behavior independently of interface
  5. Scalability: Add new surfaces without duplicating logic