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

API: drop None rather than unset in JSON response #236

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

tombh
Copy link
Collaborator

@tombh tombh commented May 31, 2022

This addresses #217 and #231.

I am still new to the project, so I may not have the full story. But it
started with a somewhat far-reaching merge to remove defaults from all
serialisable fields in the API: #198. This had the knock-on effect of
regressing progress notifications, as reported by @MatejKastak in #217.
One of their suggestions is to not use exclude_unset=True. Some months
later @dimbleby suggested that exclude_none=True would also fix the
issue[1]. Considering those 2 suggestions, let's replace
exclude_unset=True with exclude_none=True.

  1. remove defaults from optional fields #198 (comment)

Code review checklist (for code reviewer to complete)

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • Tests have been included and/or updated, as appropriate
  • Docstrings have been included and/or updated, as appropriate
  • Standalone docs have been updated accordingly
  • CONTRIBUTORS.md was updated, as appropriate
  • Changelog has been updated, as needed (see CHANGELOG.md)

@tombh tombh force-pushed the exclude-nones-rather-than-unsets branch from 88c4c2e to fb73307 Compare May 31, 2022 13:37
@tombh tombh requested a review from renatav May 31, 2022 13:38
@tombh tombh force-pushed the exclude-nones-rather-than-unsets branch from fb73307 to f53d661 Compare May 31, 2022 13:39
@tombh
Copy link
Collaborator Author

tombh commented May 31, 2022

@MatejKastak and @dimbleby: would you like to comment on this fix?

@dimbleby
Copy link
Contributor

Looks familiar! sure, seems ok to me

@MatejKastak
Copy link
Contributor

Great! Thanks for working on this. I also approve and I don't have any other comments.

@tombh
Copy link
Collaborator Author

tombh commented May 31, 2022

@dimbleby haha, yes you're fix 😏 Thank you

@MatejKastak Thank you too, and thanks for waiting

Just waiting for the review, then LGTM 🚀

Copy link
Contributor

@renatav renatav left a comment

Choose a reason for hiding this comment

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

LGTM, just one question

CODE_LENS,
CodeLensOptions(
resolve_provider=False,
work_done_progress='token'
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why PROGRESS_TOKEN is not used here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good spot!

@perrinjerome
Copy link
Contributor

Can you also add something like:

Fixes #231

in the description so that this issue gets automatically fixed ?

perrinjerome
perrinjerome previously approved these changes Jun 1, 2022
Copy link
Contributor

@perrinjerome perrinjerome left a comment

Choose a reason for hiding this comment

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

Good to see this :)

CONTRIBUTORS.md Outdated
@@ -15,3 +15,4 @@
- [yorodm](https://github.com/yorodm)
- [bollwyvl](https://github.com/bollwyvl)
- [Dillan Mills](https://github.com/DillanCMills)
- [Tom BH](https://github.com/tombh)
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems it was not always followed earlier either, but this list is supposed to be sorted in alphabetical order ( https://github.com/openlawlibrary/pygls/blob/f53d6615e4561184b393d4b2c6b5629f31f33dbb/CONTRIBUTORS.md#contributors-alphabetical )

@perrinjerome
Copy link
Contributor

perrinjerome commented Jun 1, 2022

Can you also add something like:

Fixes #231

in the description so that this issue gets automatically fixed ?

Oh sorry, I did not realize the issue was already mentioned in the pull request description 😖.

That said, you can still change to using a keyword like Fixes if you wish, because it is understood by github ( https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword )

@renatav
Copy link
Contributor

renatav commented Jun 1, 2022

@tombh I don't think that this issue is specific to this PR, but Python 3.6 Windows build is getting stuck. Would be good to know what is causing this even though we are planning to drop Python 3.6 support

@tombh tombh force-pushed the exclude-nones-rather-than-unsets branch 3 times, most recently from b1e937a to ddde14f Compare June 1, 2022 21:05
Fixes #217, #231.

I am still new to the project, so I may not have the full story. But it
started with a somewhat far-reaching merge to remove defaults from all
serialisable fields in the API: #198. This had the knock-on effect of
regressing progress notifications, as reported by @MatejKastak in #217.
One of their suggestions is to not use `exclude_unset=True`. Some months
later @dimbleby suggested that `exclude_none=True` would also fix the
issue[1]. Considering those 2 suggestions, let's replace
`exclude_unset=True` with `exclude_none=True`.

1. #198 (comment)
@tombh tombh force-pushed the exclude-nones-rather-than-unsets branch from ddde14f to 45879b4 Compare June 1, 2022 21:18
@tombh
Copy link
Collaborator Author

tombh commented Jun 1, 2022

@perrinjerome I added the "Fixes" to the commit message and changed the contributors order. Thanks

@renatav Yes I saw that, and have had a play with it, it's actually intermittent and I've even seen it affect almost all items in the matrix, any version or OS, but yes more often Windows/Python 3.6. There's evidence of it happening before this PR, so as you say I don't think it's being introduced with this code. There's no lock file for the dependencies, so the only thing I can think is that a minor change in a dependent package has caused this. Which leads me to think that our next step should be #229, #223 and of course #235. So I vote for merging this PR as all the tests are passing, just rarely without some failure from the flakey bug.

@renatav
Copy link
Contributor

renatav commented Jun 1, 2022

@tombh We usually use fixes in the PR comment, not sure that commit message with fixes will automatically close issues. I'll approve the PR

@renatav renatav self-requested a review June 1, 2022 22:08
@tombh tombh closed this Jun 2, 2022
@tombh tombh reopened this Jun 2, 2022
@tombh tombh merged commit 0d2b7cd into master Jun 2, 2022
alcarney added a commit to alcarney/pygls that referenced this pull request Jul 4, 2022
This undoes the change in openlawlibrary#236 as well as bring back the explicit
setting of non `None` default fields as suggested in [1]

This commit also introduces serialization test cases that hopefully
cover all the scenarios raised in openlawlibrary#245, openlawlibrary#231 and openlawlibrary#198

[1]: openlawlibrary#245 (comment)
alcarney added a commit to alcarney/pygls that referenced this pull request Jul 4, 2022
This undoes the change in openlawlibrary#236 as well as bring back the explicit
setting of non `None` default fields as suggested in [1]

This commit also introduces serialization test cases that hopefully
cover all the scenarios raised in openlawlibrary#245, openlawlibrary#231 and openlawlibrary#198

[1]: openlawlibrary#245 (comment)
alcarney added a commit to alcarney/pygls that referenced this pull request Jul 4, 2022
This undoes the change in openlawlibrary#236 as well as bring back the explicit
setting of non `None` default fields as suggested in [1]

This commit also introduces serialization test cases that hopefully
cover all the scenarios raised in openlawlibrary#245, openlawlibrary#231 and openlawlibrary#198

[1]: openlawlibrary#245 (comment)
tombh pushed a commit that referenced this pull request Jul 4, 2022
This undoes the change in #236 as well as bring back the explicit
setting of non `None` default fields as suggested in [1]

This commit also introduces serialization test cases that hopefully
cover all the scenarios raised in #245, #231 and #198

[1]: #245 (comment)
@tombh tombh deleted the exclude-nones-rather-than-unsets branch July 5, 2022 20:16
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.

5 participants