Picolab / pico-engine

An implementation of the pico-engine hosted on node.js
http://picolabs.io/
MIT License
43 stars 8 forks source link

Need better isolation between rulesets when performing wrangler operations #612

Open b1conrad opened 2 years ago

b1conrad commented 2 years ago

Wrangler operations are initiated with events specified in a ruleset. When the operation completes, Wrangler usually raises an event reporting completion. The ruleset often has rules that select on these completion events.

Other rulesets also get a chance to select rules on the completion event. This can easily break isolation between rulesets in the same pico.

A common idiom used in this regard is

  select when wrangler ruleset_installed where rids >< meta:rid

In this case, the operation was initiated in a different ruleset, but its completion is of interest only to the ruleset that has just been installed.

The usage of a correlation identifier is documented in "Managing Pico Lifecycle" in the sections "Creating a Pico" and "Deleting a Pico".

b1conrad commented 2 years ago

For this to work, every rule in Wrangler needs to pass through all of the event attributes that it receives, as it cannot know about correlation identifiers that might be included in them.

In particular, the child_initiates_deletion rule needs to forward any incoming attributes, along with the one it constructs for its purpose.

b1conrad commented 2 years ago

There are some cases where an event is sent rather than raised. In particular, where we are crossing over from the child's perspective to the parent's and vice versa.

For example, byu.hr.oit sends an event to a child pico (so that it won't happen until well after the previous event that it sent to that same pico has finished) which results in an event sent to the parent, which results in an event raised to the parent. A correlation identifier has to survive all of these hops to be effective.

b1conrad commented 2 years ago

Note: just changed the three "event" links in the previous comment to permalinks.

b1conrad commented 2 years ago

This issue impacts another repo.

b1conrad commented 2 years ago

So far, a very small change has satisfied one of that kind of path, in this commit of KRL-experiments.