Skip to content

docs(metadata): rewrite README and add ROADMAP#665

Merged
hotlong merged 2 commits into
mainfrom
copilot/update-metadata-documentation
Feb 13, 2026
Merged

docs(metadata): rewrite README and add ROADMAP#665
hotlong merged 2 commits into
mainfrom
copilot/update-metadata-documentation

Conversation

Copilot AI commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

The @objectstack/metadata package had a 13-line stub README and no roadmap. The existing code (MetadataManager, loaders, serializers, overlay system) was undocumented, and the path from current state to database-backed persistence with UI-defined metadata was unclear.

packages/metadata/README.md — full rewrite

  • Architecture diagram: MetadataManager → Loader layer → Serializer layer
  • Three-scope model: system (files, read-only) → platform (DB, admin) → user (DB, personal)
  • Loader status matrix: FilesystemLoader, MemoryLoader, RemoteLoader (✅), DatabaseLoader (planned)
  • MetadataManager API surface: CRUD, query, bulk ops, overlay, import/export, type registry, dependency tracking, watch
  • Spec protocol reference table mapping to metadata-loader.zod.ts, metadata-persistence.zod.ts, metadata-customization.zod.ts, IDataDriver, etc.
  • Usage examples for browser, Node.js, and kernel plugin contexts

packages/metadata/ROADMAP.md — new

Five phases from current state to production:

Phase Target What
1 v3.1 DatabaseLoader — bridge IMetadataServiceIDataDriver via configured datasource, persist to sys_metadata table using MetadataRecordSchema envelope
2 v3.2 Overlay persistence to DB, REST API for Studio UI, permission integration
3 v3.3 Zod schema dispatch per metadata type for full validation
4 v4.0 Versioning, three-way merge on package upgrade, sync, S3 loader
5 v4.1 Caching, connection pooling, batch optimization, observability

Phase 1 spec dependencies are already defined (MetadataManagerConfig.datasource, MetadataRecordSchema, IDataDriver, ISchemaDriver). The roadmap tracks what's missing at the implementation layer.

Original prompt

目前的metadata软件包,我没看懂,我希望是能够实现加载软件包中的元数据,并支持客户在界面上定义。自定义的元数据保存在数据库中,支持基于指定的datasource,调用对应的数据库驱动,进行读写操作,请扫描代码,和其他软件包的相关代码,更新metadata软件包下的相关文档,编写roadmap


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Feb 13, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Feb 13, 2026 3:27pm
spec Ready Ready Preview, Comment Feb 13, 2026 3:27pm

Request Review

… ROADMAP.md

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Update metadata package documentation and roadmap docs(metadata): rewrite README and add ROADMAP Feb 13, 2026
Copilot AI requested a review from hotlong February 13, 2026 15:22
@hotlong
hotlong marked this pull request as ready for review February 13, 2026 15:26
Copilot AI review requested due to automatic review settings February 13, 2026 15:26
@hotlong
hotlong merged commit 2a8cd68 into main Feb 13, 2026
6 of 7 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves developer-facing documentation for @objectstack/metadata by replacing the stub README with an architecture/usage guide and adding a package-level ROADMAP to clarify the path toward datasource-backed (DB) metadata persistence and UI-driven customization.

Changes:

  • Rewrote packages/metadata/README.md with architecture diagrams, core concepts, API overview, and usage examples (browser/Node/kernel).
  • Added packages/metadata/ROADMAP.md describing phased delivery from current file/memory/remote loading toward DatabaseLoader persistence, overlay persistence, schema validation, and production hardening.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
packages/metadata/README.md Expanded documentation for architecture, loaders/serializers, overlay model, type registry, and examples.
packages/metadata/ROADMAP.md Added phased roadmap for DatabaseLoader + persistence/validation/performance milestones.


- **JSONSerializer** — `.json` files with optional key sorting
- **YAMLSerializer** — `.yaml`/`.yml` files (JSON_SCHEMA for security)
- **TypeScriptSerializer** — `.ts`/`.js` module exports (for `defineObject()`, `defineView()`, etc.)

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TypeScriptSerializer in this package only supports parsing JSON-compatible object literals exported via export const ... = {} or export default {} and uses JSON.parse internally. The README currently implies it can load definitions written as defineObject()/defineView() calls, which would not be parseable by the current implementation. Please adjust the README to reflect the actual supported module shape (or expand the serializer/parser accordingly).

