Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ontract tests - Add tenantQuotas to TenantRuntimeContextSchema (A1) - Add currentUsers and apiRequestsThisMinute to TenantUsageSchema (A2) - Add tests for tenant-router, deploy-pipeline, provisioning, app-lifecycle contracts (B1-B4) - Update ROADMAP.md Phase 6.2 Multi-Tenancy progress (D4) Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 仔细评估是否已完成所有开发需求 |
…tenantRegion optional, add seedData - A1: Make tenantRegion optional per issue spec - A2: Rename objectCount→currentObjectCount, totalRecords→currentRecordCount, storageBytes→currentStorageBytes - C2: Add seedData[] to DeployBundleSchema - C3: Add seedData[] to AppManifestSchema - Update all related tests Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
经过仔细评估,发现了以下未对齐项并已在
所有其他需求 (A1 tenantQuotas, A2 currentUsers/apiRequestsThisMinute, A3 TenantQuotaSchema, B1-B4 contracts + tests, C1-C4 schemas, D1-D2 exports, D4 ROADMAP) 均已完成。229 test files / 6383 tests 全部通过。 |
There was a problem hiding this comment.
Pull request overview
This PR completes the multi-tenant runtime protocol layer by adding schema extensions for quota/usage tracking and comprehensive contract test coverage for the cloud provisioning architecture. The changes align with the "Protocol First" design principle, providing runtime validation schemas and service interface definitions.
Changes:
- Extended
TenantRuntimeContextSchemato include optionaltenantQuotasfield and maketenantRegionoptional - Renamed
TenantUsageSchemafields to followcurrent*prefix convention (currentUsers, currentObjectCount, currentRecordCount, currentStorageBytes, etc.) - Added
seedDataarrays to bothDeployBundleSchemaandAppManifestSchemafor deployment and app installation workflows - Added 4 contract test files covering tenant routing, provisioning lifecycle, deploy pipeline, and app installation
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/system/tenant.zod.ts | Renamed TenantUsageSchema fields to current* prefix, added currentUsers and apiRequestsThisMinute fields |
| packages/spec/src/system/tenant.test.ts | Updated tests to match new TenantUsageSchema field names |
| packages/spec/src/kernel/context.zod.ts | Added tenantQuotas field, made tenantRegion optional in TenantRuntimeContextSchema |
| packages/spec/src/kernel/context.test.ts | Added tests for tenantQuotas field, removed tenantRegion from required fields tests |
| packages/spec/src/system/deploy-bundle.zod.ts | Added seedData field to DeployBundleSchema |
| packages/spec/src/system/deploy-bundle.test.ts | Added test coverage for seedData field |
| packages/spec/src/system/app-install.zod.ts | Added seedData field to AppManifestSchema |
| packages/spec/src/system/app-install.test.ts | Added test coverage for seedData field |
| packages/spec/src/contracts/tenant-router.test.ts | New contract tests for ITenantRouter (session resolution, client caching, cache invalidation) |
| packages/spec/src/contracts/provisioning-service.test.ts | New contract tests for IProvisioningService (provision, suspend, resume, destroy, migrate) |
| packages/spec/src/contracts/deploy-pipeline-service.test.ts | New contract tests for IDeployPipelineService (validate, plan, execute, rollback) |
| packages/spec/src/contracts/app-lifecycle-service.test.ts | New contract tests for IAppLifecycleService (compatibility check, install, upgrade, uninstall) |
| ROADMAP.md | Updated Phase 6.2 Multi-Tenancy checklist to mark completed protocol work |
Completes the multi-tenant runtime protocol layer by adding missing schema fields and contract test coverage for the cloud provisioning architecture.
Schema extensions
TenantRuntimeContextSchema— addtenantQuotas: TenantQuotaSchema.optional()for per-request quota access downstream; maketenantRegionoptional per specTenantUsageSchema— align field names with issue spec:currentUsers,currentStorageBytes,currentObjectCount,currentRecordCount,deploymentsToday,apiRequestsThisMinuteDeployBundleSchema— addseedData[]for seed data records in deployment bundlesAppManifestSchema— addseedData[]for seed data records in app manifestsContract tests (4 new files)
tenant-router.test.ts—ITenantRoutersession resolution, client caching, cache invalidationdeploy-pipeline-service.test.ts—IDeployPipelineServicevalidate → plan → execute → rollbackprovisioning-service.test.ts—IProvisioningServicelifecycle (provision/suspend/resume/destroy/migrate)app-lifecycle-service.test.ts—IAppLifecycleServicecompatibility check, install, upgrade, uninstallROADMAP
Test results: 229 files, 6383 tests passing (was 225/6363).
Original prompt
This section details on the original issue you should resolve
<issue_title>[Runtime] 内核多租户 Runtime 协议升级 — Tenant Context + Router + Deploy Pipeline 合同</issue_title>
<issue_description>
Summary
升级
@objectstack/spec内核协议层,为 Cloud 多租户 "注册即开通" 架构提供完整的类型定义和服务合同。背景
spec v3.0 已完成
TenantSchema、TenantIsolationLevel、KernelContextSchema等基础协议。现在需要扩展以支持:开发任务
Part A: Tenant Runtime Context 扩展
A1.
TenantRuntimeContextSchema— 扩展packages/spec/src/kernel/context.zod.tscontext.test.ts增加新字段测试A2.
TenantUsageSchema— 新增到packages/spec/src/system/tenant.zod.tsA3. 扩展
TenantQuotaSchema— 增加以下字段maxObjects: z.number().int().optional()— 最大对象数maxRecordsPerObject: z.number().int().optional()— 每对象最大记录数maxDeploymentsPerDay: z.number().int().optional()— 每日最大部署次数Part B: 服务合同定义
B1.
ITenantRouter合同 —packages/spec/src/contracts/tenant-router.ts(NEW)Driver类型引用@objectql/types中已有的DriverinterfaceB2.
IDeployPipelineService合同 —packages/spec/src/contracts/deploy-pipeline-service.ts(NEW)B3.
IProvisioningService合同 —packages/spec/src/contracts/provisioning-service.ts(NEW)B4.
IAppLifecycleService合同 —packages/spec/src/contracts/app-lifecycle-service.ts(NEW)Part C: 数据 Schema 定义
C1.
TenantProvisioningSchema—packages/spec/src/system/provisioning.zod.ts(NEW)TenantProvisioningRequestSchema— 输入:orgId, plan, regionTenantProvisioningResultSchema— 输出:tenantId, connectionUrl, statusTenantProvisioningStatusEnum—'provisioning' | 'active' | 'suspended' | 'failed' | 'destroying'ProvisioningStepSchema— 单步状态追踪C2.
DeployBundleSchema—packages/spec/src/system/deploy-bundle.zod.ts(NEW)DeployBundleSchema— objects[], views[], flows[], permissions[], seedData[]DeployManifestSchema— version, checksum, metadataDeployDiffSchema— added/modified/removedMigrationPlanSchema— 有序 DDL 列表DeployStatusEnum—'validating' | 'diffing' | 'migrating' | 'registering' | 'ready' | 'failed'C3.
AppManifestSchema—packages/spec/src/system/app-install.zod.ts(NEW)AppManifestSchema— name, version, objects[], views[], flows[], seedData[]AppInstallResultSchema— installed objects, created tables, seeded recordsAppCompatibilityCheckSchema— kernel version check, conflict detectionC4. 扩展
TenantSchema— 修改packages/spec/src/system/tenant.zod.ts💡 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.