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
The following upstream enhancements were identified as prerequisites for this refactoring. All have been implemented in the upstream `@objectstack/spec` repository:
429
+
430
+
| # | Change | Upstream Package | Type | Status |
431
+
|---|--------|-----------------|------|--------|
432
+
| 5.1.1 | Query Profiling Hook Extension Point |`@objectstack/objectql`| Feature | ✅ **Met** — Middleware API exists; `OperationContext` and `EngineMiddleware` types exported |
433
+
| 5.1.2 | Optimization Integration Hooks |`@objectstack/core`| Feature | ✅ **Met** — `replaceService<T>()` added to `PluginContext` interface and implemented |
430
434
431
435
> **Removed from scope:**
432
436
> -~~Gateway / Protocol Router Extension Point~~ — The upstream server (`@objectstack/plugin-hono-server`) already provides the API layer; no gateway plugin is needed.
433
437
> -~~AI Service Registry Interface~~ — AI model/prompt management is handled by a separate dedicated project.
434
438
435
439
### 5.1.1 Query Profiling Hook Extension Point
436
440
437
-
**Problem:** The local `QueryService` wraps driver CRUD calls with profiling (execution time, rows scanned, index usage). The upstream engine has no extension point for injecting profiling around driver calls.
**Problem:** The local `QueryService` wraps driver CRUD calls with profiling (execution time, rows scanned, index usage). The upstream engine had no extension point for injecting profiling around driver calls.
440
442
441
-
```typescript
442
-
// Add profiling hooks in the engine lifecycle
443
-
exportinterfaceQueryProfiler {
444
-
beforeExecute(context: {
445
-
object:string;
446
-
operation:string;
447
-
ast?:QueryAST;
448
-
}):void;
449
-
afterExecute(context: {
450
-
object:string;
451
-
operation:string;
452
-
ast?:QueryAST;
453
-
result?:unknown;
454
-
executionTimeMs:number;
455
-
error?:Error;
456
-
}):void;
457
-
}
443
+
**Resolution: ✅ Use existing middleware — no dedicated `QueryProfiler` interface needed.**
458
444
459
-
// In ObjectQL class:
460
-
privateprofiler?:QueryProfiler;
461
-
462
-
registerProfiler(profiler: QueryProfiler) {
463
-
this.profiler=profiler;
464
-
}
465
-
```
466
-
467
-
**Alternative:** Achieve via middleware (already exists). The middleware chain is sufficient if the local `QueryPlugin` registers a profiling middleware:
445
+
The upstream `ObjectQL` engine already provides `registerMiddleware(fn, options)` with onion-model execution, and exports both `OperationContext` and `EngineMiddleware` types for plugin authors. The local `QueryPlugin` can register a profiling middleware directly:
-`packages/objectql/src/index.ts` — `export type { OperationContext, EngineMiddleware } from './engine.js'`
460
+
- Merged via [PR #597](https://github.com/objectstack-ai/spec/pull/597) (2026-02-11)
480
461
481
462
### 5.1.2 Optimization Integration Hooks
482
463
483
-
**Problem:** The local `OptimizationsPlugin` wants to replace/enhance kernel internals (metadata registry, hook manager, connection pooling). The upstream kernel doesn't expose these as replaceable services.
464
+
**Problem:** The local `OptimizationsPlugin` wants to replace/enhance kernel internals (metadata registry, hook manager, connection pooling). The upstream kernel didn't expose these as replaceable services.
ctx.replaceService('metadata', optimizedMetadata); //first-class API
501
487
```
502
488
503
-
**Recommendation:** The decorator approach works today. An upstream `replaceService` API would be cleaner but is not blocking.
489
+
**Upstream evidence:**
490
+
- Merged via commit [`b6b411e`](https://github.com/objectstack-ai/spec/commit/b6b411e8db38065ce1e0f95ba9b5b3ce26ab8bad) — "feat(core): add replaceService to PluginContext for optimization integration hooks"
491
+
- Validation fix via commit [`a5a5742`](https://github.com/objectstack-ai/spec/commit/a5a5742289d7cf3d0cadb59bcedc2507a0401e63) — "fix: add validation to PluginLoader.replaceService for consistency"
Additionally, the upstream has added **16+ formal service contract interfaces** in `@objectstack/spec/contracts` (PRs [#599](https://github.com/objectstack-ai/spec/pull/599), [#600](https://github.com/objectstack-ai/spec/pull/600)), including `IMetadataService`, `IAuthService`, `IAnalyticsService`, `IAIService`, `IRealtimeService`, and more. These contracts further strengthen the plugin boundary for the local refactoring.
511
503
512
504
> **Removed from scope:**
513
505
> -~~Add `gateway` to `CoreServiceName` enum~~ — Gateway plugin is not needed (upstream server handles API).
@@ -666,7 +658,7 @@ export { QueryService } from '@objectql/plugin-query';
666
658
667
659
### Phase 3: Core Slimming (Week 3)
668
660
669
-
-[ ]Submit upstream PRs (§5.2)
661
+
-[x]~~Submit upstream PRs (§5.2)~~ — All upstream prerequisites already merged (see §5)
670
662
-[ ] Remove `app.ts` (local ObjectQL class)
671
663
-[ ] Remove `protocol.ts` (duplicated)
672
664
-[ ] Remove `repository.ts` (duplicated)
@@ -679,8 +671,8 @@ export { QueryService } from '@objectql/plugin-query';
679
671
680
672
### Phase 4: Upstream Integration (Week 4+)
681
673
682
-
-[ ]Merge upstream PRs
683
-
-[ ] Update `@objectstack/*` dependency versions
674
+
-[x]~~Merge upstream PRs~~ — All prerequisites merged as of 2026-02-11
675
+
-[ ] Update `@objectstack/*` dependency versions to include `replaceService` and type exports
684
676
-[ ] Remove local workarounds once upstream changes are released
685
677
-[ ] Tag v5.0 release
686
678
@@ -692,7 +684,7 @@ export { QueryService } from '@objectql/plugin-query';
692
684
693
685
| Risk | Probability | Impact | Mitigation |
694
686
|------|-------------|--------|------------|
695
-
|**Upstream rejects PRs**| Medium | High |All changes have local workarounds (decorators, service registration)|
687
+
|~~**Upstream rejects PRs**~~|~~Medium~~|~~High~~|✅ **Eliminated** — All upstream PRs merged as of 2026-02-11|
696
688
|**API breaking changes**| Medium | High | Phase approach with deprecated re-exports; v5.0 major release for removals |
697
689
|**Hook behavior difference**| Low | Medium | Comprehensive hook integration tests; compare local vs upstream execution order |
698
690
|**Performance regression**| Low | Medium | Benchmark before/after; `OptimizationsPlugin` preserves all existing optimizations |
0 commit comments