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

error in process filter: forge--ghub-update-notifications: No clause matching ‘(nil nil nil)’ #609

Closed
benthamite opened this issue Dec 13, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@benthamite
Copy link
Contributor

benthamite commented Dec 13, 2023

When I call forge-pull-notifications, the notifications are not pulled. Instead, I get these errors:

error in process filter: forge--ghub-update-notifications: No clause matching ‘(nil nil nil)’
error in process filter: No clause matching ‘(nil nil nil)’
Error in post-command-hook (magit-section-post-command-hook): (args-out-of-range 180500 180500)

I used to be able to call this command without problems. The problem started after I updated forge to #0d8eaad. That commit introduces a bunch of changes related to how forge handles notifications, so it all makes sense.

The backtrace below has some redacted parts that were too long or might contain confidential data. I'd be happy to send you an unredacted version by email if you think that would help. Let me know if there’s anything else I can do to help debug this issue.

Backtrace

Debugger entered--Lisp error: (error "No clause matching ‘(nil nil nil)’")
error("No clause matching `%S'" (nil nil nil))
forge--ghub-update-notifications [redacted]
#f(compiled-function (&optional data headers status req) #<bytecode -0x10971f07575f251b>) [redacted]
#f(compiled-function (data) #<bytecode 0x1f21bdb92a120ed9>) [redacted]
ghub--graphql-walk-response(#s(ghub--graphql-req :url #s(url :type "https" :user nil :password nil :host "api.github.com" :portspec nil :filename "/graphql" :target nil :attributes nil :fullness t :silent nil :use-cookies t :asynchronous t) :forge nil :silent nil :method "POST" :headers #f(compiled-function () #<bytecode -0x1f6050226e2da69b>) :handler ghub--graphql-handle-response :unpaginate nil :noerror nil :reader nil :callback #f(compiled-function (data) #<bytecode 0x1f21bdb92a120ed9>) :errorback nil :value nil :extra nil :query (query ((_Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTM0MjkzMDc0MTo3MDU3ODE5Njcz repository) [(name "citar") (owner "emacs-citar")] (issue [(number 786)] number id state stateReason (author login) title createdAt updatedAt closedAt locked (milestone id) body (assignees [(first 100)] (pageInfo endCursor hasNextPage) (edges (node id))) (comments [(first 100)] (pageInfo endCursor hasNextPage) (edges (node id databaseId (author login) createdAt updatedAt body))) (labels [(first 100)] (pageInfo endCursor hasNextPage) (edges (node id))))) ((_Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTM0MjkzMDc0MTo3MDYwMzY4ODEx repository) [(name "citar") (owner "emacs-citar")] (pullRequest [(number 787)] number id state (author login) title createdAt updatedAt closedAt mergedAt isDraft locked maintainerCanModify isCrossRepository (milestone id) body (baseRef name (repository nameWithOwner)) baseRefOid (headRef name (repository (owner login) nameWithOwner)) headRefOid (assignees [(first 100)] (pageInfo endCursor hasNextPage) (edges (node id))) (reviewRequests [(first 100)] (pageInfo endCursor hasNextPage) (edges (node (requestedReviewer "... on User { id }\n")))) (comments [(first 100)] (pageInfo endCursor hasNextPage) (edges (node id databaseId (author login) createdAt updatedAt body))) (labels [(first 100)] (pageInfo endCursor hasNextPage) (edges (node id)))))) :query-str "query {\n  _Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTM0MjkzMDc0MTo3MDU3ODE5Njcz: repository (name: \"citar\",owner: \"emacs-citar\") {\n    issue (number: 786) {\n      number\n      id\n      state\n      stateReason\n      author {\n\11login\n      }\n      title\n      createdAt\n      updatedAt\n      closedAt\n      locked\n      milestone {\n\11id\n      }\n      body\n      assignees (first: 100) {\n\11pageInfo {\n\11  endCursor\n\11  hasNextPage\n\11}\n\11edges {\n\11  node {\n\11    id\n\11  }\n\11}\n      }\n      comments (first: 100) {\n\11pageInfo {\n\11  endCursor\n\11  hasNextPage\n\11}\n\11edges {\n\11  node {\n\11    id\n\11    databaseId\n\11    author {\n\11      login\n\11    }\n\11    createdAt\n\11    updatedAt\n\11    body\n\11  }\n\11}\n      }\n      labels (first: 100) {\n\11pageInfo {\n\11  endCursor\n\11  hasNextPage\n\11}\n\11edges {\n\11  node {\n\11    id\n\11  }\n\11}\n      }\n    }\n  }\n  _Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTM0MjkzMDc0MTo3MDYwMzY4ODEx: repository (name: \"citar\",owner: \"emacs-citar\") {\n    pullRequest (number: 787) {\n      number\n      id\n      state\n      author {\n\11login\n      }\n      title\n      createdAt\n      updatedAt\n      closedAt\n      mergedAt\n      isDraft\n      locked\n      maintainerCanModify\n      isCrossRepository\n      milestone {\n\11id\n      }\n      body\n      baseRef {\n\11name\n\11repository {\n\11  nameWithOwner\n\11}\n      }\n      baseRefOid\n      headRef {\n\11name\n\11repository {\n\11  owner {\n\11    login\n\11  }\n\11  nameWithOwner\n\11}\n      }\n      headRefOid\n      assignees (first: 100) {\n\11pageInfo {\n\11  endCursor\n\11  hasNextPage\n\11}\n\11edges {\n\11  node {\n\11    id\n\11  }\n\11}\n      }\n      reviewRequests (first: 100) {\n\11pageInfo {\n\11  endCursor\n\11  hasNextPage\n\11}\n\11edges {\n\11  node {\n\11    requestedReviewer {\n\11      ... on User { id }\n\n\11    }\n\11  }\n\11}\n      }\n      comments (first: 100) {\n\11pageInfo {\n\11  endCursor\n\11  hasNextPage\n\11}\n\11edges {\n\11  node {\n\11    id\n\11    databaseId\n\11    author {\n\11      login\n\11    }\n\11    createdAt\n\11    updatedAt\n\11    body\n\11  }\n\11}\n      }\n      labels (first: 100) {\n\11pageInfo {\n\11  endCursor\n\11  hasNextPage\n\11}\n\11edges {\n\11  node {\n\11    id\n\11  }\n\11}\n      }\n    }\n  }\n}" :variables nil :until nil :buffer #<killed buffer> :pages 1) (data (_Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTM0MjkzMDc0MTo3MDU3ODE5Njcz (issue (number . 786) (id . "I_kwDOFHC1Nc5rgIBh") (state . "CLOSED") (stateReason . "COMPLETED") (author (login . "benthamite")) (title . "prefixes and suffixes in `citar-markdown-insert-citation`") (createdAt . "2023-07-13T18:51:29Z") (updatedAt . "2023-07-14T14:58:31Z") (closedAt . "2023-07-14T12:13:25Z") (locked) (milestone) (body . "When I run `citar-insert-citation` in a Markdown buffer and select the work I want to cite, the identifier is inserted preceded by a space and followed by a comma and a space, e.g. `[ @Ord2020PrecipiceExistentialRisk, ]`. The function responsible for this behavior is `citar-markdown-insert-citation` (specifically, the lines `(prenote (if (string= \"\" prenote)  \"\" (concat prenote \" \")))` and `(postnote (if (string= \"\" postnote) \"\" (concat \", \" postnote)))`. ) I would prefer not to have these extra characters inserted when no prefix or suffix is provided, which would also be consistent with how citations are inserted in org-mode buffers. Would it make sense to add a user option to control this behavior?") (assignees (pageInfo (endCursor) (hasNextPage)) (edges)) (comments (pageInfo (endCursor . "Y3Vyc29yOnYyOpHOYYMwUg==") (hasNextPage)) (edges ((node (id . "IC_kwDOFHC1Nc5hcU5s") (databaseId . 1634815596) (author (login . "bdarcus")) (createdAt . "2023-07-13T19:48:06Z") (updatedAt . "2023-07-13T19:48:06Z") (body . "That's weird; testing just now, I don't see that. This is what I get when inserting without affix and with respectively.\15\n\15\n```markdown\15\n# Testing ...\15\n\15\n[@burwell2014]\15\n\15\n[see  @kohn2008, p12]\15\n```"))) ((node (id . "IC_kwDOFHC1Nc5hcmX4") (databaseId . 1634887160) (author (login . "benthamite")) (createdAt . "2023-07-13T20:42:13Z") (updatedAt . "2023-07-13T20:42:57Z") (body . "Okay, I now realize that this is not an intended behavior: looking at `citar-markdown-insert-citation` more carefully, I see that when the value of `prenote` and `postnote` is an empty string, it should not insert any extra characters. When I run edebug on `citar-markdown-insert-citation`, I see that `prenote` and `postnote` are evaluated to nil, so `(string= \"\" prenote)` and `(string= \"\" postnote)` evaluate to nil, and as a consequence `prenote` and `postnote` are assigned the values `(concat prenote \" \")` and `(concat \", \" postnote)`, respectively.\15\n\15\nPresumably in your case the value of `prenote` and `postnote` is an empty string rather than nil, which would explain why the citations are inserted without any extra characters. Do you have a sense of what might be causing the difference in the values of those two variables between us?\15\n"))) ((node (id . "IC_kwDOFHC1Nc5hc2Gh") (databaseId . 1634951585) (author (login . "bdarcus")) (createdAt . "2023-07-13T21:34:50Z") (updatedAt . "2023-07-13T21:34:50Z") (body . "No; I tried in both my default doom setup, and a minimal custom one.\15\n\15\nSeems regardless it would be better for it to check for a non-empty string?\15\n\15\nCare to submit a PR for that?"))) ((node (id . "IC_kwDOFHC1Nc5hdLkI") (databaseId . 1635039496) (author (login . "benthamite")) (createdAt . "2023-07-13T23:07:49Z") (updatedAt . "2023-07-13T23:07:49Z") (body . "Sure. To confirm, this would just involve replacing `(string= \"\" prenote)` with `(= (length prenote) 0)`, and `(string= \"\" postnote)` with `(= (length postnote) 0)`, in `citar-markdown-insert-citation`, right?"))) ((node (id . "IC_kwDOFHC1Nc5hdN7c") (databaseId . 1635049180) (author (login . "bdarcus")) (createdAt . "2023-07-13T23:23:23Z") (updatedAt . "2023-07-13T23:23:23Z") (body . "I believe so.\n"))) ((node (id . "IC_kwDOFHC1Nc5hgzBS") (databaseId . 1635987538) (author (login . "benthamite")) (createdAt . "2023-07-14T14:58:31Z") (updatedAt . "2023-07-14T14:58:31Z") (body . "By the way, in case this is helpful to others, the reason we were getting different values for `prenote` and `postnote` (as I just realized) is that I have `citar-markdown-prompt-for-extra-arguments` set to `nil`. Because I am not prompted for a prefix or a suffix, the value of those variables ends up being `nil` rather than an empty string."))))) (labels (pageInfo (endCursor) (hasNextPage)) (edges)))) (_Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTM0MjkzMDc0MTo3MDYwMzY4ODEx (pullRequest (number . 787) (id . "PR_kwDOFHC1Nc5VeGq9") (state . "MERGED") (author (login . "benthamite")) (title . "Modify if statements in citar-markdown-insert-citation") (createdAt . "2023-07-14T00:47:33Z") (updatedAt . "2023-07-14T12:13:24Z") (closedAt . "2023-07-14T12:13:24Z") (mergedAt . "2023-07-14T12:13:24Z") (isDraft) (locked) (maintainerCanModify) (isCrossRepository . t) (milestone) (body . "Closes #786") (baseRef (name . "main") (repository (nameWithOwner . "emacs-citar/citar"))) (baseRefOid . "747d9083e07b57209f652949f4807ef9cec541da") (headRef (name . "fix/citar-markdown-insert-citation") (repository (owner (login . "benthamite")) (nameWithOwner . "benthamite/citar"))) (headRefOid . "12d8fd77d46948394e96144262e19cb3fe7c22b0") (assignees (pageInfo (endCursor) (hasNextPage)) (edges)) (reviewRequests (pageInfo (endCursor) (hasNextPage)) (edges)) (comments (pageInfo (endCursor . "Y3Vyc29yOnYyOpHOYX_vyA==") (hasNextPage)) (edges ((node (id . "IC_kwDOFHC1Nc5hdwDR") (databaseId . 1635188945) (author (login . "roshanshariff")) (createdAt . "2023-07-14T02:50:28Z") (updatedAt . "2023-07-14T02:50:28Z") (body . "I think a better way to write this is `(and prenote (not (string-empty-p prenote)))`, explicitly checking for prenote being non-nil and non-empty. Using `length` only works because `(length nil) => 0`, but it's a little non-obvious."))) ((node (id . "IC_kwDOFHC1Nc5hff8M") (databaseId . 1635647244) (author (login . "bdarcus")) (createdAt . "2023-07-14T10:22:37Z") (updatedAt . "2023-07-14T10:22:37Z") (body . "> I think a better way to write this ...\15\n\15\nI agree. Does it work on your end?\15\n\15\nIf yes, can you just make that change here?"))) ((node (id . "IC_kwDOFHC1Nc5hf-XH") (databaseId . 1635771847) (author (login . "benthamite")) (createdAt . "2023-07-14T12:09:38Z") (updatedAt . "2023-07-14T12:10:04Z") (body . "@roshanshariff, thanks. I think it should be `(or (not prenote) (string-empty-p prenote))`, i.e. the negation of your condition.\15\n\15\nI made the changes. (I tried to squash the new commit, which I believe is the recommendation, but had an issue with Forge/Magit, so I ended up force-pushing it. I'm not a programmer; apologies if this wasn't the correct process.)\15\n\15\n"))) ((node (id . "IC_kwDOFHC1Nc5hf-_I") (databaseId . 1635774408) (author (login . "bdarcus")) (createdAt . "2023-07-14T12:11:54Z") (updatedAt . "2023-07-14T12:11:54Z") (body . "> I tried to squash the new commit, which I believe is the recommendation, but had an issue with Forge/Magit, so I ended up force-pushing it ...\15\n\15\nNo worries; I can just squash merge it.\15\n\15\nThanks!"))))) (labels (pageInfo (endCursor) (hasNextPage)) (edges))))))
ghub--graphql-handle-response [redacted]
url-http-activate-callback()
url-http-chunked-encoding-after-change-function(2711 3813 1102)
url-http-generic-filter(#<process api.github.com> [redacted])

@tarsius
Copy link
Member

tarsius commented Dec 13, 2023

Thanks for the report. This is fixed now, but takes a while to make it to Melpa. You can get it going immediately by setting forge-notifications-github-kludge.

@benthamite
Copy link
Contributor Author

benthamite commented Feb 8, 2024

I'm getting what appears to be a related error after setting forge-notifications-github-kludge to pending-if-unset, and then running forge-pull-notifications:

Debugger entered--Lisp error: (error "No clause matching ‘(nil nil pending-if-unset)’")
  error("No clause matching `%S'" (nil nil pending-if-unset))

(Posting here since it seemed like it wasn’t worth opening a new issue; let me know if you would like me to do that.)

tarsius added a commit that referenced this issue Feb 8, 2024
@tarsius
Copy link
Member

tarsius commented Feb 8, 2024

That's fixed now. Thanks for the report!

@tarsius tarsius added the bug Something isn't working label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants