Add spec-level base attributes and give every node a plugins list - #135
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements #124, the first v2 design issue: a spec-level base-attribute mechanism, used to give every node a
pluginslist.Meta-model (version-agnostic, additive):
Specgains an optionalbase: BaseSpecblock declared via the newdefineBase(...)helper. Base attributes are appended by codegen targets after each node's declared attributes, so they always serialise last.validategains three rules: duplicate base attributes, unresolved base-attribute references, and node attributes colliding with a base attribute (thecheckReflocation label was generalised to support non-node call sites).Spec content: the base declares one attribute —
plugins, an optional array ofpluginNode.instructionNode's localpluginsattribute 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
upgradeV1ToV2in codama): copyinstructionNode.pluginsthrough unchanged; no other v1 node carries plugins, so no other transformation is needed.Closes #124. Part of #102.