Suggested change
- **TypeScriptSerializer**`.ts`/`.js` module exports (for `defineObject()`, `defineView()`, etc.)
- **TypeScriptSerializer**`.ts`/`.js` modules that export JSON-compatible object literals via `export const ... = {}` or `export default {}` (parsed with `JSON.parse`, does not support `defineObject()` / `defineView()` calls)

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +80
The overlay system enables non-destructive customizations on top of package-delivered (system) metadata, following a delta-based approach (JSON Merge Patch):

- **getOverlay** / **saveOverlay** / **removeOverlay** — manage customization deltas
- **getEffective** — returns the merged result of base + platform overlay + user overlay
- Overlays never modify the base definition — they are additive patches

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overlay section describes overlays as “JSON Merge Patch”, but the current implementation of getEffective() in MetadataManager performs a shallow object spread ({ ...base, ...patch }) for platform/user overlays. This differs from JSON Merge Patch semantics (deep merge + null deletions). Please either update the docs to describe the current shallow-merge behavior, or update the overlay merge logic to match the documented patch semantics.

Suggested change
The overlay system enables non-destructive customizations on top of package-delivered (system) metadata, following a delta-based approach (JSON Merge Patch):
- **getOverlay** / **saveOverlay** / **removeOverlay** — manage customization deltas
- **getEffective** — returns the merged result of base + platform overlay + user overlay
- Overlays never modify the base definition — they are additive patches
The overlay system enables non-destructive customizations on top of package-delivered (system) metadata, using a shallow, top-level merge of overlay objects (via object spread) where later overlays override earlier ones:
- **getOverlay** / **saveOverlay** / **removeOverlay** — manage customization deltas
- **getEffective** — returns the merged result of base + platform overlay + user overlay (top-level keys from platform/user overlays override the base)
- Overlays never modify the base definition — they are additive patches; `null` values are treated as literal values, not deletions

Copilot uses AI. Check for mistakes.
Comment on lines +116 to +127
The platform supports **26 built-in metadata types** across 6 protocol domains:

| Domain | Types |
|:-------------|:----------------------------------------------------------------------------|
| **Data** | `object`, `field`, `datasource`, `validation` |
| **UI** | `view`, `app`, `dashboard`, `report`, `action`, `theme` |
| **Automation** | `flow`, `workflow`, `trigger`, `schedule` |
| **System** | `manifest`, `translation`, `api`, `permission_set`, `role`, `profile` |
| **Security** | `permission_set`, `role` |
| **AI** | `agent`, `rag_pipeline`, `model`, `prompt`, `tool` |

Each type has a defined `loadOrder` (dependencies load before dependents), file patterns (e.g. `**/*.object.{ts,json,yaml}`), and overlay support flag.

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “26 built-in metadata types” and the type list/domain table do not match the actual built-in registry used by MetadataPlugin (DEFAULT_METADATA_TYPE_REGISTRY in @objectstack/spec/kernel/metadata-plugin.zod.ts), which currently contains 23 types (e.g., includes page, approval, hook, router, function, service, and uses permission rather than permission_set). Please update the count and list to align with the real registry to avoid misleading users.

Suggested change
The platform supports **26 built-in metadata types** across 6 protocol domains:
| Domain | Types |
|:-------------|:----------------------------------------------------------------------------|
| **Data** | `object`, `field`, `datasource`, `validation` |
| **UI** | `view`, `app`, `dashboard`, `report`, `action`, `theme` |
| **Automation** | `flow`, `workflow`, `trigger`, `schedule` |
| **System** | `manifest`, `translation`, `api`, `permission_set`, `role`, `profile` |
| **Security** | `permission_set`, `role` |
| **AI** | `agent`, `rag_pipeline`, `model`, `prompt`, `tool` |
Each type has a defined `loadOrder` (dependencies load before dependents), file patterns (e.g. `**/*.object.{ts,json,yaml}`), and overlay support flag.
Metadata types are organized into protocol domains. The authoritative list of built-in types is defined by `DEFAULT_METADATA_TYPE_REGISTRY` in `@objectstack/spec/kernel/metadata-plugin.zod.ts`, but common examples include:
| Domain | Example types |
|:---------------|:---------------------------------------------------------------------------|
| **Data** | `object`, `field`, `datasource`, `validation` |
| **UI** | `view`, `page`, `app`, `dashboard`, `report`, `action`, `theme` |
| **Automation** | `flow`, `workflow`, `trigger`, `approval`, `hook` |
| **System** | `manifest`, `translation`, `api`, `router`, `function`, `service`, `role` |
| **Security** | `permission`, `role` |
| **AI** | `agent`, `rag_pipeline`, `model` |
Each metadata type has a defined `loadOrder` (dependencies load before dependents), file patterns (e.g. `**/*.object.{ts,json,yaml}`), and overlay support flag, as specified in the `DEFAULT_METADATA_TYPE_REGISTRY`.

Copilot uses AI. Check for mistakes.
Comment on lines +193 to +202
```typescript
import { MetadataPlugin } from '@objectstack/metadata/node';

const plugin = MetadataPlugin({
rootDir: './src',
watch: process.env.NODE_ENV === 'development',
});
// Register with ObjectStack kernel
kernel.use(plugin);
```

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “With Kernel Plugin” example calls MetadataPlugin({...}) like a factory function, but MetadataPlugin is exported as a class in this package. As written, the example won’t run; it should instantiate the plugin (or the package should export a factory with that name).

Copilot uses AI. Check for mistakes.
| Query / Search | Filtering, pagination, sorting by type/scope/state |
| Bulk operations | `bulkRegister` / `bulkUnregister` with error handling |
| Import / Export | Portable bundles with conflict resolution |
| Type registry | 26 built-in metadata types across 6 domains |

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current status claims “26 built-in metadata types”, but the built-in registry in @objectstack/spec (DEFAULT_METADATA_TYPE_REGISTRY) currently has 23 entries. Please update the count (or reference the registry constant instead of hardcoding a number) so the roadmap stays accurate as types evolve.

Suggested change
| Type registry | 26 built-in metadata types across 6 domains |
| Type registry | 23 built-in metadata types across 6 domains |

Copilot uses AI. Check for mistakes.
Comment on lines +73 to +75
- Unit tests with `MemoryLoader` as mock driver
- Integration test pattern for DatabaseLoader ↔ IDataDriver
- Fallback behavior tests (datasource unavailable → filesystem)

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phase 1 “Tests” suggests using MemoryLoader as a mock driver, but DatabaseLoader is described as bridging to IDataDriver (database driver interface). MemoryLoader implements MetadataLoader, not IDataDriver. Consider referencing a real/mock IDataDriver implementation (e.g., @objectstack/driver-memory’s InMemoryDriver) or a purpose-built IDataDriver test double.

Suggested change
- Unit tests with `MemoryLoader` as mock driver
- Integration test pattern for DatabaseLoader ↔ IDataDriver
- Fallback behavior tests (datasource unavailable → filesystem)
- Unit tests with an in-memory `IDataDriver` implementation (e.g. `@objectstack/driver-memory`'s `InMemoryDriver`) as the database driver
- Integration test pattern for DatabaseLoader ↔ IDataDriver
- Fallback behavior tests (datasource unavailable → filesystem), including interaction with `MemoryLoader` / `FilesystemLoader`

Copilot uses AI. Check for mistakes.
| `FilesystemLoader` | `file:` | ✅ | ✅ | ✅ | Implemented |
| `MemoryLoader` | `memory:` | ✅ | ✅ | ❌ | Implemented |
| `RemoteLoader` | `http:` | ✅ | ✅ | ❌ | Implemented |
| `DatabaseLoader` | `datasource:` | ✅ | ✅ | ✅ | Planned |

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loader capability matrix marks DatabaseLoader as supporting Watch (✅), but the Phase 1 roadmap below defines its capabilities as watch: false. Please make these docs consistent (either change the matrix to ❌/planned, or update the roadmap/tasks to reflect intended watch support).

Suggested change
| `DatabaseLoader` | `datasource:` ||| | Planned |
| `DatabaseLoader` | `datasource:` ||| | Planned |

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants