Repository navigation
Closed
Labels
Description
Overview
Build the foundation of ADR-086: a CoreNodeType registry, a shared NodeEnvelope, closed core schemas, abstract types, and rules that follow the extends chain instead of comparing node_type with a literal. Every other node-type issue builds on this one.
Problem Statement
- No single list of types. The seeded schemas (
packages/core/src/models/core_schemas.rs), the behaviour registry (packages/core/src/behaviors/mod.rs), the frontend plugins (packages/desktop-app/src/lib/plugins/core-plugins.ts) and the docs each list a different set.playandcheckboxhave no behaviour;toolhas no schema. - Schemas don't constrain. Validation checks only declared fields, so any other key is stored, and nested
item_fieldsare never checked. - Subtypes escape their base type's rules. Behaviour lookup, embedding, the title rule, the
collection/schemaroot triggers (packages/core/src/db/schema.rs), partial indexes, the@picker and the wire conversion (node_to_typed_valueinpackages/nodespace-types/src/convert.rs) comparenode_typewith a literal.issue extends taskis validated and embedded as an unknown custom type, and apro-collectionescapes the root-only rule. - The envelope differs per layer. The TS
Nodehas nolifecycleStatus; typed wire structs dropmentions, and some droptitle. - No abstract types.
ai-chatandtoolmust become abstract bases (ADR-088, ADR-086 §12), and nothing can express "never created directly". - Field types.
SchemaField.typeaccepts bothstringandtext.
Proposed Solution
NodeEnvelopeinnodespace-types(ADR-086 §2):id,node_type,content,title,version,created_at,modified_at,lifecycle_status(always serialized),properties,mentions,mentioned_in. The genericNodeand every typed struct embed it; TypeScript'sNodeEnvelopeis the base interface.CoreNodeTyperegistry (ADR-086 §3): one variant per core type, core subtype and abstract base. Each records its category, its parent, whether it is abstract, its content role, structural rules (the slot is filled by the ADR-089 issue), participation rules (the slot is filled by the participation issue), title rules, and its typed struct. Add the registry tests listed in §3.- Chain-aware rules (ADR-086 §5). Rules resolve through the registry or the
extendschain, and a subtype behaviour composes with its base's (it adds, never replaces). Remove every literalnode_typecomparison that applies a type's rule. - Type-ancestry table maintained from schema
extendsedges in the same transaction as the schema write, so SQL triggers and indexes can apply base-type rules to subtypes. - Abstract types (ADR-086 §6): a schema flag; create and retype into an abstract type are refused in the service; queries for an abstract type return its subtypes.
- Closed core schemas (ADR-086 §7). A key in a core type's bucket must be declared, be a namespaced extension field (
custom:/org:/plugin:), or start with_.fields/item_fieldsare validated recursively. Every core behaviour has a schema and vice versa (givetoola schema andplay/checkboxbehaviours). - Typed-client rejection. The generic
update_nodefrom typed clients (Tauri app-lib, dev-proxy) rejects a patch naming a core type's declared field; the CLI's and agent's flat update keeps working through the same validated pipeline. - One field-type vocabulary (ADR-086 §7a):
SchemaField.typeis a closed enum;text, notstring.
No migration: change the shape and reset the database.
Architecture Impact
Implements decisions/086-core-node-types-defined-once-typed-by-category.md §2, §3, §5, §6, §7 and §7a (nodespace-docs). It touches ADR-078 (extends buckets), ADR-082 §2.1 (a behaviour for a core type is rejected; extension subtypes stay open) and ADR-089 (structural rules use the ancestry table). Docs are already committed; keep components/node-types.md in step.
Acceptance Criteria
-
NodeEnvelopeexists innodespace-types;Nodeand every typed node struct embed it;lifecycle_statusis always serialized -
CoreNodeTypecovers every core type, core subtype and abstract base, and its registry tests pass: seeded schemas == registry (exceptschema); behaviour ⇔ schema; primitive ⇔ no fields; exhaustive matching innode_to_typed_value, promoted fields and typed-update dispatch; frontend plugins ⊆ registry - Rule resolution follows the
extendschain: a user subtype oftaskis validated and embedded as a task; a subtype ofcollectionis root-only (tests) - No literal
node_typecomparison applies a type's rule in Rust, SQL or TypeScript (a grep-style test or lint enforces it) - The type-ancestry table is maintained transactionally with schema writes (test: add and remove
extends) - Creating or retyping into an abstract type is refused on every surface (test)
- An undeclared key in a core bucket is rejected; a
custom:key and a_key are accepted; nesteditem_fieldsare validated (tests) - A typed client's generic update naming a core field is rejected; the CLI's
node update --propertyon the same field succeeds through the pipeline (tests) -
SchemaField.typeis a closed enum;stringis rejected - Follows
development/node-type-sequence.md; thenode-types.mdsheets updated in the same PR -
bun run test:changedpasses;bun run quality:fixclean - The create path rejects a provided id that isn't a UUID, except the three named forms:
date(YYYY-MM-DD),schema(the type name) anddatabase-settings-singleton(ADR-086 §10); test per form plus a rejected slug
Technical Specifications
Reference Files
packages/nodespace-types/src/lib.rs,node.rs,convert.rs,schema.rspackages/core/src/models/core_schemas.rs,packages/core/src/models/mod.rspackages/core/src/behaviors/mod.rs(NodeBehaviorRegistry)packages/core/src/db/schema.rs(DDL, the root triggers, partial indexes)packages/core/src/services/node_service/crud.rs(rebucket_and_validate, create/update validation)packages/core/src/db/sqlite_store/search.rs(literal type list)packages/desktop-app/app-lib/src/commands/nodes.rs,packages/dev-tools/src/dev-proxy.ts(typed clients)packages/desktop-app/src/lib/types/node.ts,packages/desktop-app/src/lib/plugins/core-plugins.ts
Dependencies
- None. This is the first of the ADR-086 issues.
Related Issues
- Delete unused node models, plugins and compatibility shims #3430 (dead wrappers and
default_metadata, removed separately)
Non-Goals
- Generating TypeScript (separate issue)
- Structural rules and participation rules themselves (separate issues; this one provides the registry slots and the ancestry table)
Activity
malibio commentedon Oct 1, 2026
Baseline — Frontend: 298 test files passed, 5510 tests passed
Address review: declare the capture keys, fix core schemas' place in …
Address re-review: decide type-system refusals before update_schema c…
Add the core node type registry, shared envelope, closed schemas and …
Add the core node type registry, shared envelope, closed schemas and …
Add the core node type registry, shared envelope, closed schemas and …