-
Notifications
You must be signed in to change notification settings - Fork 356
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
feat: tracker import errors to job tracking error forward [DHIS2-15276] #15723
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #15723 +/- ##
=========================================
Coverage 66.27% 66.28%
- Complexity 31326 31368 +42
=========================================
Files 3484 3486 +2
Lines 129987 129973 -14
Branches 15192 15201 +9
=========================================
- Hits 86155 86151 -4
+ Misses 36742 36731 -11
- Partials 7090 7091 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 103 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Kudos, SonarCloud Quality Gate passed! |
@@ -47,6 +47,7 @@ | |||
import lombok.*; | |||
import lombok.experimental.Accessors; | |||
import org.hisp.dhis.feedback.ErrorCode; | |||
import org.hisp.dhis.tracker.imports.validation.ValidationCode; |
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.
not related to your changes but there are some wildcard imports in this file. maybe can clean up later.
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.*; |
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.
wildcard import
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.
Good catch, I have not done all my setup after reinstalling recently. I make a fix PR
JobConfiguration obj = jobConfigurationService.getJobConfigurationByUid(uid.getValue()); | ||
if (obj == null) throw new NotFoundException(JobConfiguration.class, uid.getValue()); | ||
boolean canCancel = | ||
currentUser.isSuper() |
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.
this is just a micro thing but maybe worth to note that User.isSuper()
is a heavy operation, maybe better to make it the last condition.
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.
I keep that in mind, also it is surprising to me.
Summary
Adjustments to the job progress error tracking for tracker import jobs.
This does add error transfer from the
ValidationReport
to the job progress errors.Since two different enums are used as source of error codes,
ErrorCode
andValidationCode
the job progress API gotaddError
methods which accept one or the other. Internally the code is then stored asString
.A client can distinguish the codes based on the added
codes
property to the root object of/api/jobConfigurations/errors
.The value can be understood as a sort of namespace or part of a translation key root or path segment.
The input that caused an error can now be included using
includeInput
flag parameter, for example:/api/jobConfigurations/errors?includeInput=true
The tracker input file storage format changed from binary (java serialisation) to JSON so it can be included in the JSON as described above.
The tracker
Error
created from a validation error now included the plain argument list as this is needed when transferring errors to the job progress error tracking which does not store the message but adds it on the fly for API requests based on the error code and the args.Automatic Testing
Existing tests got adjusted, mostly to provide the args list.
A new test scenario was added that runs a tracker import with error and checks the error endpoint with the
includeInput
to verify both that tracker errors are transferred and that the input inclusion works.Manual Testing
/api/tracker?async=true
with a JSON payload with errors, for exampleapi/jobConfigurations/gist?filter=jobType:eq:TRACKER_IMPORT_JOB&order=created:desc
api/jobConfigurations/errors?includeInput=true
has an entry for the job and also includes the input JSON asinput
(note that this is not 1:1 of the original JSON send but a JSON for a intermediate format based onTrackerObjects
type)