Skip to content

Add CSV validation warnings and example CSV files#195

Open
Pranav-0440 wants to merge 5 commits intoeclipse-editdor:masterfrom
Pranav-0440:fix/csv-validation-clean
Open

Add CSV validation warnings and example CSV files#195
Pranav-0440 wants to merge 5 commits intoeclipse-editdor:masterfrom
Pranav-0440:fix/csv-validation-clean

Conversation

@Pranav-0440
Copy link
Contributor

Fixes - #134

Copilot AI review requested due to automatic review settings February 10, 2026 19:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a warning-collecting CSV parsing path and documents example CSV inputs to help users spot “wrong-but-parseable” CSV values (Issue #134).

Changes:

  • Extend parseCsv to return { data, warnings } and add basic validations for type and modbus:entity.
  • Surface CSV warnings in the CSV import flow (CreateTd) and add example valid.csv / invalid.csv files plus README.
  • Add/adjust tests for the new parse result shape and validation behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/utils/parser.ts Returns parsed CSV data plus validation warnings for select fields.
src/utils/parser.test.ts Updates tests for the new return shape and adds warning assertions.
src/components/App/CreateTd.tsx Displays CSV warnings after import (currently via error state/dialog).
src/components/Dialogs/ConvertTmDialog.tsx Large refactor unrelated to CSV import; currently introduces a TM→TD conversion regression and misleading copy.
test/csv-examples.test.ts Adds a “test” file for example CSVs, but currently contains no actual Vitest tests/assertions.
doc/examples/csv/valid.csv Adds a “known-good” CSV example.
doc/examples/csv/invalid.csv Adds an “intentionally invalid” CSV example to trigger warnings.
doc/examples/csv/README.md Documents the examples and warning expectations (currently inconsistent).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@netlify
Copy link

netlify bot commented Feb 13, 2026

Deploy Preview for editdor ready!

Name Link
🔨 Latest commit 2afb413
🔍 Latest deploy log https://app.netlify.com/projects/editdor/deploys/69a1e717588efe0008dc98a4
😎 Deploy Preview https://deploy-preview-195--editdor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@TejInaco TejInaco marked this pull request as draft February 19, 2026 16:30
@TejInaco TejInaco marked this pull request as draft February 19, 2026 16:30
@TejInaco TejInaco requested review from TejInaco February 19, 2026 16:30
@TejInaco TejInaco assigned Pranav-0440 and unassigned Pranav-0440 Feb 19, 2026
Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
@Pranav-0440 Pranav-0440 force-pushed the fix/csv-validation-clean branch from 4b0e4d0 to 2447d9f Compare February 23, 2026 17:15
Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
@Pranav-0440 Pranav-0440 marked this pull request as ready for review February 23, 2026 17:24
@Pranav-0440
Copy link
Contributor Author

I’ve cleaned up the PR to reduce unrelated diffs by resetting to origin/master and cherry-picking only the CSV validation commit. Please let me know if any further adjustments are needed.

@TejInaco TejInaco marked this pull request as draft February 24, 2026 11:14
@TejInaco
Copy link
Contributor

I’ve cleaned up the PR to reduce unrelated diffs by resetting to origin/master and cherry-picking only the CSV validation commit. Please let me know if any further adjustments are needed.

Yes, you did. But you didn't implemented the changes requested by the code reviews. Change to draft until changes are committed.

Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
@Pranav-0440
Copy link
Contributor Author

Thanks @TejInaco for marking it draft.
I’ve now implemented all requested review changes:

  • Wired hasHeaders correctly into Papa.parse
  • Removed duplicate transform option
  • Precomputed the lowercase Modbus entity list outside the loop
  • Added separate case-mismatch warning logic for modbus:entity
  • Fixed warning rendering in CreateTd
  • Removed unused warnings state from ConvertTmDialog
  • Converted csv-examples.test.ts into proper Vitest tests
  • Updated README to clarify case-insensitive validation with casing warnings

Marking the PR ready for review again. Please let me know if anything else needs adjustment.

@Pranav-0440 Pranav-0440 marked this pull request as ready for review February 24, 2026 13:38
@TejInaco
Copy link
Contributor

You still have pending reviews @Pranav-0440 to be done. Return to draft.

@TejInaco TejInaco marked this pull request as draft February 24, 2026 17:48
Copy link
Contributor Author

@Pranav-0440 Pranav-0440 left a comment

Choose a reason for hiding this comment

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

@TejInaco - All review threads have now been addressed and resolved.
Please let me know if anything further needs adjustment.

@Pranav-0440 Pranav-0440 marked this pull request as ready for review February 25, 2026 15:58
@TejInaco TejInaco marked this pull request as draft February 25, 2026 16:02
@Pranav-0440
Copy link
Contributor Author

@TejInaco Thanks for the feedback.

I’ve cleaned the branch and removed all unrelated changes (external files, documentation, and example CSV files).
The PR now only includes the CSV validation changes in:

  • src/utils/parser.ts
  • src/utils/parser.test.ts
  • src/components/App/CreateTd.tsx

Please let me know if any further adjustments are needed.

@Pranav-0440 Pranav-0440 marked this pull request as ready for review February 26, 2026 13:18
Copy link
Contributor

@TejInaco TejInaco left a comment

Choose a reason for hiding this comment

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

I didn't say to remove those files. Do a test folder inside utils to have your example of valid csv and invalid csv. Add more test to read from these files and try to find more edge cases on unit test. Mark the pending reviews as soon as you read them

@@ -1,17 +1,31 @@
/********************************************************************************
* Copyright (c) 2025 Contributors to the Eclipse Foundation
*
Copy link
Contributor

Choose a reason for hiding this comment

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

Copyright is not to be deleted. Revert these changes

@TejInaco TejInaco marked this pull request as draft February 27, 2026 12:23
…tures

Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
@Pranav-0440 Pranav-0440 force-pushed the fix/csv-validation-clean branch from d2ddea5 to 2afb413 Compare February 27, 2026 18:48
@Pranav-0440
Copy link
Contributor Author

@TejInaco I restored the original license header and reverted unrelated changes.
The CSV fixtures are now placed under src/utils/test/fixtures and the tests have been updated to read from them. Additional edge cases were added and all tests are passing locally. Please let me know if further adjustments are needed.

@Pranav-0440 Pranav-0440 marked this pull request as ready for review February 27, 2026 18:50
@Pranav-0440
Copy link
Contributor Author

Manual UI verification:

  1. valid.csv loads successfully without warnings.
{0CA5D8B8-26AD-41BA-BDF4-FB9AB3BA94F1}
  1. invalid.csv displays aggregated validation warnings (invalid type, invalid modbus entity, and casing issues).
{4FAD7458-EF17-4CAF-A53B-D06790219627}
  1. TD properties are still created correctly.

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