[v4]: add method arg to /click route stub#1884
Conversation
|
synthetic arg to /click routesynthetic arg to /click route stub
There was a problem hiding this comment.
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
| button: MouseButtonSchema.optional(), | ||
| clickCount: z.number().int().min(1).optional(), | ||
| returnSelector: z.boolean().optional(), | ||
| synthetic: z.boolean().default(false), |
There was a problem hiding this comment.
| synthetic: z.boolean().default(false), | |
| method: z.enum(['jsevent', 'xy']).default('jsevent'), |
| @@ -271,6 +271,7 @@ export const PageClickParamsSchema = PageWithPageIdSchema.extend({ | |||
| button: MouseButtonSchema.optional(), | |||
| clickCount: z.number().int().min(1).optional(), | |||
There was a problem hiding this comment.
| clickCount: z.number().int().min(1).optional(), | |
| clickCount: z.number().int().lte(3).gte(1).optional(), |
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/server-v4/openapi.v4.yaml">
<violation number="1" location="packages/server-v4/openapi.v4.yaml:2494">
P1: The schema replaces `synthetic` with `method`, which breaks the intended `/click` API contract and rejects `synthetic` requests.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| maximum: 3 | ||
| returnSelector: | ||
| type: boolean | ||
| method: |
There was a problem hiding this comment.
P1: The schema replaces synthetic with method, which breaks the intended /click API contract and rejects synthetic requests.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/server-v4/openapi.v4.yaml, line 2494:
<comment>The schema replaces `synthetic` with `method`, which breaks the intended `/click` API contract and rejects `synthetic` requests.</comment>
<file context>
@@ -2488,12 +2488,15 @@ components:
- synthetic:
- default: false
- type: boolean
+ method:
+ default: xy
+ type: string
</file context>
synthetic arg to /click route stubmethod arg to /click route stub
Co-authored-by: Nick Sweeting <github@sweeting.me>
why
/sendClickEventroutewhat changed
syntheticparameter to the/clickschema, which we will internally route to.sendClickEvent()screenshot:
test plan
synthetic: truepasses validationSummary by cubic
Add a
methodparam to the v4/clickroute to support both coordinate-based and JS event clicks in one endpoint, defaulting toxyfor backward compatibility. CapsclickCountat 3 and updates the OpenAPI/action output. Addresses Linear STG-1659.method: 'xy' | 'jsevent'(defaultxy) to/clickparams; action output now includes and requiresmethodviaPageClickParamsOutput.clickCountto 1–3 in schema and OpenAPI inpackages/server-v4.method: "jsevent"selector clicks.Written for commit c02c521. Summary will update on new commits. Review in cubic