Qualify optimistic tree reparenting with authoritative cycle rejection

This commit is contained in:
Timothy J. Aveni
2026-09-20 22:25:11 -07:00
parent c0669d2ed8
commit d80464d285
5 changed files with 71 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
interface TreeData id "tree:data" revision "tree:data@1" {
operation reparent id "tree:reparent" : optional<interface-ref<TreeData>> -> unit {
call id "tree:reparent:call" execution transaction targets [browser, server];
}
queryable relation parent id "tree:parent" : optional-one interface TreeData {
resolve id "tree:parent:resolve" execution snapshot targets [browser, server];
}
queryable relation children id "tree:children" : many interface TreeData {
resolve id "tree:children:resolve" execution snapshot targets [browser, server];
}
}
+13
View File
@@ -0,0 +1,13 @@
external atom Node id "tree:node";
import interface TreeData;
package TreeRuntime id "tree:runtime" revision "tree:runtime@1" {
operation reparent id "tree:runtime:reparent" : optional<interface-ref<TreeData>> -> unit
mode call execution transaction targets [browser, server] receiver atom Node requires {
edge parent id "tree:move:parent" : optional-one interface TreeData [resolve, connect, disconnect];
} accept using check;
operation check id "tree:runtime:check" : optional<interface-ref<TreeData>> -> unit
mode call execution snapshot targets [server] receiver atom Node requires {
edge current id "tree:check:current" : optional-one interface TreeData [resolve];
interface ancestors id "tree:check:ancestors" : TreeData using [parent.resolve] from input;
};
}
+19
View File
@@ -0,0 +1,19 @@
workspace Tree id "workspace:tree" revision "workspace:tree@1" commit "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" {
import interface TreeData;
import package TreeRuntime;
atom Node id "tree:node";
conform Node as TreeData id "tree:node:data" {
private edge Parent id "tree:parent-edge" {
atom Node projection parent id "tree:parent-projection" optional-one;
interface TreeData projection children id "tree:children-projection" many;
}
bind parent.resolve to edge Parent.parent.resolve;
bind children.resolve to edge Parent.children.resolve;
bind reparent.call to package TreeRuntime.reparent with {
parent to edge Parent.parent;
} accept with {
current to edge Parent.parent;
ancestors to interface TreeData from input;
};
}
}