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

feat: retry plugin #67

Merged
merged 11 commits into from
Jul 29, 2024
Merged

feat: retry plugin #67

merged 11 commits into from
Jul 29, 2024

Conversation

whilefoo
Copy link
Member

@whilefoo whilefoo commented Jul 23, 2024

resolves #66

Copy link
Member

@0x4007 0x4007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems odd to use + to coerce into a number instead of using Number()

@whilefoo
Copy link
Member Author

@gentlementlegen I think something changed and now tests are failing.

● Rewards tests › Should split the rewards between multiple assignees

    expect(received).toEqual(expected) // deep equality

    - Expected  - 8
    + Received  + 8

    @@ -82,17 +82,17 @@
                    "p": Object {
                      "count": 24,
                      "score": 1,
                    },
                  },
    -             "formattingMultiplier": 0.25,
    +             "formattingMultiplier": 1,
                  "wordValue": 0.1,
                },
                "relevance": 0.8,
    -           "reward": 0.48,
    +           "reward": 1.92,
              },
    -         "type": "ISSUE|CONTRIBUTOR|COMMENTED",
    +         "type": "ISSUE|COLLABORATOR|COMMENTED",
              "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186805818",
            },
            Object {
              "content": "Ah yes because it doesn't apply the `0.5` multiplier I see. Will fix that on v2.",
              "score": Object {
    @@ -105,24 +105,24 @@
                    "p": Object {
                      "count": 16,
                      "score": 1,
                    },
                  },
    -             "formattingMultiplier": 0.25,
    +             "formattingMultiplier": 1,
                  "wordValue": 0.1,
                },
                "relevance": 0.8,
    -           "reward": 0.34,
    +           "reward": 1.36,
              },
    -         "type": "ISSUE|CONTRIBUTOR|COMMENTED",
    +         "type": "ISSUE|COLLABORATOR|COMMENTED",
              "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186813200",
            },

It changed from CONTRIBUTOR to COLLABORATOR so that's why rewards are different.

Why are we testing on real Github issues, it seems prone to bugs like these? Is there any particular reason why we can't mock github issues and comments? I still haven't figured out how to run tests on my local machine so I have to rely on Github actions :D

@gentlementlegen
Copy link
Member

gentlementlegen commented Jul 26, 2024

@whilefoo It must be because I figured out yesterday that if a user has the organization in private, the bot would consider that you are a contributor and not a collaborator. So now that I made it public so I became a COLLABORATOR.

These tests were not mocked somehow hence the difference now. You can see in the conflicts that I made the required changes to mock all of these so this should not happen anymore.

PS: sorry for the conflicts

@whilefoo whilefoo marked this pull request as ready for review July 26, 2024 21:20
@gentlementlegen
Copy link
Member

@whilefoo The logic works however the posted message is wrong (test run here) so you might want to serialize the object.

@gentlementlegen
Copy link
Member

Seems to work fine: Meniole#6 (comment)

@whilefoo whilefoo merged commit 80609d2 into development Jul 29, 2024
5 checks passed
@gentlementlegen gentlementlegen deleted the retry branch October 15, 2024 07:25
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 this pull request may close these issues.

Change ts-retry to Octokit plugin retry
3 participants