ContractSync Switch AI v0.31
Simulator Contract & Code Test Suite (10/10) GitHub
Autonomous Dual-Agent API Governance & Synchronization

One API Contract. Two Agents.
Zero Synchronization Chaos.

Stop breaking frontend apps when backend APIs change. ContractSync connects SpecArchitect and FrontendSync inside a shared Switch room to analyze breaking changes, enforce human approval gates, and synchronize TypeScript types and mocks with real compiler verification.

Live Switch Room Coordination

#api-contract-room Live Simulator

Interact with the actual 7-step Switch protocol workflow in real time.

Room Participants
  • DEV
    Developer
    @developer (Approver)
  • SA
    SpecArchitect
    @spec-architect (Backend)
  • FS
    FrontendSync
    @frontend-sync (Frontend)
Workflow State
Ready (Contract v1.0.0)
Switch Protocol: WebSocket ws://
Event Ordering: Monotonic Seq Log
Gate Status: Active & Armed
api-contract-room | Switch Append-Only Bus
0 messages

Click "Run Full Workflow" or "Next Step" to see the real Switch message log in action.

Synchronized Artifacts

Live Contract & Code Inspector

Examine how the OpenAPI contract evolution automatically synchronizes frontend TypeScript interfaces and mocks.

openapi: 3.0.3
info:
  title: Spot Service API
  version: 1.1.0  # Bumped after approved human migration
paths:
  /api/spots:
    get:
      summary: Retrieve spots
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Spot'
components:
  schemas:
    Spot:
      type: object
      required:
        - id
        - name
        - availability_state  # New required field replaces spot_status
      properties:
        id:
          type: integer
          example: 101
        name:
          type: string
          example: Library
        availability_state:
          type: string
          description: Current operational availability state of the resource spot
          example: available
        role:
          type: string
          description: Access role associated with the spot
          enum: [admin, user, guest]
          example: admin
        spot_status:
          type: string
          description: DEPRECATED: Use availability_state instead. Retained for backward compatibility.
          deprecated: true  # Preserved for legacy consumers
          example: available
Quality Assurance & Verification

Automated Test Suite (10/10 Passing)

Every core mechanism is backed by automated end-to-end and unit tests.

100% Test Pass Rate
PASS
Test 01: OpenAPI Specification Validity
Validates OpenAPI 3.0.3 compliance, schema structure, and endpoint paths.
PASS
Test 02: Field Rename Breaking Change Detection
Identifies spot_status -> availability_state as a CRITICAL breaking change.
PASS
Test 03: Detection of Newly Introduced Enum
Extracts role enum values [admin, user, guest] with validation.
PASS
Test 04: Preservation of Deprecated Compatibility Field
Guarantees spot_status is retained with deprecated: true and optionality.
PASS
Test 05: Deterministic TypeScript Type Generation
Generates Spot, SpotRole union, and @deprecated JSDoc comments.
PASS
Test 06: Mock Data Consistency
Ensures mock fixtures provide valid values for all active and deprecated fields.
PASS
Test 07: TypeScript Compilation Verification (tsc --noEmit)
Runs real TypeScript compiler and asserts zero type errors (Exit code 0).
PASS
Test 08: Rejection of Unapproved Contract Modifications
Proves SpecArchitect strictly refuses to modify openapi.yaml without human approval.
PASS
Test 09: Handling Invalid or Incomplete Approvals
Rejects non-conforming or vague approval instructions missing mitigation terms.
PASS
Test 10: Switch Wire Protocol & Operations Verification
Verifies WebSocket frame lifecycles, ping/pong cursors, and monotonic seq.