pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
markaddleman 2021-01-29T00:37:16.088400Z

I pathom3 error handling is still undergoing active thought so I'll just through this out there: Using ::psm/error-mode-loud and guardrails enabled, if the smart map cannot compute the requested key, guardrails throws an unhelpful error. When guardrails is disabled, the smart map returns nil. I'd like to see a useful error message under the loud case regardless of whether guardrails is enabled or not.

markaddleman 2021-01-29T23:57:54.103800Z

Well, I'm not longer sure this is a me problem 🙂

markaddleman 2021-01-29T23:59:10.104Z

When guardrails is enabled, accessing :a/output from m results in an unhelpful guardrails exception.

markaddleman 2021-01-30T00:01:10.104400Z

when a->b's input is available, the result is what you'd expect

markaddleman 2021-01-30T00:08:58.104800Z

when guardrails is disabled and a->b's input is not available, the result is nil . I'm agnostic as to whether this is desired behavior or not.

wilkerlucio 2021-01-30T13:40:21.105100Z

just checked on it, that guardrails messages are not wanted, something is wrong inside, checking now

wilkerlucio 2021-01-30T14:21:05.105300Z

@markaddleman should be fixed on master, by this commit: https://github.com/wilkerlucio/pathom3/commit/a6d9c3430f36a3b48a0952bd812fbfb3eb4dc37a

wilkerlucio 2021-01-30T14:26:31.105500Z

now there is a third type of error ::node-error-type-unreachable, which covers the case where Pathom can't find a path for some attribute

markaddleman 2021-01-30T16:22:06.105700Z

Thanks!

wilkerlucio 2021-01-29T00:38:30.088500Z

in loud mode it should throw an exception in case something goes wrong, independent of guardrails

wilkerlucio 2021-01-29T00:38:53.088700Z

if you are seeing something different, is probably a bug, can you send a reproduction case?

wilkerlucio 2021-01-29T00:39:26.088900Z

for EQL mode there is a new plugin that I'm about to document, that exposes the errors on the data

wilkerlucio 2021-01-29T01:07:47.089700Z

New page for Pathom 3 docs: built-in plugins 🎉 ! https://pathom3.wsscode.com/docs/built-in-plugins

👍 2
nivekuil 2021-01-29T08:36:00.093800Z

it seems like attribute-errors-plugin causes a massive slowdown, from ￱￱55ms to ￱￱200ms on my api call

wilkerlucio 2021-01-29T13:52:34.100700Z

gonna check on that, how big are your queries?

wilkerlucio 2021-01-29T14:00:41.101500Z

@kevin842 can you try again on master please? I made a change that will remove the checks when no errors happen, this should make the standard path (when no errors happen) to stay the same speed

nivekuil 2021-01-29T14:06:09.101700Z

@wilkerlucio: much better now, no apparent perf impact in repl

wilkerlucio 2021-01-29T14:07:20.102Z

cool, being honest, you will probably see a bit more when some error happen, but at least will be only for the entries that have error

wilkerlucio 2021-01-29T14:07:54.102200Z

this cost comes from plan traversing to find the errors, the plugin will do it once for each attribute you requested, and in case of a no-error it has to traverse back until the root, so the cost will highly depend on the graph complexity

wilkerlucio 2021-01-29T14:08:11.102400Z

I think this can be optimized in the future to reduce the number of required lookups

markaddleman 2021-01-29T02:13:13.089900Z

It turns out this is a me problem and not a pathom problem. The smart map is working exactly as you describe

2021-01-29T03:46:40.090800Z

Is there a recommended way to test pathom resolvers? I would prefer to not have to call my create function before each test of a resolver

dehli 2021-01-29T13:36:49.100Z

👋 in pathom3 you can invoke your resolver as if it were a function. not sure if that works in pathom2 as well

2021-01-29T07:16:36.092700Z

@royalaid if you are in pathom2 you can call the resolver function from your tests like this:

((::pc/resolve your-resolver) context params)
in pathom3 you can call the resolver directly https://pathom3.wsscode.com/docs/tutorial#resolvers

2021-01-29T07:17:17.093400Z

not sure if that’s recommended way for pathom2 though 🙂 that’s how we do it.

nivekuil 2021-01-29T09:04:22.094200Z

can map data be combined with EQL idents https://pathom3.wsscode.com/docs/eql#providing-map-data? I am trying to provide both in an eql query but it seems pathom is ignoring at least one of them

nivekuil 2021-01-29T09:13:58.094400Z

I ended up just putting the initial attributes into env and proxing them to params through a resolver

souenzzo 2021-01-29T12:39:46.098900Z

@wilkerlucio Will pathom3 implement parameters like :xform, :as, :default or it will be done only by external plugins?

wilkerlucio 2021-01-29T13:22:00.099100Z

example?

wilkerlucio 2021-01-29T13:22:29.099800Z

not planned to do any of that, make your plugins

✔️ 1
dehli 2021-01-29T13:47:52.100400Z

could the notion of ::pc/mutation-join-global also be done by an external plugin?

wilkerlucio 2021-01-29T13:53:51.100900Z

for that there is a new key, the new key is called :com.wsscode.pathom3.format.eql/map-select-include, the attribute-errors-plugin does it: https://github.com/wilkerlucio/pathom3/blob/master/src/main/com/wsscode/pathom3/connect/built_in/plugins.cljc#L16-L22

wilkerlucio 2021-01-29T13:54:45.101300Z

ah, sorry, for mutations is different, but doable as well, if you make a mutation plugin you can do the same there

dehli 2021-01-29T14:17:37.102600Z

great! i will investigate. would there be interest in having a built-in plugin to support that old behavior? if i get a solution I can submit a PR if you’d like

wilkerlucio 2021-01-29T14:18:52.102900Z

only if the feature makes sense as new feature for Pathom 3, but not for compatibility. its on my plans to have yet another library, to make the porting easier, any things that are related mainly for porting should go there

👍 1