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

json-extension: use an unique token for progress example #230

Merged

Conversation

perrinjerome
Copy link
Contributor

@perrinjerome perrinjerome commented Apr 3, 2022

The spec 1 and pygls implementation 2 need the token to be unique.

By using an hardcoded token like this, the progress works only one time,
the second time there's an error that token is already registered.

Description (e.g. "Related to ...", etc.)

Please replace this description with a concise description of this Pull Request.

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)

alcarney
alcarney previously approved these changes Apr 20, 2022
Copy link
Collaborator

@alcarney alcarney left a comment

Choose a reason for hiding this comment

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

Looks fine to me 😄

@alcarney
Copy link
Collaborator

@dgreisen not sure what is up with these expected statuses...

@perrinjerome perrinjerome force-pushed the fix/json-example-progress-token branch from a5e7111 to cf887ad Compare June 24, 2022 00:19
@perrinjerome
Copy link
Contributor Author

/cc @tombh

@tombh
Copy link
Collaborator

tombh commented Jul 4, 2022

I can't see what's going on with these expected CI status either 🫤 Maybe rebase master, CI config has changed a bit since the PR was submitted. Otherwise this is an easy LGTM

@perrinjerome
Copy link
Contributor Author

it was already rebased on master, but I thought "let's try again :)" so I changed the commit and git push --forceed again, but same.

I noticed that the "ci" workflow config does not run because it is configured to skip this ci workflow for paths in examples/json-extension/** :

pull_request:
paths-ignore:
- "examples/json-extension/**"

this pull request only change these paths, so this explains why the workflows did not run.

Next question is why this prevents the merge ? Maybe this is because the branch must be marked as "protected" with a setting to only allow merging if these test pass ( https://github.saobby.my.eu.orgmunity/t/github-actions-pull-requests-always-include-some-outdated-checks/16157/2 seems a similar issue ). Do you have access to these settings, can you confirm that ?

Thanks !

@tombh
Copy link
Collaborator

tombh commented Jul 4, 2022

Well-spotted. I don't have access to those settings, as I discovered from similar issues in #223. We can ask @dgreisen if needs be. But my feeling is that the disadvantages of that paths-ignore setting outweigh its advantages. Its advantage is that it reduces a bit of unnecessary CI work, but CI is essentially free anyway, so it's not really an advantage. And the disadvantage is the situation we have here.

So I vote for just removing those ignore settings. What do you think?

@perrinjerome
Copy link
Contributor Author

So I vote for just removing those ignore settings. What do you think?

This was also my idea.

There are also paths here:

paths:
- ".github/workflows/json-extension.yml"
- "examples/json-extension/**"

paths:
- ".github/workflows/json-extension.yml"
- "examples/json-extension/**"

which if I understand correctly mean "don't run json extension test unless json extension is changed", but I feel it's better to run the tests anyway in that case, a change in pygls might introduce a regression that would only be revealed by the extension test.

@tombh
Copy link
Collaborator

tombh commented Jul 5, 2022

Yes, agreed. Do you want to push a commit with those lines removed then?

@perrinjerome
Copy link
Contributor Author

Yes, agreed. Do you want to push a commit with those lines removed then?

Thanks @tombh I'll try to send a pull request with that, then we'll rebase this one on top

perrinjerome added a commit to perrinjerome/pygls that referenced this pull request Jul 8, 2022
By ignoring CI workflow when json extension is changed, we have a
problem that the tests are not run and stay in *Expected — Waiting for
status to be reported* state as we could see in openlawlibrary#230

Json extension tests were not run when only pygls code is changed, but
it can also be interesting to run the test for the extension every time,
because it acts as an integration test for pygls.

This change the workflow to run all tests for every pull request or push,
regardless of what code is changed.
tombh
tombh previously approved these changes Jul 21, 2022
@tombh
Copy link
Collaborator

tombh commented Jul 21, 2022

Sorry, were you waiting on a review for this?

@perrinjerome
Copy link
Contributor Author

Sorry, were you waiting on a review for this?

Thanks @tombh this is not really waiting for review, this is still pending because there's a problem with test status. My idea was to wait for #250 to be merged and then update this branch to get test passing.

tombh pushed a commit that referenced this pull request Jul 25, 2022
By ignoring CI workflow when json extension is changed, we have a
problem that the tests are not run and stay in *Expected — Waiting for
status to be reported* state as we could see in #230

Json extension tests were not run when only pygls code is changed, but
it can also be interesting to run the test for the extension every time,
because it acts as an integration test for pygls.

This change the workflow to run all tests for every pull request or push,
regardless of what code is changed.
@tombh
Copy link
Collaborator

tombh commented Jul 25, 2022

Ah yes, I remember. Ok merged #250.

@perrinjerome
Copy link
Contributor Author

I guess this can be merged, we were waiting to have the test passing first, but tests are OK now it seems

@tombh tombh force-pushed the fix/json-example-progress-token branch from f29ff00 to 463a120 Compare December 5, 2022 21:17
@tombh
Copy link
Collaborator

tombh commented Dec 5, 2022

I was just about to merge this when I realised that this would be a good addition the changelog. Could you add it?

I rebased master in, which is a force push. Which isn't good practice when collaborating on a branch, my apologies. I just thought I was on the point of merging. You can just force push yourself anyway, because all it is is the recent master branch changes.

The spec [1] and pygls implementation [2] needs the token to be unique.

By using an hardcoded token like this, the progress works only one time,
the second time there's an error that token is already registered.

1: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverInitiatedProgress

2: https://github.com/openlawlibrary/pygls//blob/ee17487e4f40f971e7ec6f7711fa8334c5b7b127/pygls/progress.py#L28
@perrinjerome perrinjerome force-pushed the fix/json-example-progress-token branch from 463a120 to 2d2e776 Compare December 14, 2022 02:47
@perrinjerome
Copy link
Contributor Author

Thanks @tombh and sorry for delay, I have finally added a changelog entry

@perrinjerome perrinjerome requested a review from tombh December 14, 2022 03:05
@tombh tombh merged commit af3f318 into openlawlibrary:master Dec 14, 2022
@tombh
Copy link
Collaborator

tombh commented Dec 14, 2022

Great, thanks ✨

@tombh
Copy link
Collaborator

tombh commented Feb 16, 2023

Released in https://pypi.org/project/pygls/1.0.1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants