Skip to content

[v4]: add synthetic arg to /click route stub#1884

Open
seanmcguire12 wants to merge 2 commits intomainfrom
seanmcguire/stg-1659-add-optional-synthetic-bool-to-click
Open

[v4]: add synthetic arg to /click route stub#1884
seanmcguire12 wants to merge 2 commits intomainfrom
seanmcguire/stg-1659-add-optional-synthetic-bool-to-click

Conversation

@seanmcguire12
Copy link
Member

@seanmcguire12 seanmcguire12 commented Mar 24, 2026

why

  • to group two types of clicking into a single route. ie, we don't need to add a separate /sendClickEvent route

what changed

  • added an optional synthetic parameter to the /click schema, which we will internally route to .sendClickEvent()

screenshot:

Screenshot 2026-03-24 at 3 58 50 PM

test plan

  • added a test to verify passing synthetic: true passes validation

Summary by cubic

Add an optional synthetic flag to the v4 /click route to support synthetic click events through the same endpoint, defaulting to false for backward compatibility. Addresses Linear STG-1659.

  • New Features
    • Adds synthetic?: boolean (default false) to /click params and routes synthetic clicks to sendClickEvent.
    • Updates OpenAPI in packages/server-v4 to include synthetic in params and require it in action output params (with default false).
    • Adds an integration test validating synthetic: true is accepted and succeeds.

Written for commit b0bd197. Summary will update on new commits. Review in cubic

@changeset-bot
Copy link

changeset-bot bot commented Mar 24, 2026

⚠️ No Changeset found

Latest commit: b0bd197

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@seanmcguire12 seanmcguire12 changed the title [v4]: add synthetic arg to /click route [v4]: add synthetic arg to /click route stub Mar 24, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant Client
    participant API as API Route (/v4/page/click)
    participant Schema as Zod / OpenAPI Validation
    participant Service as Page Service

    Client->>API: POST /v4/page/click { selector, synthetic? }
    
    API->>Schema: Validate request body
    Note over Schema: NEW: Schema now includes "synthetic" (boolean, default false)
    
    alt Invalid Payload
        Schema-->>API: Validation Error
        API-->>Client: 400 Bad Request
    else Valid Payload
        Schema-->>API: Parsed Params
        API->>Service: click(params)

        alt NEW: params.synthetic == true
            Service->>Service: INTERNAL: route to sendClickEvent()
            Note over Service: Dispatches a synthetic JS click event
        else params.synthetic == false (default)
            Service->>Service: Standard click() logic
            Note over Service: Simulates trusted physical mouse interaction
        end

        Service-->>API: Action Result
        
        API->>Schema: NEW: Map to PageClickActionOutput
        Note over Schema: Output now includes synthetic flag in params metadata
        Schema-->>API: Formatted Response
        
        API-->>Client: 200 OK + Result
    end
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant