Skip to content

fix(copilot train): schema - #1873

Merged
aadamgough merged 1 commit into
stagingfrom
fix/copilot-train
Nov 10, 2025
Merged

fix(copilot train): schema#1873
aadamgough merged 1 commit into
stagingfrom
fix/copilot-train

Conversation

@aadamgough

Copy link
Copy Markdown
Contributor

Summary

Fix validation schmea

Type of Change

  • Bug fix

Testing

How has this been tested? What should reviewers focus on?

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Nov 10, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedNov 10, 2025 8:13pm

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Fixed validation schema mismatch in the copilot training API endpoint. The previous schema validated operations with fields (type, data, timestamp, metadata) that didn't match the actual data structure being sent from the training modal.

The corrected schema now properly validates:

  • operation_type - The type of edit operation (add, edit, delete, insert_into_subflow, extract_from_subflow)
  • block_id - The ID of the block being operated on
  • params - Optional parameters for the operation

This aligns with the EditOperation interface defined in compute-edit-sequence.ts:3-18 and the actual data being sent from training-modal.tsx:130.

Confidence Score: 5/5

  • This PR is safe to merge - it fixes a validation bug by correcting the schema to match actual data
  • The change correctly aligns the Zod validation schema with the actual EditOperation interface and data being sent. The fix is straightforward, well-scoped, and resolves a validation mismatch that would have caused 400 errors
  • No files require special attention

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/app/api/copilot/training/route.ts5/5Fixed validation schema to match actual operation data structure (operation_type, block_id, params)

Sequence Diagram

sequenceDiagram
participant Client as Training Modal
participant API as /api/copilot/training
participant Zod as Schema Validator
participant Indexer as Agent Indexer
Client->>API: POST training data
Note over Client,API: { title, prompt, input, output, operations }
API->>Zod: Validate request body
Note over Zod: TrainingDataSchema checks:<br/>- operations array<br/>- operation_type (string)<br/>- block_id (string)<br/>- params (optional)
alt Invalid Schema
Zod-->>API: Validation error
API-->>Client: 400 Bad Request
else Valid Schema
Zod-->>API: Validated data
API->>Indexer: POST /operations/add
Note over API,Indexer: Forwarded with x-api-key header
alt Indexer Success
Indexer-->>API: 200 OK
API-->>Client: Success response
else Indexer Error
Indexer-->>API: Error status
API-->>Client: Forward error status
end
end
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@aadamgough
aadamgough merged commit 0d4d953 into stagingNov 10, 2025
9 checks passed
waleedlatif1 pushed a commit that referenced this pull request Nov 10, 2025
@waleedlatif1
waleedlatif1 deleted the fix/copilot-train branch November 11, 2025 02:21
waleedlatif1 pushed a commit that referenced this pull request Nov 12, 2025
waleedlatif1 pushed a commit that referenced this pull request Nov 12, 2025
@waleedlatif1waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for freeto 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

@aadamgough