Skip to content

docs(adr): ADR-0076 — relocate metadata protocol out of objectql (lean engine, enforced boundary, deferred repo-split) - #2414

Merged
os-zhuang merged 2 commits into
mainfrom
adr/0076-objectql-core-tiering
Jun 28, 2026
Merged

os-zhuang merged 2 commits into
mainfrom
adr/0076-objectql-core-tiering

Conversation

@os-zhuang

@os-zhuang os-zhuang commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

What

ADR-0076 — v12 layering for objectql, driven by measured coupling.

Centerpiece (rev.4): protocol.ts is metadata-domain code mis-located in the data-engine package. It implements ObjectStackProtocol (contract in @objectstack/spec), manages sys_metadata / draft-publish / locks / package ownership — and uses the engine only as storage, via a 5-method SysMetadataEngine interface injected at runtime.

Decision

Now

  • D1 Relocate protocol + sys-metadata-repository + metadata-diagnostics into a new @objectstack/metadata-protocol (between metadata-core and the metadata plugin). objectql becomes a lean data engine by construction — 268KB leaves the package; the gateway depends on objectql with no protocol. objectql re-exports for back-compat.
  • D2 Boundary ratchet: objectql must not import metadata-protocol/plugin/kernel.
  • D3 Capability/profile contract (derive required caps from object schema; default fail-closed; trusted via two-key, prod env-gated).
  • D4 Formula stays in core (validation / L1 hooks / seed loader use it).

Later (separate, trigger-gated)

  • D7 Extracting the engine itself into a standalone repo is gated on its cross-package commit ratio (currently 88%) falling. Independent of D1.

Evidence (in the ADR)

protocol.ts commits last month:          47
  also touched engine.ts:                 3  (6%)   → protocol ≈ decoupled from engine
  also touched metadata-core/metadata/spec: 20 (43%) → its real neighbors
move blast radius:                        2 source files (plugin.ts, index.ts)
engine surface needed:                    SysMetadataEngine (5 methods, injected)
(contrast) engine/registry commits:       50, 88% cross-package → engine NOT separable yet
  • knex is a SQL query builder objectql already uses, not an ORM to switch to.
  • Splitting protocol into its own package removes its deps from the engine package.

Scope

Docs only — docs/adr/0076-objectql-core-tiering.md. No code changes; implementation (P1–P4) tracked as follow-up.

🤖 Generated with Claude Code

…dary + trigger-gated repo split)

Data-driven v12 assessment of how to let a thin host (objectbase gateway)
embed only the objectql engine without the whole platform.

Decision (sequenced, based on measured engine↔platform coupling):
- Now (additive, non-breaking): a `@objectstack/objectql/core` subpath lean
  entry; an engine↔platform boundary ratchet (core must not import
  protocol/plugin/kernel); a capability/profile contract (derive required
  caps from object schema, default fail-closed, `trusted` via two-key).
- Later (trigger-gated): extract a standalone repo on the objectui model
  once the cross-package commit ratio (currently 88%) falls.

Rationale recorded in-ADR: knex is a query builder objectql already uses;
splitting protocol saves ≈0 deps; 88% of last month's engine/registry
commits were cross-package, so the engine API is not freezable/separable yet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 28, 2026 5:48am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation size/m labels Jun 28, 2026
…a-protocol (it's metadata-domain, mis-located in objectql)

Corrects the centerpiece. protocol.ts implements ObjectStackProtocol (contract
in spec), manages sys_metadata/locks/commits/ownership — metadata-domain work
that only uses the engine as storage via a 5-method SysMetadataEngine interface.

Measured: protocol.ts co-changes with engine.ts only 6% of the time vs 43% with
metadata-core/metadata/spec; move blast radius = 2 source files (plugin.ts,
index.ts). So the right "now" move is relocating protocol into a new
@objectstack/metadata-protocol package — not the rev.3 ./core subpath.

objectql becomes a lean data engine by construction (268KB leaves the package);
gateway depends on it with no protocol. Boundary ratchet keeps it pure.
Engine repo-split stays a separate, trigger-gated (88% cross-package) future phase.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@os-zhuang os-zhuang changed the title docs(adr): ADR-0076 — objectql layering (lean subpath + enforced boundary + trigger-gated repo split) docs(adr): ADR-0076 — relocate metadata protocol out of objectql (lean engine, enforced boundary, deferred repo-split) Jun 28, 2026
@os-zhuang
os-zhuang merged commit d9fe95f into main Jun 28, 2026
15 checks passed
@os-zhuang
os-zhuang deleted the adr/0076-objectql-core-tiering branch June 28, 2026 05:52

This branch was successfully deployed

1 active deployment
Preview — 0979e30b Deployed Jun 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant