add position field to nodes for stable section ordering

Sections within a file have a natural order that matters —
identity.md reads as a narrative, not an alphabetical index.

The position field (u32) tracks section index within the file.
Set during init and import from parse order. Export and
load-context sort by position instead of key, preserving the
author's intended structure.
This commit is contained in:
ProofOfConcept 2026-02-28 23:06:27 -05:00
parent 57cf61de44
commit 7b811125ca
3 changed files with 22 additions and 14 deletions

View file

@ -227,6 +227,7 @@ pub fn migrate() -> Result<(), String> {
state_tag,
last_replayed: 0.0,
spaced_repetition_interval: 1,
position: 0,
community_id: None,
clustering_coefficient: None,
schema_fit: None,
@ -266,6 +267,7 @@ pub fn migrate() -> Result<(), String> {
state_tag: unit.state.clone().unwrap_or_default(),
last_replayed: 0.0,
spaced_repetition_interval: 1,
position: 0,
community_id: None,
clustering_coefficient: None,
schema_fit: None,