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
campaigns: Support changeset filtering #8848
Conversation
When we sync a changeset or receive a webhook
Codecov Report
@@ Coverage Diff @@
## master #8848 +/- ##
==========================================
- Coverage 41.63% 41.62% -0.02%
==========================================
Files 1314 1314
Lines 70680 70822 +142
Branches 6554 6556 +2
==========================================
+ Hits 29425 29477 +52
- Misses 38577 38656 +79
- Partials 2678 2689 +11
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to see that updating the state based on syncing data and webhook events is as easy as this.
Couple of thoughts:
- I don't think we should use enums in the database for this. Especially not if we use a bail-out value like UNKNOWN. I would simply use a nullable text column and make sure we handle the null value properly.
- If we could get away without using
UNKNOWN
, that would be great.ChangesetReviewStatePending
is already a good default value. As isChangesetStateOpen
forState()
. - Can we already use these values in the
State()
,ReviewState()
,CheckState()
methods onChangesetResolver
?
…h into filter-changesets
Currently our GraphQL and code enums do not match up # The state of a Changeset Review
enum ChangesetReviewState {
APPROVED
CHANGES_REQUESTED
PENDING
}
# The state of continuous integration checks on a changeset
enum ChangesetCheckState {
PENDING
PASSED
FAILED
} // ChangesetReviewState constants.
const (
ChangesetReviewStateApproved ChangesetReviewState = "APPROVED"
ChangesetReviewStateChangesRequested ChangesetReviewState = "CHANGES_REQUESTED"
ChangesetReviewStatePending ChangesetReviewState = "PENDING"
ChangesetReviewStateCommented ChangesetReviewState = "COMMENTED"
ChangesetReviewStateDismissed ChangesetReviewState = "DISMISSED"
)
// ChangesetCheckState constants.
type ChangesetCheckState string
const (
ChangesetCheckStateUnknown ChangesetCheckState = "UNKNOWN"
ChangesetCheckStatePending ChangesetCheckState = "PENDING"
ChangesetCheckStatePassed ChangesetCheckState = "PASSED"
ChangesetCheckStateFailed ChangesetCheckState = "FAILED"
) For Review state currently works since we don't currently return any values that don't exist in the GraphQL API but it does make me a bit nervous that it could break in future. |
I had an idea for how to handle review state. Once all the logic of computing state is moved to update time then the code at the resolver layer will just be reading the value from a field and we can decide at that point what to do with values that don't exist in graohql. At least then that logic is isolated to the resolver layer. It's still not totally type safe but I think it's more explicit that what's happening now |
In order to properly compute new state
PTAL @mrnugget I'll do the resolver changes in another PR as this one is already pretty big |
Ah, sorry, I had "Approve" selected but meant: changes requested. Take a look at the comments. |
If I understand it correctly: the UI in here completes this feature, right? If so, please add a changelog entry :) |
And make it a method on Changeset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving. Discussed comments etc. on Slack call.
Co-Authored-By: Thorsten Ball <mrnugget@gmail.com>
Co-Authored-By: Thorsten Ball <mrnugget@gmail.com>
…h into filter-changesets
This adds support for filtering by State, ReviewState and CheckState
The columns are updated when we sync or receive a webhook as these are the moment we get input about external state.
We may need to add a new enum value,
UNKNOWN
to each of the GraphQL enums so that we can filter to display those states.The migration adds new columns and types but leaves state as
UNKNOWN
until next sync or webhook. I think this is fine considering we don't have any customers with large numbers of changesets.I'll update the resolvers to use the new columns in another PR.
Part of: #8462