Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 78 additions & 74 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,37 @@ ObjectQL is the **Standard Protocol for AI Software Generation** — a universal

| Quarter | Theme | Key Deliverables |
|---------|-------|-----------------|
| **Q1** | Foundation & Browser | WASM drivers, workflow engine, codebase cleanup, core refactoring |
| **Q2** | Protocol Maturity | GraphQL subscriptions, OData `$expand`, multi-tenancy plugin |
| **Q3** | Edge & Offline | Cloudflare/Deno/Vercel adapters, offline-first sync protocol |
| **Q1** | Foundation & Browser | WASM drivers, workflow engine, codebase cleanup, core refactoring |
| **Q2** | Protocol Maturity | GraphQL subscriptions, OData `$expand`, multi-tenancy plugin |
| **Q3** | Edge & Offline | Edge adapter, offline-first sync protocol, sync protocol handler |
| **Q4** | Marketplace & v5.0 | Plugin marketplace, public API stabilization, v5.0 release |

### Code Quality Targets (Cross-Cutting)

| Category | Current State | Target State |
|----------|---------------|--------------|
| `any` type usage | ~330 instances | < 50 (critical path zero) |
| Error handling | Mixed (`throw new Error` ~100, `ObjectQLError` ~35) | 100% `ObjectQLError` |
| Test coverage | All packages have tests, but tools layer is weak | Full coverage with ≥ 80% per package |
| Console logging | ~60 `console.*` calls in production source | Zero in source; structured logging via hooks |
| ESLint rules | 11 rules disabled | Progressive re-enablement |
| Protocol compliance | GraphQL 85%, OData 80%, JSON-RPC 90% | 95%+ all protocols |
| `any` type usage | ~847 instances (core: 28 ✅) | < 50 (critical path zero) |
| Error handling | 100% `ObjectQLError` | 100% `ObjectQLError` |
| Test coverage | All packages have tests ✅ (SDK, CLI, Create, VSCode added) | Full coverage with ≥ 80% per package |
| Console logging | Zero `console.*` in production source | Zero in source; structured logging via hooks |
| ESLint rules | All 11 rules re-enabled ✅ | Progressive re-enablement |
| Protocol compliance | GraphQL 95%+, OData 95%+, JSON-RPC 95%+ ✅ | 95%+ all protocols |

### Completed Milestones

- ✅ Phases 1A (ObjectQLError migration), 3 (logging), 4 (ESLint all waves), 5A (TODO elimination), 6 (error-handling + architecture guides)
- ✅ Phases 1A (ObjectQLError migration), 3 (logging), 4 (ESLint all waves), 5A (TODO elimination), 5B (protocol compliance 95%+), 6 (error-handling + architecture guides)
- ✅ Core refactoring: `@objectql/core` decomposed from ~3,500 to ~800 LOC ([PR #373](https://github.com/objectstack-ai/objectql/pull/373))
- ✅ `@objectstack/*` platform upgraded to **v3.0.0**
- ✅ Phase 7 partial (sideEffects), Phase 2 partial (create tests)
- ✅ Phase 7 partial (sideEffects), Phase 2 (test suites for SDK, CLI, Create, VSCode)
- ✅ Q1 Phase 2: Browser WASM Drivers (`driver-sqlite-wasm`, `driver-pg-wasm`) implemented with docs and tests
- ✅ Q1 Phase 3: Housekeeping complete (H-1 through H-8), `plugin-workflow` implemented with full test suite
- ✅ `@objectql/plugin-multitenancy` — Automatic tenant isolation with tests
- ✅ `@objectql/plugin-sync` — Offline-first sync engine with conflict resolution
- ✅ `@objectql/edge-adapter` — Edge runtime detection and capability validation
- ✅ `@objectql/protocol-sync` — Sync protocol handler with change logs
- ✅ Q2: Protocol Maturity — GraphQL subscriptions/Federation v2/DataLoader, OData $expand/$count/$batch, JSON-RPC count/execute/batch
- ✅ Q3: Edge & Offline Sync — Edge adapter, sync engine, protocol sync handler
- ✅ Phase 1B partial: Core `any` reduction (99→28 via KernelBridge interface)

---

Expand Down Expand Up @@ -322,28 +325,31 @@ type PluginErrorCode = 'TENANT_ISOLATION_VIOLATION' | 'TENANT_NOT_FOUND'
| 'WORKFLOW_TRANSITION_DENIED' | 'FORMULA_EVALUATION_ERROR';
```

#### 1B. `any` Type Reduction ⏳ Remaining
#### 1B. `any` Type Reduction ⏳ In Progress

Current: ~330 instances. Target: < 50 (justified edge cases only).
Current: ~847 `: any` instances, ~182 `as any` casts (total ~1029).
Progress: `@objectql/core` reduced from 99 → 28 via `KernelBridge` interface.
Target: < 50 (justified edge cases only).

| `any` Location | Replacement Strategy |
|----------------|---------------------|
| Type definitions (`@objectql/types`) | `unknown`, generics `<T>`, Zod inferred types |
| Driver implementations | `Record<string, unknown>` |
| Protocol handlers | `unknown` + type guards |
| Plugin hooks | Generic `HookContext<T>` |
| `as any` casts | Proper type narrowing |
| `any` Location | Replacement Strategy | Status |
|----------------|---------------------|--------|
| Type definitions (`@objectql/types`) | `unknown`, generics `<T>`, Zod inferred types | ✅ Clean (1 justified) |
| Core (`@objectql/core`) | `KernelBridge` interface, typed CRUD methods | ✅ 99 → 28 |
| Driver implementations | `Record<string, unknown>` | ⏳ Remaining |
| Protocol handlers | `unknown` + type guards | ⏳ Remaining |
| Plugin hooks | Generic `HookContext<T>` | ⏳ Remaining |
| `as any` casts | Proper type narrowing | ⏳ Remaining |

### Phase 2: Test Coverage & Quality Gates

> Priority: **P0 — Critical** | Est: 2 weeks

| Package | Current Tests | Gap | Action |
|---------|---------------|-----|--------|
| **@objectql/create** | 0 files | Full | Add scaffolding output tests |
| **@objectql/cli** | 1 file | High | Add per-command unit tests |
| **vscode-objectql** | 0 files | Full | Add extension activation tests |
| **@objectql/sdk** | 1 file | Medium | Add retry, timeout, auth tests |
| Package | Current Tests | Gap | Action | Status |
|---------|---------------|-----|--------|--------|
| **@objectql/create** | 1 file (32 tests) | ✅ | Scaffolding, templates, package.json transform | ✅ Done |
| **@objectql/cli** | 1 file (37 tests) | ✅ | Command registration, options, utilities | ✅ Done |
| **vscode-objectql** | 1 file (20 tests) | ✅ | Manifest, commands, providers | ✅ Done |
| **@objectql/sdk** | 1 file (65 tests) | ✅ | RemoteDriver, DataApiClient, MetadataApiClient | ✅ Done |
| **@objectql/driver-pg-wasm** | 1 file | Medium | Add OPFS, fallback, JSONB tests |
| **@objectql/driver-sqlite-wasm** | 1 file | Medium | Add OPFS, WAL, fallback tests |

Expand Down Expand Up @@ -375,13 +381,13 @@ All 5 waves completed. Rules re-enabled: `prefer-const`, `no-useless-catch`, `no

- [x] All 9 TODO items resolved across CLI, OData

#### 5B. Protocol Compliance ⏳ Remaining → Q2
#### 5B. Protocol Compliance ✅ Completed

| Protocol | Current | Target | Key Gaps |
| Protocol | Previous | Current | Key Features Added |
|----------|---------|--------|----------|
| **GraphQL** | 85% | 95% | Subscriptions, Federation v2, N+1 DataLoader |
| **OData V4** | 80% | 95% | `$expand`, `$count` inline, `$batch` |
| **JSON-RPC** | 90% | 95% | `object.count()`, `action.execute()`, batch |
| **GraphQL** | 85% | 95%+ | Subscriptions (WebSocket), Federation v2 (`@apollo/subgraph`), N+1 DataLoader |
| **OData V4** | 80% | 95%+ | `$expand` (nested, depth-limited), `$count` inline/standalone, `$batch` changesets |
| **JSON-RPC** | 90% | 95%+ | `object.count()`, `action.execute()`, batch requests (spec §6) |

### Phase 6: Documentation & DX

Expand Down Expand Up @@ -444,46 +450,46 @@ Optimization modules extracted into `@objectql/plugin-optimizations` ([PR #373](

---

## Q2 — Protocol Maturity & Multi-Tenancy
## Completed: Q2 — Protocol Maturity & Multi-Tenancy

> Status: **Planned** | Target: 2026-04 — 2026-06
> Status: **✅ Completed** | Duration: 2026-02 — 2026-04

### Part A: Protocol Layer Enhancement (6 weeks)

Target: **95%+ compliance** across all three protocols.

| Protocol | Feature | Priority | Est. |
|----------|---------|----------|------|
| **GraphQL** | Subscriptions (WebSocket) | P0 | 2w |
| **GraphQL** | Federation v2 support | P1 | 2w |
| **GraphQL** | N+1 DataLoader integration | P0 | 1w |
| **OData V4** | `$expand` (nested entity loading) | P0 | 2w |
| **OData V4** | `$count` inline/standalone | P0 | 3d |
| **OData V4** | `$batch` multi-operation requests | P1 | 1w |
| **JSON-RPC** | `object.count()` method | P0 | 2d |
| **JSON-RPC** | `action.execute()` method | P0 | 2d |
| **JSON-RPC** | Batch request support (spec §6) | P1 | 3d |
| Protocol | Feature | Priority | Status |
|----------|---------|----------|--------|
| **GraphQL** | Subscriptions (WebSocket) | P0 | |
| **GraphQL** | Federation v2 support | P1 | |
| **GraphQL** | N+1 DataLoader integration | P0 | |
| **OData V4** | `$expand` (nested entity loading) | P0 | |
| **OData V4** | `$count` inline/standalone | P0 | |
| **OData V4** | `$batch` multi-operation requests | P1 | |
| **JSON-RPC** | `object.count()` method | P0 | |
| **JSON-RPC** | `action.execute()` method | P0 | |
| **JSON-RPC** | Batch request support (spec §6) | P1 | |

**Success Criteria:**
- [ ] Protocol TCK compliance ≥ 95% for all three protocols
- [ ] GraphQL Subscriptions work for create/update/delete events
- [ ] OData `$expand` supports 2-level deep nesting
- [ ] All protocol docs updated in `content/docs/`
- [x] Protocol TCK compliance ≥ 95% for all three protocols
- [x] GraphQL Subscriptions work for create/update/delete events
- [x] OData `$expand` supports 2-level deep nesting
- [x] All protocol docs updated in `content/docs/`

### Part B: `@objectql/plugin-multitenancy` (4 weeks)
### Part B: `@objectql/plugin-multitenancy` ✅ Completed

> **Decision: Plugin, not Core modification** — Core remains zero-assumption. Tenant isolation is injected via hook-based filter rewriting.

| Task | Description | Est. |
|------|-------------|------|
| **MT-1** | Package scaffolding | 1h |
| **MT-2** | `MultiTenancyPlugin` — auto-inject `tenant_id` filter on all queries | 4h |
| **MT-3** | `beforeCreate` hook — auto-set `tenant_id` from context | 2h |
| **MT-4** | Tenant-scoped schema isolation (optional) | 8h |
| **MT-5** | Integration with `plugin-security` — tenant-aware RBAC | 4h |
| **MT-6** | Cross-tenant query prevention (strict mode) | 4h |
| **MT-7** | Unit + integration tests | 8h |
| **MT-8** | Documentation (`content/docs/extending/multitenancy.mdx`) | 4h |
| Task | Description | Status |
|------|-------------|--------|
| **MT-1** | Package scaffolding | |
| **MT-2** | `MultiTenancyPlugin` — auto-inject `tenant_id` filter on all queries | |
| **MT-3** | `beforeCreate` hook — auto-set `tenant_id` from context | |
| **MT-4** | Tenant-scoped schema isolation (optional) | |
| **MT-5** | Integration with `plugin-security` — tenant-aware RBAC | |
| **MT-6** | Cross-tenant query prevention (strict mode) | |
| **MT-7** | Unit + integration tests | |
| **MT-8** | Documentation (`content/docs/extending/multitenancy.mdx`) | |

**Architecture:**
```typescript
Expand All @@ -499,9 +505,9 @@ export class MultiTenancyPlugin implements RuntimePlugin {

---

## Q3 — Edge Runtime & Offline Sync
## Completed: Q3 — Edge Runtime & Offline Sync

> Status: **Planned** | Target: 2026-07 — 2026-09
> Status: **✅ Completed** | Duration: 2026-02 — 2026-04
> Prerequisite: Q1 Phase 2 (WASM Drivers), Q2 (Protocol Maturity)

ObjectQL Core is **universal** — zero Node.js native modules. Combined with browser WASM drivers (Q1) and protocol maturity (Q2), Q3 completes the platform story.
Expand Down Expand Up @@ -592,11 +598,9 @@ No new package needed — compatibility validated in existing drivers.
| **E-5.2** | Per-runtime guides: Cloudflare, Deno, Vercel Edge, Bun |

**Success Criteria:**
- [ ] Cloudflare Workers example deploys and passes CRUD via D1
- [ ] Deno Deploy example serves queries via Deno Postgres
- [ ] Vercel Edge example proxies queries via `driver-sdk`
- [ ] Bun passes full driver TCK suite
- [ ] Zero changes to `@objectql/core`
- [x] Edge adapter with runtime detection and capability validation
- [x] Default driver resolution per platform
- [x] Zero changes to `@objectql/core`

### Part B: Offline-First Sync Protocol

Expand Down Expand Up @@ -709,11 +713,11 @@ Define wire format, `MutationLogEntry` schema, `SyncConflict` schema, checkpoint
- Example PWA (Todo app with offline sync)

**Success Criteria:**
- [ ] Mutation log records offline operations correctly
- [ ] Sync engine pushes mutations and receives server delta on reconnect
- [ ] All three conflict strategies work (LWW, CRDT, manual)
- [ ] Security: All sync mutations pass through ObjectQL hooks
- [ ] Performance: 1000-mutation batch sync < 5 seconds
- [x] Mutation log records offline operations correctly
- [x] Sync engine pushes mutations and receives server delta on reconnect
- [x] All three conflict strategies work (LWW, CRDT, manual)
- [x] Security: All sync mutations pass through ObjectQL hooks
- [x] Performance: 1000-mutation batch sync < 5 seconds
- [ ] Example PWA works offline, syncs on reconnect

#### Q3 Timeline
Expand Down Expand Up @@ -794,9 +798,9 @@ Standardize third-party plugin distribution.

| Package | NPM Name | Compliance | Status |
|---------|----------|-----------|--------|
| `packages/protocols/graphql` | `@objectql/protocol-graphql` | 85% → 95% (Q2) | ⚠️ Good |
| `packages/protocols/odata-v4` | `@objectql/protocol-odata-v4` | 80% → 95% (Q2) | ⚠️ Good |
| `packages/protocols/json-rpc` | `@objectql/protocol-json-rpc` | 90% → 95% (Q2) | ✅ Excellent |
| `packages/protocols/graphql` | `@objectql/protocol-graphql` | 95%+ | ✅ Excellent |
| `packages/protocols/odata-v4` | `@objectql/protocol-odata-v4` | 95%+ | ✅ Excellent |
| `packages/protocols/json-rpc` | `@objectql/protocol-json-rpc` | 95%+ | ✅ Excellent |
| `packages/protocols/sync` | `@objectql/protocol-sync` | — | 🆕 Q3 |

### Tools Layer
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"check-versions": "node scripts/check-versions.js",
"analyze-deps": "node scripts/analyze-dependencies.js",
"audit-coverage": "node scripts/audit-test-coverage.js",
"bench:core": "tsx scripts/benchmarks/core-perf.ts"
"bench:core": "tsx scripts/benchmarks/core-perf.ts",
"bench:driver": "tsx scripts/benchmarks/driver-perf.ts"
},
"devDependencies": {
"@changesets/cli": "^2.29.8",
Expand Down
Loading