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>
|
This PR is very large. Consider breaking it into smaller PRs for easier review. |
There was a problem hiding this comment.
Pull request overview
This PR consolidates three overlapping protocol areas in the ObjectStack specification through a well-structured refactoring that establishes clear boundaries and single sources of truth.
Changes:
- Established a 3-layer synchronization architecture (Simple Sync → ETL Pipeline → Enterprise Connector) with clear audience targeting and use case differentiation
- Unified webhook protocol into a canonical schema (
automation/webhook.zod.ts) that other protocols reference or extend, eliminating duplicate definitions - Created shared authentication schemas in
auth/config.zod.tsfor connector authentication, removing ~170 lines of duplicate code and renaming application-level auth for clarity
Reviewed changes
Copilot reviewed 35 out of 37 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/auth/config.zod.ts | Added shared connector auth schemas (OAuth2, APIKey, Basic, Bearer, JWT, SAML, NoAuth); renamed application auth to ApplicationAuthConfigSchema |
| packages/spec/src/auth/config.test.ts | Updated test imports and schema references (contains critical bugs) |
| packages/spec/src/automation/webhook.zod.ts | Enhanced canonical webhook schema with authentication, retryPolicy, and comprehensive error handling |
| packages/spec/src/automation/webhook.test.ts | Updated tests to match new webhook schema structure |
| packages/spec/src/automation/workflow.zod.ts | Refactored to reference canonical WebhookSchema instead of duplicating fields |
| packages/spec/src/automation/workflow.test.ts | Updated workflow action tests to use nested config structure |
| packages/spec/src/integration/connector.zod.ts | Removed duplicate auth code, now imports from auth/config.zod.ts; extends WebhookSchema for connector-specific events |
| packages/spec/src/integration/connector.test.ts | Updated to import auth schemas from canonical source |
| packages/spec/src/automation/sync.zod.ts | Added L1 positioning documentation in 3-layer architecture |
| packages/spec/src/automation/etl.zod.ts | Added L2 positioning documentation in 3-layer architecture |
| packages/spec/docs/SYNC_ARCHITECTURE.md | Comprehensive new documentation with decision matrix, examples, and migration guides |
| JSON schema files | Generated schemas reflecting Zod changes (multiple files) |
| Documentation files | Updated references to reflect renamed schemas and new architecture |
| describe('AuthConfigSchema', () => { | ||
| describe('ApplicationAuthConfigSchema', () => { | ||
| it('should accept minimal valid configuration', () => { | ||
| const config: AuthConfig = { |
There was a problem hiding this comment.
Type annotation uses AuthConfig but should use ApplicationAuthConfig to match the renamed schema. The type AuthConfig now refers to connector authentication (from auth/config.zod.ts), while ApplicationAuthConfig is for user-facing authentication.
| }; | ||
|
|
||
| expect(() => EnterpriseAuthConfigSchema.parse(config)).not.toThrow(); | ||
| expect(() => EnterpriseApplicationAuthConfigSchema.parse(config)).not.toThrow(); |
There was a problem hiding this comment.
The test file uses EnterpriseApplicationAuthConfigSchema but this schema does not exist. The correct schema name is EnterpriseAuthConfigSchema (without "Application" in the name). This test should reference the imported schema name.
| }; | ||
|
|
||
| expect(() => EnterpriseAuthConfigSchema.parse(config)).not.toThrow(); | ||
| expect(() => EnterpriseApplicationAuthConfigSchema.parse(config)).not.toThrow(); |
There was a problem hiding this comment.
The test file uses EnterpriseApplicationAuthConfigSchema but this schema does not exist. The correct schema name is EnterpriseAuthConfigSchema (without "Application" in the name). This test should reference the imported schema name.
| it('should accept empty enterprise config', () => { | ||
| const config = {}; | ||
| expect(() => EnterpriseAuthConfigSchema.parse(config)).not.toThrow(); | ||
| expect(() => EnterpriseApplicationAuthConfigSchema.parse(config)).not.toThrow(); |
There was a problem hiding this comment.
The test file uses EnterpriseApplicationAuthConfigSchema but this schema does not exist. The correct schema name is EnterpriseAuthConfigSchema (without "Application" in the name). This test should reference the imported schema name.
| import { | ||
| APIKeySchema, | ||
| OAuth2Schema, | ||
| JWTAuthSchema, | ||
| SAMLAuthSchema, | ||
| BasicAuthSchema, | ||
| BearerAuthSchema, | ||
| NoAuthSchema, | ||
| AuthConfigSchema, | ||
| type APIKey, | ||
| type OAuth2, | ||
| type JWTAuth, | ||
| type SAMLAuth, | ||
| type BasicAuth, | ||
| type BearerAuth, | ||
| type NoAuth, | ||
| type AuthConfig, | ||
| } from '../auth/config.zod'; |
There was a problem hiding this comment.
Unused imports AuthConfigSchema, BasicAuthSchema, BearerAuthSchema, NoAuthSchema.
| | **certificate** | `string` | ✅ | SAML IdP certificate (X.509) | | ||
| | **privateKey** | `string` | optional | SAML service provider private key | | ||
| | **callbackUrl** | `string` | optional | SAML assertion consumer service URL | | ||
| | **signatureAlgorithm** | `Enum<'sha1' \| 'sha256' \| 'sha512'>` | optional | SAML signature algorithm | |
There was a problem hiding this comment.
The SAMLAuth configuration currently allows signatureAlgorithm: 'sha1', which relies on the weak SHA-1 hashing algorithm and is no longer considered secure for signing authentication assertions. If a SAML integration is configured with signatureAlgorithm: 'sha1', an attacker with SHA-1 collision capabilities could forge or tamper with SAML assertions and potentially bypass authentication. To mitigate this, restrict the signatureAlgorithm options to stronger algorithms like 'sha256' or 'sha512' and remove support for SHA-1 even for compatibility modes.
| | **signatureAlgorithm** | `Enum<'sha1' \| 'sha256' \| 'sha512'>` | optional | SAML signature algorithm | | |
| | **signatureAlgorithm** | `Enum<'sha256' \| 'sha512'>` | optional | SAML signature algorithm | |
Three protocol areas had overlapping definitions and unclear boundaries: synchronization (sync/ETL/connector), webhooks (3 locations), and authentication (scattered configs).
Changes
3-Layer Synchronization Architecture
Established clear abstraction layers with distinct audiences:
automation/sync.zod.ts) - Business users, field-level mappings onlyautomation/etl.zod.ts) - Data engineers, multi-source transformations (joins, aggregations, custom SQL)integration/connector.zod.ts) - System integrators, full feature set (auth, webhooks, rate limiting)Added
SYNC_ARCHITECTURE.mdwith decision matrix and migration paths.Canonical Webhook Protocol
Established
automation/webhook.zod.tsas single source of truth:Shared Authentication Schemas
Created canonical auth schemas in
auth/config.zod.ts(OAuth2, API Key, Basic, Bearer, JWT, SAML):Renamed application-level auth to
ApplicationAuthConfigSchemato distinguish from connector auth.Breaking Changes
retryCount→retryPolicy.maxRetriestype: 'api_key'→type: 'api-key',apiKey→keyAuthConfigSchema→ApplicationAuthConfigSchemaOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.