Skip to content

Conversation

@jonathannorris
Copy link
Member

@jonathannorris jonathannorris commented Sep 12, 2025

This PR introduces updated API schemas generated from the latest OpenAPI specification while maintaining backward compatibility and resolving TypeScript compilation issues. The new schemas in the zodClientV2.ts file are just being used for the /v2/features endpoints for now, in further PRs will update the rest of the endpoints. Also removed all the

Changes

  • ✅ New V2 Schemas: Add src/api/zodClientV2.ts with updated Zod schemas from latest OpenAPI spec
  • ✅ Schema Generation: Update script to generate V2 schemas alongside existing V1 schemas for selective migration
  • ✅ TypeScript Fixes: Implement intermediate type aliases to resolve inference issues with large schema definitions. Also refactored schemas to fix TS large schema generation issues.
  • ✅ Type Safety: Replace any types with proper schema-derived interfaces (Project, Environment, Variable, etc.)
  • ✅ Cleanup MCP: Removed variation and targeting MCP tools, just relying on PATCH feature endpoint.

Migration Strategy

V2 schemas are available for selective adoption alongside existing V1 schemas, allowing gradual migration without breaking existing functionality.

@jonathannorris jonathannorris requested a review from a team as a code owner September 12, 2025 19:09
@jonathannorris jonathannorris changed the title t show --name-only HEAD feat: Add V2 API schemas from updated OpenAPI specification Sep 12, 2025
@jonathannorris jonathannorris marked this pull request as draft September 12, 2025 19:12
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 12, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
devcycle-mcp-server b7b93c4 Sep 16 2025, 07:38 PM

@jonathannorris jonathannorris changed the title feat: Add V2 API schemas from updated OpenAPI specification feat: Use Feature V2 API schemas from updated OpenAPI specification, cleanup tools Sep 15, 2025
@jonathannorris jonathannorris force-pushed the fix-typescript-inference-issues branch from 41400a7 to 3f55ddb Compare September 15, 2025 19:31
@jonathannorris jonathannorris marked this pull request as ready for review September 15, 2025 19:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces updated API schemas generated from the latest OpenAPI specification while maintaining backward compatibility and cleaning up MCP tools. It updates V2 schemas for selective migration, fixes TypeScript compilation issues, and consolidates feature management functionality by removing specific variation and targeting tools.

  • Updates API schemas from latest OpenAPI spec with V2 schemas generated in zodClientV2.ts
  • Adds explicit type annotations for TypeScript compatibility and removes redundant MCP tools
  • Removes variation and targeting specific MCP tools to rely on the main PATCH feature endpoint

Reviewed Changes

Copilot reviewed 27 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/api/zodClient.ts Updates schema references to use V2 definitions and adds TypeScript workarounds for large schema inference
src/api/schemas.ts Refactors to use direct imports from zodClient instead of schemas object
src/mcp/types.ts Updates MCP tool schema references to use direct imports instead of schemas object
src/mcp/tools/featureTools.ts Comments out variation and targeting specific tools, consolidating to main feature endpoint
src/ui/prompts/*.ts Adds explicit type annotations for map callbacks to improve TypeScript inference
src/commands/**/*.ts Adds type imports and explicit type annotations for better type safety

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 27 out of 30 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 27 out of 30 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +552 to +666
// serverInstance.registerToolWithErrorHandling(
// 'fetch_feature_variations',
// {
// description: [
// 'Get a list of variations for a feature.',
// 'Include dashboard link in the response.',
// ].join('\n'),
// annotations: {
// title: 'Get Feature Variations',
// readOnlyHint: true,
// },
// inputSchema: ListVariationsArgsSchema.shape,
// },
// async (args: any) => {
// const validatedArgs = ListVariationsArgsSchema.parse(args)
// return await fetchFeatureVariationsHandler(validatedArgs, apiClient)
// },
// )

// serverInstance.registerToolWithErrorHandling(
// 'create_feature_variation',
// {
// description: [
// 'Create a new variation within a feature.',
// 'Include dashboard link in the response.',
// ].join('\n'),
// annotations: {
// title: 'Create Feature Variation',
// },
// inputSchema: CreateVariationArgsSchema.shape,
// },
// async (args: any) => {
// const validatedArgs = CreateVariationArgsSchema.parse(args)
// return await createFeatureVariationHandler(validatedArgs, apiClient)
// },
// )

// serverInstance.registerToolWithErrorHandling(
// 'update_feature_variation',
// {
// description: [
// 'Update an existing variation by key.',
// '⚠️ WARNING: Updating a feature variation may affect production environments.',
// 'Include dashboard link in the response.',
// ].join('\n'),
// annotations: {
// title: 'Update Feature Variation',
// destructiveHint: true,
// },
// inputSchema: UpdateVariationArgsSchema.shape,
// },
// async (args: any) => {
// const validatedArgs = UpdateVariationArgsSchema.parse(args)
// return await updateFeatureVariationHandler(validatedArgs, apiClient)
// },
// )

// serverInstance.registerToolWithErrorHandling(
// 'set_feature_targeting',
// {
// description: [
// 'Set targeting status for a feature in an environment.',
// '⚠️ IMPORTANT: Always confirm with the user before making changes to production environments (environments where type = "production").',
// 'Include dashboard link in the response.',
// ].join('\n'),
// annotations: {
// title: 'Set Feature Targeting',
// destructiveHint: true,
// },
// inputSchema: SetFeatureTargetingArgsSchema.shape,
// },
// async (args: any) => {
// const validatedArgs = SetFeatureTargetingArgsSchema.parse(args)
// return await setFeatureTargetingHandler(validatedArgs, apiClient)
// },
// )

// serverInstance.registerToolWithErrorHandling(
// 'list_feature_targeting',
// {
// description: [
// 'List feature configurations (targeting rules) for a feature.',
// 'Include dashboard link in the response.',
// ].join('\n'),
// annotations: {
// title: 'List Feature Targeting Rules',
// readOnlyHint: true,
// },
// inputSchema: ListFeatureTargetingArgsSchema.shape,
// },
// async (args: any) => {
// const validatedArgs = ListFeatureTargetingArgsSchema.parse(args)
// return await listFeatureTargetingHandler(validatedArgs, apiClient)
// },
// )

// serverInstance.registerToolWithErrorHandling(
// 'update_feature_targeting',
// {
// description: [
// 'Update feature configuration (targeting rules) for a feature in an environment.',
// '⚠️ IMPORTANT: Always confirm with the user before making changes to production environments (environments where type = "production").',
// 'Include dashboard link in the response.',
// ].join('\n'),
// annotations: {
// title: 'Update Feature Targeting Rules',
// destructiveHint: true,
// },
// inputSchema: UpdateFeatureTargetingArgsSchema.shape,
// },
// async (args: any) => {
// const validatedArgs = UpdateFeatureTargetingArgsSchema.parse(args)
// return await updateFeatureTargetingHandler(validatedArgs, apiClient)
// },
// )
Copy link
Member

Choose a reason for hiding this comment

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

Cleanup?

Copy link
Member Author

Choose a reason for hiding this comment

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

keeping them for now as I'm verifying the functionality of these tools, but yea there are a couple of these that I'm going to cleanup at the end of all these branches.

Comment on lines +347 to +352
// summary: UpdateFeatureDto.shape.summary.describe(
// 'Updated feature summary',
// ),
// staleness: UpdateFeatureDto.shape.staleness.describe(
// 'Updated feature staleness configuration',
// ),
Copy link
Member

Choose a reason for hiding this comment

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

cleanup?

@jonathannorris
Copy link
Member Author

@JamieSinn can I get a review on this root PR?

- Add intermediate type aliases to break complex Zodios endpoint inference chains
- Replace 'any' callback parameters with proper TypeScript interfaces (Project, Environment, Variable, etc.)
- Add missing FeatureOverride type export to zodClient schemas
- Add zod-to-json-schema dependency for schema comparison tools
- Maintain full type safety throughout codebase while working around TS inference limits
- Update schemas.ts to import schemas directly instead of from schemas object
- Fix zodClient export syntax by using proper alias syntax
- Unify Variable and Feature schemas by importing from zodClientV2
- Fix schema compatibility issues between zodClient and zodClientV2
- Update all schema references in commands and MCP types
- Add type casting where needed to resolve remaining compatibility issues
- Fix Zodios schema validation errors by updating test fixtures
- Add missing required fields (tags, publicName) to mock data
- Update HTTP request matching in Nock expectations for features update
- Fix MCP server test tool count expectations (21 vs 25+ tools)
- Update test snapshots to reflect schema changes
- Resolve all 187 test suite failures caused by stricter type validation
@jonathannorris jonathannorris force-pushed the fix-typescript-inference-issues branch from a4a94fb to b7b93c4 Compare September 16, 2025 19:35
Copy link
Member

@JamieSinn JamieSinn left a comment

Choose a reason for hiding this comment

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

Stacked prs should be merged bottom up. This is just insanely huge now

@jonathannorris
Copy link
Member Author

@JamieSinn nothing has been merged into this one, this was the original one before I figured out what I was going to do and started stacking.

@JamieSinn
Copy link
Member

Ah - i thought the updates were from merges

@jonathannorris jonathannorris merged commit 46fe458 into main Sep 16, 2025
9 checks passed
@jonathannorris jonathannorris deleted the fix-typescript-inference-issues branch September 16, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants