Skip to content

Add spec-level base attributes and give every node a plugins list - #135

Merged
lorisleiva merged 2 commits into
mainfrom
base-attributes-plugins
Aug 31, 2026
Merged

Add spec-level base attributes and give every node a plugins list#135
lorisleiva merged 2 commits into
mainfrom
base-attributes-plugins

Conversation

@lorisleiva

@lorisleiva lorisleiva commented Aug 31, 2026

Copy link
Copy Markdown
Member

This PR implements #124, the first v2 design issue: a spec-level base-attribute mechanism, used to give every node a plugins list.

Meta-model (version-agnostic, additive): Spec gains an optional base: BaseSpec block declared via the new defineBase(...) helper. Base attributes are appended by codegen targets after each node's declared attributes, so they always serialise last. validate gains three rules: duplicate base attributes, unresolved base-attribute references, and node attributes colliding with a base attribute (the checkRef location label was generalised to support non-node call sites).

Spec content: the base declares one attribute — plugins, an optional array of pluginNode. instructionNode's local plugins attribute is removed as redundant; pluginNode's docs note the universal availability.

Docs: every node page renders the base attributes as the trailing rows of its Data/Children tables (mirroring the serialise-last wire order), and the root landing page gains a "Base attributes" section documenting the mechanism. The README documents the serialise-last convention alongside the existing array/order conventions.

Upgrade lens note (for upgradeV1ToV2 in codama): copy instructionNode.plugins through unchanged; no other v1 node carries plugins, so no other transformation is needed.

Closes #124. Part of #102.

The meta-model's Spec type gains an optional base block, declared via the new defineBase helper, describing attributes shared by every node; codegen targets append them after each node's declared attributes, so they always serialise last. The spec declares one base attribute — plugins, an optional array of pluginNode — making every node extensible with namespaced, consumer-defined data. instructionNode no longer declares plugins locally, validate rejects base attributes that collide with declared attributes or carry unresolved references, and the generated docs render the base on every node page and the root landing page.
@lorisleiva
lorisleiva marked this pull request as draft August 31, 2026 17:00
Instead of a dedicated Base table, each base attribute runs through the same data/children classification as declared attributes and trails its table, mirroring the serialise-last wire order. The plugins docs drop the 'available on every node' phrasing since base-ness is the mechanism's premise, not per-attribute documentation.
@lorisleiva
lorisleiva marked this pull request as ready for review August 31, 2026 21:26
@lorisleiva
lorisleiva merged commit f9cfe95 into main Aug 31, 2026
3 checks passed
@lorisleiva
lorisleiva deleted the base-attributes-plugins branch August 31, 2026 21:27
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.

[v2] Add spec-level base attributes and give every node a plugins list

1 participant