wandersoncferreira / code-review

Code Reviews in Emacs
https://wandersoncferreira.github.io/code-review/
GNU General Public License v3.0
462 stars 50 forks source link

[gitlab] Fetch PR throws "deferrer error : (wrong-type-argument sequencep number-or-marker-p)" #195

Open ipocentro87 opened 2 years ago

ipocentro87 commented 2 years ago

Describe the bug Hi all, I am on a company gitlab account (gitlab.companyname.com) and I am having some issues in fetching a PR. when I am on a pull request and run code-review-forge-pr-at-point I get the following message:

Fetch diff PR...60% 
deferred error : (wrong-type-argument sequencep number-or-marker-p)

Do you have an idea how to debug it? Thank you in advance

To Reproduce Run code-review-forge-pr-at-point on a pull request line in magit-status

Desktop:

EDIT Actually I get this issue only on some PR, I have other PR that work PS I love this library, thank you a lot.

wandersoncferreira commented 2 years ago

Hello @ipocentro87 , could you check if you set the variables correctly as proposed here https://github.com/wandersoncferreira/code-review/issues/174#issuecomment-1005663842?

Also you could check the code-review-log-file that usually is located in your .emacs.d or if you use Doom Emacs it might be inside the .emacs.d/.local folder.

ipocentro87 commented 2 years ago

Hi @wandersoncferreira, sorry for my late reply. I think that variables are properly set, as I am actually able to retrieve merge requests on some topics, but for some reason it doesn't work on others. I just have the code-review-error.log file in my .emacs.d. Unfortunately the only message I get is this one:

code-review--build-buffer - (wrong-type-argument number-or-marker-p nil)

Do I need to set a variable in order to increase verbosity?

wandersoncferreira commented 2 years ago

@ipocentro87 you can set (setq code-review-log-raw-request-responses t). This will log all raw API calls into the log file. This is a good next point for us to move forward in the debug process here.

isker commented 2 years ago

@wandersoncferreira I have the same problem. I set code-review-log-raw-request-responses and see the data for my PR in the log, just before this error is printed. Here it is (pretty printed), though I had to redact a bunch of the contents. Hopefully the structure is enough to go on...

((data
  (repository
   (pullRequest
    (id . "gid://gitlab/MergeRequest/246214")
    (author
     (login . "isker")
     (url . "https://gitlab.example.com/isker"))
    (comments
     (nodes
      ((databaseId . "gid://gitlab/Note/1519232")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/5fd6cff2395c0bd8a985ddd1cd3ad9bd53c57514"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:80\" dir=\"auto\">removed this merge request from the merge train because pipeline did not succeed</p>")
       (author
        (login . "isker"))
       (createdAt . "2022-03-08T01:22:42Z")
       (updatedAt . "2022-03-08T01:22:42Z")
       (system . t)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1519228")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/6b8c0ee1529cbbd1fe4bae381a1c4f00ef94eaca"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:21\" dir=\"auto\">started a merge train</p>")
       (author
        (login . "isker"))
       (createdAt . "2022-03-08T01:20:58Z")
       (updatedAt . "2022-03-08T01:20:58Z")
       (system . t)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1480148")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/cc45995ec80e3a746f783a3069d08293aa4b344b"))
       (bodyHTML . "REDACTED COMMENT")
       (author
        (login . "REDACTED USER"))
       (createdAt . "2022-03-01T19:12:32Z")
       (updatedAt . "2022-03-01T19:12:32Z")
       (system)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1480142")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/cb0a288cd566e130c7c3963d68a0c1c0d92087a3"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:76\" dir=\"auto\">mentioned in commit <a href=\"/REDACTED_GROUP/REDACTED_PROJECT/-/commit/0fb1be39ebed9ad249e3915cd4a06cf6466ba505\" data-original=\"REDACTED_PROJECT@0fb1be39ebed9ad249e3915cd4a06cf6466ba505\" data-link=\"false\" data-link-reference=\"false\" data-project=\"12345\" data-commit=\"0fb1be39ebed9ad249e3915cd4a06cf6466ba505\" data-reference-type=\"commit\" data-container=\"body\" data-placement=\"top\" title=\"REDACTED COMMIT MESSAGE\" class=\"gfm gfm-commit has-tooltip\">REDACTED_PROJECT@0fb1be39</a></p>")
       (author
        (login . "REDACTED_USER"))
       (createdAt . "2022-03-01T19:10:39Z")
       (updatedAt . "2022-03-01T19:10:39Z")
       (system . t)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1480132")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/c18a684b19c451c356dad61e7219b3c6474a2b31"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:17\" dir=\"auto\">added 167 commits</p>&#x000A;<ul dir=\"auto\">&#x000A;<li>&#x000A;<a href=\"/REDACTED_GROUP/REDACTED_PROJECT/-/compare/a13f9c12bb950d222edd53183ad8760a643cbd3d...e98124bcfd08a356bb514af6888f1a88d6054450\" data-original=\"a13f9c12...e98124bc\" data-link=\"false\" data-link-reference=\"false\" data-project=\"67890\" data-commit-range=\"a13f9c12bb950d222edd53183ad8760a643cbd3d...e98124bcfd08a356bb514af6888f1a88d6054450\" data-reference-type=\"commit_range\" data-container=\"body\" data-placement=\"top\" title=\"\" class=\"gfm gfm-commit_range has-tooltip\">a13f9c12...e98124bc</a> - 166 commits from branch <code>master</code>&#x000A;</li>&#x000A;<li>&#x000A;<a href=\"/REDACTED_GROUP/REDACTED_PROJECT/-/merge_requests/7433/diffs?commit_id=4024a077c66ec303a8f35db2868e0e6443d9cac8\" data-original=\"4024a077\" data-link=\"false\" data-link-reference=\"false\" data-project=\"67890\" data-commit=\"4024a077c66ec303a8f35db2868e0e6443d9cac8\" data-reference-type=\"commit\" data-container=\"body\" data-placement=\"top\" title=\"Test\" class=\"gfm gfm-commit has-tooltip\">4024a077</a> - Test</li>&#x000A;</ul>&#x000A;<p data-sourcepos=\"5:1-5:143\" dir=\"auto\"><a href=\"/REDACTED_GROUP/REDACTED_PROJECT/-/merge_requests/7433/diffs?diff_id=631198&amp;start_sha=a13f9c12bb950d222edd53183ad8760a643cbd3d\">Compare with previous version</a></p>")
       (author
        (login . "isker"))
       (createdAt . "2022-03-01T19:06:25Z")
       (updatedAt . "2022-03-01T19:06:25Z")
       (system . t)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1476900")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/3d6c8fbe331cc5714b57fc9e990089a5949df7cb"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:80\" dir=\"auto\">removed this merge request from the merge train because pipeline did not succeed</p>")
       (author
        (login . "isker"))
       (createdAt . "2022-02-26T02:15:28Z")
       (updatedAt . "2022-02-26T02:15:28Z")
       (system . t)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1476898")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/a6d278e8ead8c4f80f2fc88555a4e1fcd94b80e3"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:76\" dir=\"auto\">mentioned in commit <a href=\"/REDACTED_GROUP/REDACTED_PROJECT/-/commit/1e278b324134cc7b1dc5de52d89d18652ed21811\" data-original=\"REDACTED_PROJECT@1e278b324134cc7b1dc5de52d89d18652ed21811\" data-link=\"false\" data-link-reference=\"false\" data-project=\"12345\" data-commit=\"1e278b324134cc7b1dc5de52d89d18652ed21811\" data-reference-type=\"commit\" data-container=\"body\" data-placement=\"top\" title=\"REDACTED COMMIT MESSAGE\" class=\"gfm gfm-commit has-tooltip\">REDACTED_PROJECT@1e278b32</a></p>")
       (author
        (login . "REDACTED_USER"))
       (createdAt . "2022-02-26T02:15:27Z")
       (updatedAt . "2022-02-26T02:15:27Z")
       (system . t)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1476896")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/e2c5e25a3a65bcc2def8c053e02efbccf3ba2233"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:76\" dir=\"auto\">mentioned in commit <a href=\"/REDACTED_GROUP/REDACTED_PROJECT/-/commit/829a16e22b5671cc9f177699e75d9558709e298a\" data-original=\"REDACTED_PROJECT@829a16e22b5671cc9f177699e75d9558709e298a\" data-link=\"false\" data-link-reference=\"false\" data-project=\"12345\" data-commit=\"829a16e22b5671cc9f177699e75d9558709e298a\" data-reference-type=\"commit\" data-container=\"body\" data-placement=\"top\" title=\"REDACTED COMMIT MESSAGE\" class=\"gfm gfm-commit has-tooltip\">REDACTED_PROJECT@829a16e2</a></p>")
       (author
        (login . "REDACTED_USER"))
       (createdAt . "2022-02-26T02:12:23Z")
       (updatedAt . "2022-02-26T02:12:23Z")
       (system . t)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1476895")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/7c0f3b6f582821a51f248178f10214f27f08e323"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:21\" dir=\"auto\">started a merge train</p>")
       (author
        (login . "isker"))
       (createdAt . "2022-02-26T02:09:00Z")
       (updatedAt . "2022-02-26T02:09:00Z")
       (system . t)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1476894")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/f14ea9fea48a39c1d7eb63bc2067df1e3fd1186d"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:38\" dir=\"auto\">marked this merge request as <strong>ready</strong></p>")
       (author
        (login . "isker"))
       (createdAt . "2022-02-26T02:08:59Z")
       (updatedAt . "2022-02-26T02:08:59Z")
       (system . t)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1476893")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/a396b6e779072769cd72fbf5c5cff0bfe8a06f68"))
       (bodyHTML . "REEDACTED COMMENT")
       (author
        (login . "REDACTED_USER"))
       (createdAt . "2022-02-26T02:05:39Z")
       (updatedAt . "2022-02-26T02:05:39Z")
       (system)
       (resolvable)
       (position))
      ((databaseId . "gid://gitlab/Note/1476891")
       (discussion
        (id . "gid://gitlab/IndividualNoteDiscussion/1a601431d9f1906cb4b52d6b54c5b8faf124d64c"))
       (bodyHTML . "<p data-sourcepos=\"1:1-1:76\" dir=\"auto\">mentioned in commit <a href=\"/REDACTED_GROUP/REDACTED_PROJECT/-/commit/43a73375b9bca4c849309cc6bf94e54201298ec6\" data-original=\"REDACTED_PROJECT@43a73375b9bca4c849309cc6bf94e54201298ec6\" data-link=\"false\" data-link-reference=\"false\" data-project=\"12345\" data-commit=\"43a73375b9bca4c849309cc6bf94e54201298ec6\" data-reference-type=\"commit\" data-container=\"body\" data-placement=\"top\" title=\"REDACTED COMMIT MESSAGE\" class=\"gfm gfm-commit has-tooltip\">REDACTED_PROJECT@43a73375</a></p>")
       (author
        (login . "REDACTED_USER"))
       (createdAt . "2022-02-26T02:04:01Z")
       (updatedAt . "2022-02-26T02:04:01Z")
       (system . t)
       (resolvable)
       (position))))
    (diffRefs
     (baseSha . "e98124bcfd08a356bb514af6888f1a88d6054450")
     (headSha . "4024a077c66ec303a8f35db2868e0e6443d9cac8")
     (startSha . "e98124bcfd08a356bb514af6888f1a88d6054450"))
    (headRefName . "isker-test")
    (baseRefName . "master")
    (commitCount . 1)
    (commitsWithoutMergeCommits
     (nodes
      ((abbreviatedOid . "4024a077")
       (message . "Test\n"))))
    (number . "7433")
    (isDraft)
    (databaseId . "7433")
    (createdAt . "2022-02-26T01:59:12Z")
    (updatedAt . "2022-03-08T01:22:42Z")
    (milestone)
    (labels
     (nodes))
    (assignees
     (nodes))
    (title . "REDACTED MR TITLE")
    (state . "opened")
    (bodyHTML . "<p data-sourcepos=\"1:1-1:13\" dir=\"auto\">Do not merge.</p>")))))
Bounga commented 2 years ago

Same error here, only on some PRs. The one that is causing issues is pretty large, there are a lot of changes.

Let me know if I can help in some way by providing more info (this PR contains a lot of private stuff, so if you need the generated structure I prefer to send it privately)

beem812 commented 2 years ago

also seeing this error for what it's worth

b40yd commented 1 year ago

same error

sochotnicky commented 1 year ago

I was hitting the same issue and with some initial debug logging I narrowed it down to: https://github.com/wandersoncferreira/code-review/blob/master/code-review-section.el#L1723

I am going to play around a bit more and see if I can dig up the problem. Otherwise I can confirm - code review works with some gitlab MRs but not others.

sochotnicky commented 1 year ago

OK, I had a guess so I tested it and I think I can reproduce by creating a commit that just moves a file around without making any changes so the diff string is empty.

Maybe that will help find a fix

hungpham2511 commented 1 year ago

I have the same issue. The log file contains this error

Sun Jan 15 13:18:20 2023 - code-review--build-buffer - (wrong-type-argument number-or-marker-p nil)
schradert commented 1 year ago

Same issue here. Only one of my PRs is doing this right now. It's with a GitHub repo.