TripalCultivate / TripalCultivate-Phenotypes

Provides generic support for large scale phenotypic data and traits with importers, content pages and visualizations.
GNU General Public License v3.0
1 stars 0 forks source link

[Bug] When first file passes validation, subsequent uploads without page refresh do not trigger errors. #60

Closed laceysanderson closed 6 months ago

laceysanderson commented 11 months ago

Drupal Version

10.1

Tripal Version

4.x dev (most recent commit)

Module Version

4.x dev (most recent commit)

Site Operating System

Debian Linux

Installation Method

TripalDocker docker

Browsers

Firefox

Observations

I tested the Pheno Share importer within the same page session due in part to laziness and in part since this is how a curator might function (import file, get error, immediately import another fixed file into the same form). However, I started with a file that did pass validation and then followed up with one that should not. In this case, the second file did not show validation error!

This was not enough to stop the PR I was reviewing since the order is not what you would expect from a user... but it should be addressed as it can happen in this order if a user passes validation and then sees traits they didn't expect in the next step of the form and wants to re-upload the newest version.

Expected Behaviour

I expected to see the same error message in these two cases:

  1. Upload a file failing validation from a fresh page reload
  2. Upload the same file failing validation but immediately after one already passed.

Steps to Reproduce

  1. Create a fresh docker (including the code in PR #50 if it's not yet merged).
  2. Create an organism
  3. Create a Project
  4. Configure the ontologies for the organism here: http://localhost/admin/tripal/extension/tripal-cultivate/phenotypes/ontology
  5. Use drush php:cli to associate the organism with the project
    \Drupal::service('trpcultivate_phenotypes.genus_project')
    ->setGenusToProject(PROJECT ID, 'GENUS', TRUE);
  6. Navigate to the Pheno Share importer: http://localhost/admin/tripal/loaders/trpcultivate-phenotypes-share (you may need to clear the cache if you get page not found)
  7. Upload a file that we know will pass validation (e.g. valid-not-empty-readable-alt.txt)
  8. Confirm that it passes validation as expected.
  9. Now immediately (without refreshing the page, simple scroll up and open the Stage 1 again) upload a file you expect to fail validation (e.g. not-valid-file-size-zero.txt)
  10. Confirm that it still passes validation and pushes you to the next stage 😬
  11. Now, prove to yourself that the file you expected to fail really does by REFRESHING THE PAGE before uploading the same file used in step 9. Note that now the validation fails as expected.

Relevant log output

No response

laceysanderson commented 11 months ago

I noticed the same thing with the column header validation in #48. As such this is more to do with the form itself and independent of the validator plugin. To fix you likely need ajax on the file upload field that resets the validation when a new file is uploaded.

reynoldtan commented 11 months ago

Bug confirmed and reproducible.