fix: Command Auto Syncing#2990
Draft
Icebluewolf wants to merge 2 commits intoPycord-Development:masterfrom
Draft
fix: Command Auto Syncing#2990Icebluewolf wants to merge 2 commits intoPycord-Development:masterfrom
Icebluewolf wants to merge 2 commits intoPycord-Development:masterfrom
Conversation
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/2990/head:pr-2990
git checkout pr-2990This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord@refs/pull/2990/head |
Member
|
@Icebluewolf Feel free to mark this as ready for review once you think it is ready, note the linter failing in the gh actions |
Paillat-dev
requested changes
Dec 29, 2025
| return self.callback(local, remote) | ||
|
|
||
| class DefaultSetComparison(DefaultComparison): | ||
| def check(self, local, remote) -> bool: |
Member
There was a problem hiding this comment.
Suggested change
| def check(self, local, remote) -> bool: | |
| @override | |
| def check(self, local, remote) -> bool: |
Member
There was a problem hiding this comment.
Import override from typing_extensions at the top
| pass | ||
| return super().check(local, remote) | ||
|
|
||
| type NestedComparison = dict[str, NestedComparison | DefaultComparison] |
Member
There was a problem hiding this comment.
Suggested change
| type NestedComparison = dict[str, NestedComparison | DefaultComparison] | |
| NestedComparison: TypeAlias = dict[str, NestedComparison | DefaultComparison] |
The type keyword is only supported since py 3.12
| ] | ||
| ) | ||
|
|
||
| defaults: NestedComparison = { |
Member
There was a problem hiding this comment.
This most likely can be made a CONSTANT and doesn't need to be redefined at every function invocation
| (None, {0, 1, 2}, MISSING), lambda x, y: set(x) != set(y) | ||
| ), | ||
| } | ||
| option_defaults: NestedComparison = { |
Member
|
Do you think that #1745 could be addressed here as well ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is very much a draft and needs lots of testing. I just want to put it somewhere public so that I can get eyes on it.
This is something I am not quite sure how to cleanly fix at the moment.
I also need to check what the behavior is for undocumented fields in the payload from discord that may be added in the future. I believe the best option is to ignore those fields.
This gist (https://gist.github.com/Icebluewolf/1842ea5f7234ba40e5df18191bb135a0) contains 2 files. The first is where I developed the fix so that I did not have to make real API calls and is here for reference if someone wants to do the same. The second is unit tests for the new system. Both are very rough and messy sorry 🙃. This change needs to be tested extensively, so if someone sees test cases I missed or more test cases that should be added please let me know.
This PR attempts to fix the long running issue with the application command auto-syncing system. Currently the system is over eager and preforms upserts on commands that do not need to be updated. The main culprit is incorrect default value checking. This PR implements a more robust and easily extendable comparison system for commands.
Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.