You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Aggregate children's embedding content with the database's behaviour registry #3627
The text, header and schema behaviours build their embedding content from their children in get_aggregated_content. To decide what each child contributes, each one builds a fresh NodeBehaviorRegistry::new() (packages/core/src/behaviors/mod.rs, in TextNodeBehavior, HeaderNodeBehavior and SchemaNodeBehavior).
That registry holds core's behaviours only. When a build registers behaviours for extends subtypes of core types (DaemonExtensions::behavior, through NodeService::new_with_extensions, ADR-082 §2.1), the node service's own registry has them, but this aggregation does not.
A subtype's behaviour decides the embedding of its own node.
When such a node is the child of a text, header or schema node, the parent asks the core-only registry for the child's contribution, so the subtype's rule is ignored there.
Core alone is unaffected: with no extension the two registries are the same.
Proposed fix
Hand the aggregation the registry the node service validates with, instead of building one. For example, pass the node service's Arc<NodeBehaviorRegistry> through get_aggregated_content, or through the NodeAccessor the aggregation already receives.
Documentation
ADR-082 §2.1: a subtype's behaviour decides its embedding rules. This issue implements that for aggregated parents; no new decision.
get_aggregated_content resolves each child's contribution with the database's behaviour registry, extension behaviours included.
A core test registers a subtype behaviour through DataExtensions whose embedding rule differs from its base's. A text parent of a node of that subtype aggregates the child as the subtype's behaviour says.
With no extension, aggregation output is unchanged.
References
ADR-082 §2.1 (a subtype's behaviour decides validation, defaults, children, embedding and markdown rules).
Activity
Aggregate children's embedding content with the database's behaviour …
Aggregate children's embedding content with the database's behaviour …