Skip to content

Prepare node edits for growing columnar trees - #115

Merged
VEZY merged 3 commits into
masterfrom
codex/prepared-node-edits
Nov 20, 2026
Merged

VEZY merged 3 commits into
masterfrom
codex/prepared-node-edits

Conversation

@VEZY

@VEZY VEZY commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

This PR builds on #114. It lets a growing simulation prepare edits against the column types of its existing tree. The plan borrows that tree's attribute store. Node count, organ names and attribute values can change as the simulation runs.

plan = prepare_node_edits(plant)
leaf = addchild!(plan, internode, id, NodeMTG(:+, :Leaf, index, 4))
delete_node!(plan, leaf)

The optional named tuple on insertion contains MTG attributes. XPalm can keep its initial ages, thermal time and other simulation variables in PSE's initial_status. The public prepared attribute overload reads optional tree attributes. Removing a newborn uses the ordinary deletion rules, including promotion and relinking of children. Column types for an insertion are checked before the node becomes visible. The ordinary and prepared methods share their storage and topology operations.

Use attribute_type(plant, :kind) to read the union of the declared column types across organ symbols. This includes declarations for organs that have yet to grow. For example, if a flower inherits a kind value of a new type, declare the flower column before preparing the simulation. Readback on trees with several column types also preserves explicitly stored nothing values.

The complete local MTG suite passed 6,851 assertions on Julia 1.13.3. Coverage includes attribute-free insertion, absent attributes and explicitly stored nothing, foreign trees, duplicate IDs, incompatible column types and deletion with an existing child, numeric conversion and preparation after declaring a new column.

A separate application built with JuliaC 0.3.12 in safe mode on Julia 1.13.3 used revision bcc58a863 and a real XPalm tree. The executable ran twice. Each time it inserted a leaf and a reproductive organ with empty MTG attributes, attached a child, read an absent attribute and checked child promotion, links and node IDs after removal. This covers the graph operations used during growth. Full plant simulation is tracked in PSE #247.

At b3b39f5d3, the local documentation built and the PSE integration passed 121 assertions. A stock JuliaC safe executable exercised mixed column types and organ creation twice. All 107 tracked files of this revision matched the sources used in that qualification.

Base automatically changed from codex/lazy-empty-attributes to master November 20, 2026 15:09
@VEZY
VEZY merged commit ad54225 into master Nov 20, 2026
7 checks passed
@VEZY
VEZY deleted the codex/prepared-node-edits branch November 20, 2026 15:09
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.

1 participant