You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define and implement the protocol-level schemas, contracts, and driver specifications required to support the "注εε³εΌι" (Register β Instant ObjectOS) architecture: Turso DB-per-Tenant + Metadata-Driven Deployment Pipeline + Shared Compute with Isolated Data.
Motivation
ObjectStack Cloud needs a complete protocol layer to support:
Turso DB-per-Tenant β Each tenant gets an independent Turso/libSQL database at registration
Shared Runtime + Isolated Data β Serverless functions are shared; data is physically isolated per tenant
App Marketplace Install β Install apps by injecting metadata + schema sync into tenant DB
This issue covers protocol and spec changes only (Zod schemas, TypeScript types, contracts). The runtime implementation is tracked in a separate issue.
C1. Deploy Bundle Schema β packages/spec/src/system/deploy-bundle.zod.ts (NEW FILE)
// Schemas to define:DeployBundleSchema// Container for all metadata being deployedDeployManifestSchema// Version, checksum, objects[], views[], flows[], permissions[]DeployDiffSchema// What changed: added/modified/removed objects and fieldsDeployValidationResult// Zod validation result for the entire bundleMigrationPlanSchema// Ordered list of DDL statements to executeDeployStatusEnum// 'validating' | 'diffing' | 'migrating' | 'registering' | 'ready' | 'failed'
Add tests
Export from system index
C2. Schema Diff Contract β packages/spec/src/contracts/schema-diff-service.ts (NEW FILE)
Summary
Define and implement the protocol-level schemas, contracts, and driver specifications required to support the "注εε³εΌι" (Register β Instant ObjectOS) architecture: Turso DB-per-Tenant + Metadata-Driven Deployment Pipeline + Shared Compute with Isolated Data.
Motivation
ObjectStack Cloud needs a complete protocol layer to support:
This issue covers protocol and spec changes only (Zod schemas, TypeScript types, contracts). The runtime implementation is tracked in a separate issue.
Architecture Decision Record
isolated_dbTenantIsolationLevelintenant.zod.tsTask Breakdown
Part A: Turso Driver Protocol Completion (spec)
Status: Phase 0 (Schema) β Done β Phase A (Core Driver) π΄ Needs Implementation
A1. Turso Multi-Tenant Router Schema β
packages/spec/src/data/driver/turso-multi-tenant.zod.tsTursoMultiTenantConfigSchemawithurlTemplate,groupAuthToken,tenantResolverStrategyTenantDatabaseLifecycleSchemawithonTenantCreate,onTenantDelete,onTenantSuspendhooksTursoGroupSchemafor Turso Database Group configuration (region, primary location)packages/spec/src/data/index.tsexportspackages/spec/src/data/driver/turso-multi-tenant.test.tsA2. Turso Platform API Contract β
packages/spec/src/contracts/turso-platform.tsITursoPlatformServiceinterface:createDatabase(),deleteDatabase(),listDatabases(),createToken(),revokeToken()TursoDatabaseInforesponse schemaTursoTokenScopeenum (full-access,read-only)@objectstack/driver-tursopackageA3. SQLite Dialect for SQL Compiler β Extend
packages/spec/src/data/driver-sql.zod.tsSQLDialectSchemaalready includes'sqlite'β (confirmed)SQLiteDataTypeMappingDefaultsconstant with TEXT/REAL/INTEGER/BLOB mappingsSQLiteAlterTableLimitationsdocumentation constant (no MODIFY COLUMN, table rebuild strategy)Part B: Tenant Provisioning Protocol
B1. Tenant Provisioning Schema β
packages/spec/src/system/provisioning.zod.ts(NEW FILE)packages/spec/src/system/provisioning.test.tspackages/spec/src/system/index.tsB2. Extend TenantSchema for Turso β
packages/spec/src/system/tenant.zod.tsdatabaseProviderfield toTenantSchema:z.enum(['turso', 'postgres', 'memory'])connectionConfigfield:z.object({ url, authToken, group })(encrypted at rest)provisioningStatusfield usingTenantProvisioningStatusEnumplanfield referencingTenantPlanSchemaB3. Provisioning Service Contract β
packages/spec/src/contracts/provisioning-service.ts(NEW FILE)Part C: Metadata-Driven Deployment Protocol
C1. Deploy Bundle Schema β
packages/spec/src/system/deploy-bundle.zod.ts(NEW FILE)C2. Schema Diff Contract β
packages/spec/src/contracts/schema-diff-service.ts(NEW FILE)C3. Deploy Pipeline Contract β
packages/spec/src/contracts/deploy-pipeline-service.ts(NEW FILE)Part D: Tenant-Aware Runtime Protocol
D1. Tenant Context Schema β Extend
packages/spec/src/kernel/context.zod.tsTenantRuntimeContextSchemaextendingKernelContextSchematenantId,tenantPlan,tenantRegion,tenantDbUrlD2. Tenant Router Contract β
packages/spec/src/contracts/tenant-router.ts(NEW FILE)D3. Tenant Quota Enforcement Schema β Extend
packages/spec/src/system/tenant.zod.tsTenantQuotaSchemawithmaxObjects,maxRecordsPerObject,maxDeploymentsPerDay,maxStorageBytesTenantUsageSchemafor current usage trackingQuotaEnforcementResultschemaPart E: App Installation Protocol
E1. App Install Bundle Schema β
packages/spec/src/system/app-install.zod.ts(NEW FILE)E2. App Lifecycle Contract β
packages/spec/src/contracts/app-lifecycle-service.ts(NEW FILE)Files to Create/Modify
src/data/driver/turso-multi-tenant.zod.tssrc/contracts/turso-platform.tssrc/system/provisioning.zod.tssrc/system/deploy-bundle.zod.tssrc/system/app-install.zod.tssrc/contracts/provisioning-service.tssrc/contracts/schema-diff-service.tssrc/contracts/deploy-pipeline-service.tssrc/contracts/tenant-router.tssrc/contracts/app-lifecycle-service.tssrc/system/tenant.zod.tssrc/kernel/context.zod.tssrc/system/index.tssrc/contracts/index.tsAcceptance Criteria
.describe()annotationsz.infer<>camelCase; all machine names usesnake_case.test.tswith β₯90% branch coveragepnpm testpasses across all packagespnpm buildsucceeds with no TypeScript errorsLabels
protocol,multi-tenant,turso,provisioning,P0References