Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the env when mutating without a join breaks the parser #135

Closed
MrEbbinghaus opened this issue Dec 12, 2019 · 1 comment · Fixed by #139
Closed

Updating the env when mutating without a join breaks the parser #135

MrEbbinghaus opened this issue Dec 12, 2019 · 1 comment · Fixed by #139

Comments

@MrEbbinghaus
Copy link
Contributor

MrEbbinghaus commented Dec 12, 2019

When updating the env inside a mutation and not doing a join afterwards, the result of the mutation is returned without the removal of the ::p/env.

In the case of the parallel-parser with mutate-async this results in a StackOverflow when printing the result. (There is some sort of recursion happening in the data structure)

(pc/defmutation my-mutation [env _]
    {::pc/output []}
    {::p/env env})

(def p (p/parallel-parser {::p/mutate  pc/mutate-async
                                             ::p/env     {::p/reader [p/map-reader pc/parallel-reader]}
                                             ::p/plugins [(pc/connect-plugin {::pc/register [my-mutation]})]}))

(async/<!! (p {} `[(my-mutation {})]))
; => Error printing return value (StackOverflowError) ...
(async/<!! (p {} `[{(my-mutation {}) []}]))
; => {:my-mutation {}}
@MrEbbinghaus MrEbbinghaus changed the title Updating the env in a non-join mutation breaks the parser Updating the env mutating without a join breaks the parser Dec 12, 2019
@MrEbbinghaus MrEbbinghaus changed the title Updating the env mutating without a join breaks the parser Updating the env when mutating without a join breaks the parser Dec 12, 2019
@souenzzo
Copy link
Contributor

souenzzo commented Jan 9, 2020

This is not a pathom issue
Using (set! *print-level* 3) should solve that

one sexp reproduce

(let [register [(pc/mutation `x1 {} (fn [env input]
                                      {::p/env env}))]
      parser (p/parallel-parser {::p/mutate  pc/mutate-async
                                 ::p/plugins [(pc/connect-plugin {::pc/register register})]})
      env {::p/reader [p/map-reader
                       pc/reader2
                       pc/open-ident-reader]}]
  (keys (async/<!! (parser env `[(x1)]))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants