The behavior of the with entry and with exitabilities in walkers is inconsistent between jac-cloud when running with jac serve and core JacLang using jac run. Specifically, in core JacLang, the with exit ability is executed only once at the end of the walker's walk, while in jac-cloud (when using jac serve), the with exit abilitytriggers on every node exit.
To Reproduce
Install jac-cloud
Run the following example in both JacLang (jac run) and jac-cloud (jac serve):
node test_node {
has value: int = 0;
}
walker create_node {
has value: int;
obj __specs__ {
static has auth: bool = False;
}
can create_node with `root entry {
root ++> (node_obj:=test_node(value=self.value));
print(jid(node_obj));
report node_obj;
}
}
walker fetch_node {
has node_id: str;
obj __specs__ {
static has auth: bool = False;
}
can fetch_node with `root entry {
# grab the node with the given id
node_obj = &self.node_id;
report node_obj;
}
}
walker test_walker {
has visited_nodes: list = [];
obj __specs__ {
static has auth: bool = False;
}
can traverse with `root entry {
visit [-->];
}
can log_visit with object exit {
self.visited_nodes.append(here);
}
can print_visited_nodes with exit {
print(self.visited_nodes);
}
}
In both JacLang and Jac Cloud, the with exit ability should execute only once, at the end of the entire walker execution, not after each node exit. This ensures consistent behavior, where the final state of the walker (e.g., visited_nodes) is processed and output at the end of the walker's walk.
Describe the bug
The behavior of the
with entry
andwith exit
abilities in walkers is inconsistent betweenjac-cloud
when running withjac serve
and core JacLang usingjac run
. Specifically, in core JacLang, thewith exit
ability is executed only once at the end of the walker's walk, while injac-cloud
(when usingjac serve
), thewith exit ability
triggers on every node exit.To Reproduce
jac run
) and jac-cloud (jac serve
):In both JacLang and Jac Cloud, the
with exit
ability should execute only once, at the end of the entire walker execution, not after each node exit. This ensures consistent behavior, where the final state of the walker (e.g.,visited_nodes
) is processed and output at the end of the walker's walk.