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

Add support for validation of XML submission files #2437

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sbelsk
Copy link
Collaborator

@sbelsk sbelsk commented Sep 10, 2024

This is a follow up to the submission XML schemas along with the validation artisan command (see #2335) that were recently introduced. The changes in this PR add the option to use this validation process on incoming submission files, although this option is disabled by default.
A test has been added to verify these changes, and the docs have been updated to reflect the new configuration option.

@sbelsk sbelsk added this to the v3.6 milestone Sep 10, 2024
@sbelsk sbelsk force-pushed the submission-xml-files-validation branch 3 times, most recently from 6a60f38 to c5431c2 Compare September 10, 2024 17:36
@josephsnyder josephsnyder self-assigned this Sep 23, 2024
@josephsnyder josephsnyder force-pushed the submission-xml-files-validation branch from d94a42b to 4602d25 Compare October 9, 2024 16:58
@williamjallen williamjallen modified the milestones: v3.6, v3.7 Oct 15, 2024
@williamjallen
Copy link
Collaborator

Moving this to the 3.7 release since it isn't quite finished.

Copy link
Collaborator

@williamjallen williamjallen left a comment

Choose a reason for hiding this comment

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

After digging into the submission handler logic a bit more, I am no longer certain that this is the correct approach. Instead of validating the XML files when submissions are processed, I think it would be better to validate them at submission time. This approach was initially rejected due to the hypothesis that doing so would slow down submission acceptance. After gaining a better understanding of the code, I am reasonably confident that doing this validation at submission time will have a negligible performance impact.

The main benefit of doing this validation at submission time is that error messages will always be returned to the client, regardless of the queueing system used.

@williamjallen williamjallen marked this pull request as draft November 15, 2024 21:52
@josephsnyder josephsnyder force-pushed the submission-xml-files-validation branch 3 times, most recently from b707518 to f02158b Compare November 19, 2024 21:11
sbelsk and others added 5 commits November 25, 2024 12:50
When attempting to validate an HTTP submission use the `storage_path` helper
to turn the filename which starts at the inproess folder, `inprocess/<>.xml`,
to a full path.  This should not affect the path given directly to the
submission:validate artisan command.
Add a test which utilizes the submission function of KWTester to
submit the same data as the manual validation steps.
@@ -128,6 +130,35 @@ private function submitProcess(): Response
} elseif (intval($this->project->Id) < 1) {
abort(Response::HTTP_NOT_FOUND, 'The requested project does not exist.');
}
if ((bool) config('cdash.validate_xml_submissions') === true) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think about running all submissions through the validator? I think it would be useful to log the result of submission validation for all submissions, and instead use the config setting to control whether mis-formatted submissions are entirely rejected or not.

Copy link
Member

Choose a reason for hiding this comment

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

I like that idea. It seems like it would be useful information about malformed submissions that aren't "rejected"

* Validate the given XML file based on its type
* @throws CDashXMLValidationException
*/
public static function validate_xml(string $xml_file, string $schema_file): void
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think about moving this to app/cdash/xml_handlers/abstract_xml_handler.php? That way, the $schema_file argument could be stored as a class member and users of this method won't need to know about the exact details of how the validation actually occurs.




class SubmissionValidationTestCase extends KWWebTestCase
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be better to make this a feature test under /tests/Feature. Getting a submission method in a feature test will require #2578 though, which of course requires us to figure out what is causing errors on your system. What do you think about delaying this until #2578 is merged and then converting this to a feature test which uses the new submission method?

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

Successfully merging this pull request may close these issues.

3 participants