Uh oh!
There was an error while loading. Please reload this page.
improvement(api): centralize remaining v2 resource operations - #6412
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Copilot
New per-domain Reviewed by Cursor Bugbot for commit 58419aa. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR centralizes the remaining v2 custom-tool, MCP-server, skill, and secret routes around shared Principal-aware application operations while preserving separate compatibility paths for Copilot and workflow callers.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains in the available follow-up review scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/api/server/routes/v2-json-route.ts | Provides the declarative v2 route pipeline that authenticates, validates, rate-limits, invokes authorized use cases, and presents responses. |
| apps/sim/lib/copilot/auth/workspace-application-delegation.ts | Constructs trusted workspace-scoped delegated principals for Copilot application-use-case execution. |
| apps/sim/lib/custom-tools/application/use-cases.ts | Centralizes custom-tool authorization, strict creation, compatibility save behavior, audit projection, and error normalization. |
| apps/sim/lib/mcp/application/use-cases.ts | Centralizes MCP operations and sequences semantic audit before post-success runtime lifecycle effects. |
| apps/sim/lib/mcp/orchestration/server-lifecycle.ts | Exposes shared MCP persistence and runtime-effect primitives used by application and compatibility paths. |
| apps/sim/lib/skills/application/use-cases.ts | Centralizes authorized skill resource operations for v2 and delegated Copilot callers. |
| apps/sim/lib/secrets/application/use-cases.ts | Moves v2 secret operations behind shared Principal-aware application use cases. |
| apps/sim/app/api/v2/custom-tools/route.ts | Replaces bespoke list/create handling with declarative contracts and shared custom-tool use cases. |
| apps/sim/app/api/v2/mcp-servers/route.ts | Routes MCP list/create requests through centralized semantic operations while retaining v2-specific presentation and analytics. |
| apps/sim/app/api/v2/skills/route.ts | Routes skill list/create requests through centralized authorization and application behavior. |
Sequence Diagram
sequenceDiagram
participant Client as v2 API or Copilot
participant Adapter as Surface Adapter
participant UseCase as Authorized Use Case
participant Authz as Workspace Authorization
participant Domain as Semantic Operation
participant Audit as Audit
participant Effects as Post-success Effects
Client->>Adapter: Resource operation
Adapter->>UseCase: Principal and normalized input
UseCase->>Authz: Authorize principal and workspace
Authz-->>UseCase: Authorized context
UseCase->>Domain: Execute mutation or query
Domain-->>UseCase: Domain result
opt Audited mutation
UseCase->>Audit: Record semantic audit
end
opt MCP lifecycle mutation
UseCase->>Effects: Apply cache and connection effects
end
UseCase-->>Adapter: Result
Adapter-->>Client: Surface-specific response and analytics
Reviews (2): Last reviewed commit: "fix(api): preserve custom tool conflict ..." | Re-trigger Greptile
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 51dec53. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
TheodoreSpeaks
commented
Aug 8, 2026
Uh oh!
There was an error while loading. Please reload this page.

Summary
Migrates all 18 remaining v2 custom-tool, MCP-server, skill, and secret operations to declarative v2 JSON routes backed by shared Principal-aware semantic operations and authorized application use cases.
Copilot management tools now reuse the same application use cases through a shared trusted delegated-principal adapter. Semantic audit stays in the application wrapper, while v2 and Copilot product analytics remain surface-specific. Strict v2 create behavior remains separate from compatibility save/register operations.
Deferred by design: hybrid internal bulk/upsert routes and credential-wide surfaces retain their existing adapters and compatibility wrappers. v1, workspace files, knowledge, workflows, tables, billing, logs, credentials, audit logs, and workspaces are unchanged.
Fixes: N/A
Type of Change
Testing
Reviewers should focus on principal-kind policy, compatibility separation between strict create and save/register operations, audit attribution for workspace API keys, and MCP post-audit effects.
Checklist
Screenshots/Videos
Not applicable; no UI changes.