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

N°7216 import improves error handling missing or null data #612

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

accognet
Copy link
Contributor

internal

@accognet accognet added the bug Something isn't working label Feb 12, 2024
@accognet accognet self-assigned this Feb 12, 2024
@Molkobain Molkobain added the internal Work made by Combodo label Feb 12, 2024
@accognet accognet changed the base branch from develop to support/3.2 February 13, 2024 09:23
@accognet accognet changed the title Feature/7216 import improves error handling missing or null data N°7216 import improves error handling missing or null data Feb 27, 2024
@Hipska
Copy link
Contributor

Hipska commented Feb 28, 2024

Also,

IMPORTANT: Please follow the guidelines within this PR template before submitting it, it will greatly help us process your PR. 🙏
Any PRs not following the guidelines or with missing information will not be considered.

@rquetiez rquetiez self-requested a review June 7, 2024 12:03
@rquetiez
Copy link
Contributor

rquetiez commented Jun 7, 2024

Tests are missing. We've prototyped some tests in BulkChangeTest and it proved that the currrent implementation does handle only specific cases.

The following concerns have to be discussed and decided by Product Owers:

  1. What if a row has more cells than the first one? Currently, this is ignored. Should this be considered as an error too?
  2. The current implementation aims at raising errors when cells are missing. An alternative could be to consider those missing cells as the equivalent of . That option can be implemented in the CSV parser and that would involve less cases to test.

@Molkobain
Copy link
Contributor

Functional review: We rather have a clear error telling that the data are missing columns at line X.

@Molkobain Molkobain added this to the 3.3.0 milestone Jul 10, 2024
@Hipska
Copy link
Contributor

Hipska commented Jul 10, 2024

Yesterday, I stumbled across this very same problem. I didn't know a PR existed for it already because of the lack of a proper description. (Looking at you Anne-Catherine 😉)

What will be the new situation with this PR if a row doesn't have the same number of columns?

@Molkobain
Copy link
Contributor

PR still have to be reworked, but the goal is that in case of a missing column in a line of your CSV, a clear error messgae will be displayed saying that a column is missing on line X. That way you wan fix the CSV data.

What do you think?

@Hipska
Copy link
Contributor

Hipska commented Jul 10, 2024

I agree, but what is the current behaviour with this PR?

@Molkobain
Copy link
Contributor

I don't know, I think it displays an error, but I'll let @accognet answer.

@Hipska
Copy link
Contributor

Hipska commented Jul 10, 2024

So why dit the functional team wrote this?

Functional review: We rather have a clear error telling that the data are missing columns at line X.

So, there must be some knowledge of what the current error would tell?

@accognet accognet changed the base branch from support/3.2 to support/3.2-beta July 10, 2024 15:07
@accognet accognet changed the base branch from support/3.2-beta to support/3.2 July 10, 2024 15:07
@accognet
Copy link
Contributor Author

The current behaviour of this PR is:
If the number of columns in a row is not as expected, the import fails with a message like "Issue: Not the expected number of fields (current : 4 fields, expected :5)"

In functional review, we discussed the correct behavior in case of a missing column. Romain was convinced that we had changed the initial behavior of this PR during the technical review. And it wasn't. This explains Molkobain's confusing comment.

@Hipska
Copy link
Contributor

Hipska commented Jul 10, 2024

Thanks, can you also put a screenshot of that error message please?

@accognet
Copy link
Contributor Author

image

Copy link
Contributor

@Hipska Hipska left a comment

Choose a reason for hiding this comment

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

Thanks! I was already suspecting it would be clear on which line the error occurs, this screenshot proves it.

dictionaries/en.dictionary.itop.ui.php Outdated Show resolved Hide resolved
core/bulkchange.class.inc.php Outdated Show resolved Hide resolved
@Hipska
Copy link
Contributor

Hipska commented Jul 11, 2024

Does it also work if a row has too many fields?

@accognet
Copy link
Contributor Author

Yes, it's the same behavior

@accognet accognet changed the base branch from support/3.2 to develop September 27, 2024 13:26
@accognet accognet force-pushed the feature/7216-Import_improves_error_handling_missing_or_null_data branch from 7cd16d3 to 9580e13 Compare September 27, 2024 15:25
@rquetiez
Copy link
Contributor

rquetiez commented Oct 8, 2024

Tests are being reworked:

  • regresssion on html escaping
  • incomprehensible test option bSetId

Then we'll have to check the coverage.

@rquetiez
Copy link
Contributor

Review of the tests still ongoing:

  • The existing test mechanism is confusing and will be improved to facilitate the reading of test cases (automatic replacement of the column 'id' with a real server id only if the column 'id' is given in the test case, and at the given -dehardcoded- position)
  • 11, 12 and 13 tests cases to be highly simplified to focus on what is being tested
  • Error response not meeting typographic rules: a column ":" must not be preceeded by a space and must be followed by a space

A new review of the tests (and implementation) will be performed then.

@rquetiez
Copy link
Contributor

Review still ongoing:

  • Tests are ok
  • Error label reviewed ("column" prefered to "field"), dictionaries are being updated
  • The change in ajax.csvimport.php has not been explained: what is the improved behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal Work made by Combodo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants