feat: complete all remaining protocol optimization items#612
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- Add StructuredOutputFormatSchema, TransformPipelineStepSchema, StructuredOutputConfigSchema - Add structuredOutput optional field to AgentSchema - Add MCPStreamingConfigSchema, MCPToolApprovalSchema, MCPSamplingConfigSchema - Add MCPRootEntrySchema, MCPRootsConfigSchema - Extend MCPServerConfigSchema with streaming, toolApproval, sampling - Extend MCPClientConfigSchema with roots - Export all new types Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…schemas to connector Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request implements comprehensive protocol enhancements across UI, API, AI, Auth/Security, Integration, and Identity domains as part of the PROTOCOL_OPTIMIZATION_REPORT.md initiative. The changes add critical features for accessibility, offline-first applications, API performance optimization, AI structured outputs, zero-trust security, resilient integrations, and enterprise identity management.
Changes:
- UI Protocol: Added touch interaction schemas (WCAG 2.5.5 compliant touch targets, gestures), keyboard navigation (focus management, shortcuts, roving tabindex), and offline support (cache-first/network-first strategies, conflict resolution, sync configuration)
- API Protocol: Implemented DataLoader/N+1 query prevention schemas, OpenAPI 3.1 webhooks and callbacks for asynchronous API patterns
- AI Protocol: Added structured output configuration (JSON Schema validation, retry logic, transform pipelines) and extended MCP protocol (streaming, tool approval, sampling, roots configuration)
- Auth/Security Protocol: Introduced mutual TLS (mTLS) support for zero-trust architectures and RLS audit logging for compliance tracking
- Integration Protocol: Added error mapping patterns, health checks, and circuit breaker configurations for resilient connectors
- Identity Protocol: Implemented SCIM 2.0 bulk operations (RFC 7644 §3.7) for batch user/group provisioning
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/ui/touch.zod.ts | Touch interaction and gesture recognition schemas with WCAG accessibility compliance |
| packages/spec/src/ui/touch.test.ts | Comprehensive test coverage for touch schemas (167 lines, 8 test suites) |
| packages/spec/src/ui/keyboard.zod.ts | Keyboard navigation, focus management, and shortcut configuration schemas |
| packages/spec/src/ui/keyboard.test.ts | Test coverage for keyboard interaction schemas (152 lines, 4 test suites) |
| packages/spec/src/ui/offline.zod.ts | Offline-first application support with cache strategies and sync configuration |
| packages/spec/src/ui/offline.test.ts | Offline schema tests (163 lines, 5 test suites) |
| packages/spec/src/ui/theme.zod.ts | Integration of touch target and keyboard navigation into theme configuration |
| packages/spec/src/ui/index.ts | Exports for new UI schemas |
| packages/spec/src/api/contract.zod.ts | DataLoader and batch loading strategies for N+1 query prevention |
| packages/spec/src/api/contract.test.ts | Query optimization tests (127 lines, 3 test suites) |
| packages/spec/src/api/rest-server.zod.ts | OpenAPI 3.1 webhooks, callbacks, and JSON Schema dialect support |
| packages/spec/src/api/rest-server.test.ts | Webhook and callback tests (174 lines, 4 test suites) |
| packages/spec/src/ai/agent.zod.ts | Structured output format and validation configuration for agents |
| packages/spec/src/ai/agent.test.ts | Structured output tests integrated with agent schema tests (117 lines added) |
| packages/spec/src/ai/mcp.zod.ts | MCP protocol extensions: streaming, tool approval, sampling, roots |
| packages/spec/src/ai/mcp.test.ts | MCP extension tests (194 lines, 4 test suites) |
| packages/spec/src/system/auth-config.zod.ts | Mutual TLS configuration for client certificate authentication |
| packages/spec/src/system/auth-config.test.ts | mTLS configuration tests (75 lines, 1 test suite) |
| packages/spec/src/security/rls.zod.ts | RLS audit event and configuration schemas for compliance logging |
| packages/spec/src/security/rls.test.ts | RLS audit tests (153 lines, 3 test suites) |
| packages/spec/src/integration/connector.zod.ts | Error mapping, health checks, and circuit breaker schemas |
| packages/spec/src/integration/connector.test.ts | Resilience pattern tests (237 lines, 4 test suites) |
| packages/spec/src/identity/scim.zod.ts | SCIM 2.0 bulk operation request/response schemas (RFC 7644 compliant) |
| packages/spec/src/identity/scim.test.ts | SCIM bulk operation tests (140 lines, 3 test suites) |
| export const ErrorMappingConfigSchema = z.object({ | ||
| rules: z.array(ErrorMappingRuleSchema).describe('Error mapping rules'), | ||
| defaultCategory: ErrorCategorySchema.optional().default('integration_error').describe('Default category for unmapped errors'), | ||
| unmappedBehavior: z.enum(['passthrough', 'generic_error', 'throw']).describe('What to do with unmapped errors'), |
There was a problem hiding this comment.
The unmappedBehavior field in ErrorMappingConfigSchema is required, which means users must always specify it when configuring error mapping. Consider adding a sensible default (e.g., default('generic_error')) to make the configuration more developer-friendly while still allowing explicit overrides. This would align with the pattern used for other similar configuration options like defaultCategory.
| unmappedBehavior: z.enum(['passthrough', 'generic_error', 'throw']).describe('What to do with unmapped errors'), | |
| unmappedBehavior: z.enum(['passthrough', 'generic_error', 'throw']).optional().default('generic_error').describe('What to do with unmapped errors'), |
| trustedCAs: z.array(z.string()) | ||
| .describe('PEM-encoded CA certificates or file paths'), | ||
|
|
||
| /** Certificate Revocation List URL */ | ||
| crlUrl: z.string() | ||
| .optional() | ||
| .describe('Certificate Revocation List (CRL) URL'), | ||
|
|
||
| /** Online Certificate Status Protocol URL */ | ||
| ocspUrl: z.string() | ||
| .optional() | ||
| .describe('Online Certificate Status Protocol (OCSP) URL'), | ||
|
|
||
| /** Certificate validation strictness level */ | ||
| certificateValidation: z.enum(['strict', 'relaxed', 'none']) | ||
| .describe('Certificate validation strictness level'), |
There was a problem hiding this comment.
The trustedCAs and certificateValidation fields are required in MutualTLSConfigSchema. While this ensures explicit configuration, consider making trustedCAs default to an empty array and certificateValidation default to 'strict' for better developer experience. This would allow minimal configuration while maintaining security by default. The current design requires all users to specify these even when they want defaults.
| PersistStorageSchema, | ||
| EvictionPolicySchema, | ||
| OfflineCacheConfigSchema, | ||
| OfflineConfigSchema, | ||
| type OfflineStrategy, | ||
| type ConflictResolution, | ||
| type SyncConfig, | ||
| type PersistStorage, | ||
| type EvictionPolicy, |
There was a problem hiding this comment.
Unused imports EvictionPolicySchema, PersistStorageSchema.
| PersistStorageSchema, | |
| EvictionPolicySchema, | |
| OfflineCacheConfigSchema, | |
| OfflineConfigSchema, | |
| type OfflineStrategy, | |
| type ConflictResolution, | |
| type SyncConfig, | |
| type PersistStorage, | |
| type EvictionPolicy, | |
| OfflineCacheConfigSchema, | |
| OfflineConfigSchema, | |
| type OfflineStrategy, | |
| type ConflictResolution, | |
| type SyncConfig, |
…9 files, 178 tests, 4656 test cases) Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Implements all remaining ⏳/❌ items from PROTOCOL_OPTIMIZATION_REPORT.md across 6 protocol domains. Adds 20 new schemas, 138 new tests (4518→4656), bringing Zod file count from 139→159.
UI Protocol (3 new files)
ui/touch.zod.ts— 7 gesture types (swipe/pinch/longPress/doubleTap/drag/rotate/pan), WCAG 44px touch targets, haptic feedbackui/offline.zod.ts— 5 offline strategies (cache_first/network_first/stale_while_revalidate/network_only/cache_only), sync with conflict resolution, IndexedDB/LocalStorage/SQLite backendsui/keyboard.zod.ts— Focus traps, keyboard shortcuts with 4 scopes (global/page/component/modal), roving tabindexui/theme.zod.tsextended withtouchTarget+keyboardNavigationAPI Protocol
api/contract.zod.ts—DataLoaderConfigSchema,BatchLoadingStrategySchema,QueryOptimizationConfigSchemafor N+1 preventionapi/rest-server.zod.ts—WebhookEventSchema,WebhookConfigSchema,CallbackSchema,OpenApi31ExtensionsSchemaAI Protocol
ai/agent.zod.ts—StructuredOutputConfigSchema(json_object/json_schema/regex/grammar/xml formats + validation pipeline)ai/mcp.zod.ts—MCPStreamingConfigSchema,MCPToolApprovalSchema,MCPSamplingConfigSchema,MCPRootsConfigSchemaAuth/Security
identity/scim.zod.ts— SCIM 2.0 Bulk Operations per RFC 7644 (SCIMBulkRequestSchema,SCIMBulkResponseSchema)system/auth-config.zod.ts—MutualTLSConfigSchema(client certs, CA trust, CRL/OCSP, certificate pinning)security/rls.zod.ts—RLSAuditEventSchema,RLSAuditConfigSchema(log level, destination, sample rate, retention)Integration
integration/connector.zod.ts—ErrorMappingConfigSchema(8 error categories, unmapped behavior),HealthCheckConfigSchema,CircuitBreakerConfigSchemaExample
PROTOCOL_OPTIMIZATION_REPORT.md updated to reflect all completions (rating: 4.2→4.8/5).
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.