Update Timeline event update mutation to consider timeline event tags
What does this MR do and why?
This MR adds support to update timeline event tags on a timeline event.
The way this works is the API expects the net result of tag updates to do on a timeline event.
For example, assume there are event1
, tag1
, tag2
, and tag3
on a project. event1
is already assigned with tag1
. We need to update it with tag3
. So from the front end, I will get [tag1, tag3]
. So I compute the tags to add and tags to remove and assign/unassign them accordingly.
If I have to delete the assigned tags on event1
, then the frontend passes me the []
tags value. This means, we need to delete all tag links to the event and it will not have any assigned tags. If the value for tags from frontend is the same as the assigned tags, then I do not perform any operation regarding tag updates on the event.
Query plan for the scopes
-
by_names
: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/13345/commands/46839 -
timeline_event.timeline_event_tags
: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/13345/commands/46840
Mutation
Sample mutation
mutation UpdateTimelineEvent($input: TimelineEventUpdateInput!) {
timelineEventUpdate(input: $input) {
timelineEvent {
id
note
timelineEventTags {
nodes {
name
}
}
}
errors
}
}
Sample input
{
"input": {
"id": "<global id of the incident>",
"note":"<strong>Updated note</strong>",
"occurredAt": "2022-01-25T11:38:05Z",
"timelineEventTagNames": [<name of the tag>]
}
}
How to set up and validate locally
- Make sure you have maintainer access to a project.
- Create some tags using GraphQL by following the steps mentioned in !102870 (merged)
- Create a timeline event using the UI by following the steps mentioned in the docs.
- Get the global id of the above timeline event from the console using
IncidentManagement::TimelineEvent.last.to_global_id
. - Follow the update mutation above with the above sample input to update the event.
- Pass some non-existing tags, remove some tags, add some tags using the API and check the result.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #373853 (closed)
Merge request reports
Activity
changed milestone to %15.6
assigned to @rkadam3
- A deleted user
added backend label
1 Warning This merge request includes more than 10 commits. Each commit should meet the following criteria: - Have a well-written commit message.
- Has all tests passing when used on its own (e.g. when using git checkout SHA).
- Can be reverted on its own without also requiring the revert of commit that came before it.
- Is small enough that it can be reviewed in isolation in under 30 minutes or so.
If this merge request contains commits that do not meet this criteria and/or contains intermediate work, please rebase these commits into a smaller number of commits or split this merge request into multiple smaller merge requests.
2 Messages CHANGELOG missing: If you want to create a changelog entry for GitLab FOSS, add the
Changelog
trailer to the commit message you want to add to the changelog.If you want to create a changelog entry for GitLab EE, also add the
EE: true
trailer to your commit message.If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.
This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is recommended. Reviews can happen after you merge. Documentation review
The following files require a review from a technical writer:
-
doc/api/graphql/reference/index.md
(Link to current live version)
The review does not need to block merging this merge request. See the:
-
Metadata for the
*.md
files that you've changed. The first few lines of each*.md
file identify the stage and group most closely associated with your docs change. - The Technical Writer assigned for that stage and group.
- Documentation workflows for information on when to assign a merge request for review.
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Raimund Hook (
@stingrayza
) (UTC+0, 5.5 hours behind@rkadam3
)Felipe Artur (
@felipe_artur
) (UTC-3, 8.5 hours behind@rkadam3
)database Jon Jenkins (
@jon_jenkins
) (UTC-6, 11.5 hours behind@rkadam3
)Alex Ives (
@alexives
) (UTC-6, 11.5 hours behind@rkadam3
)To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Danger- A deleted user
added documentation label
mentioned in issue #373853 (closed)
mentioned in issue #373854 (closed)
added 2135 commits
-
b8ceea9b...fdb41c4d - 2129 commits from branch
master
- a5a847d6 - Add update logic for timeline event
- 812f5391 - Add update logic for timeline event
- 854491eb - Update gql docs
- 83f66a40 - Always execute tag updates unless nil
- 5773efa3 - Rebase to master and refactor validate tags
- 0e798d7d - Fix cop offense for spec
Toggle commit list-
b8ceea9b...fdb41c4d - 2129 commits from branch
added featureaddition label
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
- Resolved by Rajendra Kadam
- Resolved by Heinrich Lee Yu
@bauerdominic - Do you mind taking initial look from backend, please?
requested review from @bauerdominic
- Resolved by Rajendra Kadam
added database label
removed review request for @bauerdominic
mentioned in work item #383135 (closed)
- A deleted user
added databasereview pending label
added 1 commit
- 3c537929 - Add more specs, make update as a transaction
requested review from @bauerdominic and @OmarQunsulGitlab
changed milestone to %15.7
added missed-deliverable missed:15.6 labels
requested review from @sashi_kumar and removed review request for @bauerdominic
- Resolved by Omar Qunsul
- Resolved by Rajendra Kadam
- Resolved by Omar Qunsul
- Resolved by Heinrich Lee Yu
- Resolved by Heinrich Lee Yu
I have written down some few suggestions, and big one
about usingcollection=(objects)
. Let me know what you think, and feel free to reassign me again
removed review request for @OmarQunsulGitlab
@sashi_kumar
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline will be started shortly.
For more info, please refer to the following links:
requested review from @engwan and removed review request for @sashi_kumar
- Resolved by Rajendra Kadam
Allure report
allure-report-publisher
generated test report!e2e-review-qa:
test report for 94a29f19expand test summary
+-----------------------------------------------------------------------------------------+ | suites summary | +------------------------------------+--------+--------+---------+-------+-------+--------+ | | passed | failed | skipped | flaky | total | result | +------------------------------------+--------+--------+---------+-------+-------+--------+ | Plan | 49 | 0 | 1 | 0 | 50 | ✅ | | Verify | 12 | 0 | 1 | 0 | 13 | ✅ | | Manage | 39 | 0 | 4 | 4 | 43 | ❗ | | Create | 28 | 0 | 1 | 0 | 29 | ✅ | | Govern | 10 | 0 | 5 | 0 | 15 | ✅ | | Configure | 0 | 0 | 1 | 0 | 1 | ➖ | | Feature flag handler sanity checks | 9 | 0 | 0 | 0 | 9 | ✅ | | Package | 0 | 0 | 1 | 0 | 1 | ➖ | | Version sanity check | 0 | 0 | 1 | 0 | 1 | ➖ | +------------------------------------+--------+--------+---------+-------+-------+--------+ | Total | 147 | 0 | 15 | 4 | 162 | ❗ | +------------------------------------+--------+--------+---------+-------+-------+--------+
- Resolved by Rajendra Kadam
removed review request for @engwan
added 896 commits
-
94a29f19...603d981a - 884 commits from branch
master
- 5c6626a2 - Add update logic for timeline event
- f4b98a94 - Add update logic for timeline event
- 15bf25c6 - Update gql docs
- 5580c59d - Always execute tag updates unless nil
- 9145208c - Rebase to master and refactor validate tags
- 6d527e61 - Fix cop offense for spec
- 35c16f5f - Update service for update event
- a7958c1b - Remove passing event around in the service
- 1c0a2b31 - Add transaction to the service
- 54caba30 - Add more specs, make update as a transaction
- fb2fe661 - Add more specs to check the transaction
- 8eb01bf7 - Add db reviewer and backend suggestions
Toggle commit list-
94a29f19...603d981a - 884 commits from branch
requested review from @OmarQunsulGitlab and @engwan
- Resolved by Heinrich Lee Yu
removed review request for @engwan
requested review from @engwan
added databasereviewed label and removed databasereview pending label
removed review request for @OmarQunsulGitlab
requested review from @a_akgun
Thanks @rkadam3 database LGTM.
added databaseapproved label and removed databasereviewed label
removed review request for @a_akgun
enabled an automatic merge when the pipeline for 2f9e03c1 succeeds
mentioned in commit f659e594
added workflowstaging-canary label and removed workflowin dev label
added workflowcanary label and removed workflowstaging-canary label
added workflowstaging label and removed workflowcanary label
added workflowproduction label and removed workflowstaging label
added workflowpost-deploy-db-staging label and removed workflowproduction label
added workflowpost-deploy-db-production label and removed workflowpost-deploy-db-staging label
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label
mentioned in merge request !109464 (merged)