graphql-inspector: Pull Request behind the target branch causing issues
By comparing a PR that may not have been rebased against the latest changes to master against master itself, graphql-inspector emits backwards compatibility warnings for any recently added fields, even though these fields won’t be removed by the PR. Although it’s possible to work around this by merging the latest master whenever this happens, this is a bit of a faff, especially given that GitHub doesn’t provide a button for doing this unless there’s a merge conflict.
Are there any tricks that would allow graphql-inspector to avoid showing these red herrings?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 16 (13 by maintainers)
Apologies @kamilkisiela, I managed to miss your reply here.
Suppose you have two developers, Bob & Sue, both working on the same codebase. They both pull the code at the same time to begin their work – let’s call the commit they start with
#c0.After a day, Sue commits a change where she adds a new field to the schema (
Person.agefor arguments sake), so that the latest commit onmasteris now#c1.Bob then pushes a new feature that does not change the schema whatsoever, and so can’t possibly introduce a backwardly incompatible change. However,
graphql-inspectorcompares his commit (which does not yet containPerson.age) againstmaster, which does, and concludes that Bob is breaking backwards compatibility by removing thePerson.agefield.Of course, he’s doing no such thing, and the problem is only that the latest version of
master(containing commit#c1) was not merged into his branch before performing the comparison.Hopefully that makes more sense now?
@wopian done, use
masterand try to run Inspector Action onpull_requestevent, when it’s onpushit won’t get a PR number. I would recommend to usepull_requeston PRs andpushformasterbranch or something like that.@kamilkisiela thank you! Will add this to my TODO list, this and something on our end ended up making me postpone adding it to our actions at the time.
Looks like it’s working perfectly! We’ll keep that flag turned on in our repo and see how that goes! Thanks, again!
Thanks so much! I’ll go give it a shot!
Feedback welcome!
@wopian not yet but I’m working on it now
@tylercrumpton @wopian @euvl @dchambers good news 😃
https://github.com/kamilkisiela/graphql-inspector/pull/1692
This way on every pull request we get the schema from
refs/pull/PR_NUMBER/mergewhich means it’s merged with the target branch. Your scenario should be solved by that change.sounds reasonable, I will work on a solution then 😃
I’ll second this request! We’ve run into this fairly frequently, with the same circumstances that @dchambers described. We would love to see it compare the merged/rebased commit against the defined schema instead of comparing the tip of the branch against the defined schema.