pico-engine icon indicating copy to clipboard operation
pico-engine copied to clipboard

The picoQuery via DID seems to check for `provides` instead of `shares`

Open b1conrad opened this issue 9 months ago • 0 comments

The provides directive identifies functions in a ruleset that can be used by other rulesets using this one as a module.

The shares directive identifies functions that can be invoked from the world outside the pico, through any of these ways:

  • through HTTP using a /sky/cloud URL, for example http://DOMAIN/sky/cloud/ECI/RID/FUNCTION
  • through the Testing tab
  • through the wrangler:picoQuery function using ctx:query for another pico hosted by the same pico engine
  • through the wrangler:picoQuery function using either an ECI or a DID

The latter, in the case of a DID passed in in lieu of an ECI ultimately uses an ECI from the DIDDoc service endpoints which include the ECI which is actually used to invoke the function. In all cases, the ECI must have a query policy that allows the function to be invoked for the ruleset that defines it.

As written, the dido library allows for a provided function to be invoked, but not a shared one. This seems wrong to me.

For example, in this commit the wrangler:picoQuery function fails with a "null is not a function" error message, when the ruleset shares the function.

OTOH, in this commit, it succeeds, when the ruleset provides the function.

Tagged as a question to get opinions from @windley and @joshmann35 .

b1conrad avatar Sep 09 '23 16:09 b1conrad