Skip to content

Conversation

@svillegas-cdd
Copy link
Contributor

@svillegas-cdd svillegas-cdd commented Jul 7, 2025

  • Implement preprocessing for required fields in CSV parsing
  • Improve error handling for CSV row data conversion

Ref: https://app.shortcut.com/cordada/story/15534/

@svillegas-cdd svillegas-cdd self-assigned this Jul 7, 2025
@svillegas-cdd svillegas-cdd requested a review from a team as a code owner July 7, 2025 16:38
@svillegas-cdd svillegas-cdd added enhancement New feature or request component: rcv labels Jul 7, 2025

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Jul 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.82%. Comparing base (d627525) to head (4d74644).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #838      +/-   ##
===========================================
+ Coverage    87.43%   87.82%   +0.38%     
===========================================
  Files           38       38              
  Lines         3176     3187      +11     
  Branches       321      323       +2     
===========================================
+ Hits          2777     2799      +22     
+ Misses         257      249       -8     
+ Partials       142      139       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@svillegas-cdd svillegas-cdd force-pushed the task/sc-15534-improve-rcv-parsing-error branch 2 times, most recently from ed1661b to a4afa22 Compare July 7, 2025 17:00
- Implement preprocessing for required fields in CSV parsing
- Improve error handling for CSV row data conversion

Ref: https://app.shortcut.com/cordada/story/15534/
@svillegas-cdd svillegas-cdd force-pushed the task/sc-15534-improve-rcv-parsing-error branch from a4afa22 to 4d74644 Compare July 7, 2025 17:01
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 7, 2025

@svillegas-cdd svillegas-cdd changed the title rcv: Implement preprocessing for required fields in CSV parsing feat(rcv): Improve CSV parsing preprocessing and logging Jul 7, 2025
@svillegas-cdd svillegas-cdd changed the title feat(rcv): Improve CSV parsing preprocessing and logging rcv: Improve CSV parsing preprocessing and logging Jul 7, 2025
@svillegas-cdd svillegas-cdd requested a review from Copilot July 7, 2025 17:09
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

This PR enhances CSV parsing by stripping out empty required fields before schema validation and improving error handling/logging for row conversion failures.

  • Introduces a preprocess hook to remove empty or null required fields prior to validation.
  • Refactors conversion exception logging to include row index and renames the error key to conversion_errors.
  • Adds unit tests and a CSV fixture to verify missing required fields and conversion errors in the “venta” parser.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/tests/test_rcv_parse_csv.py Added tests for missing required fields and conversion error scenarios in parse_rcv_venta_csv_file.
src/tests/test_data/sii-rcv/RCV-venta-missing-required-fields.csv New CSV fixture with intentionally empty required fields for testing preprocessing logic.
src/cl_sii/rcv/parse_csv.py Implemented preprocess to strip empty required fields and improved conversion error logging and error-key naming.
Comments suppressed due to low confidence (2)

src/cl_sii/rcv/parse_csv.py:1201

  • [nitpick] The key 'conversion_errors' is plural but holds a single error string; consider renaming it to 'conversion_error' or storing a list of errors to match the plural form.
                row_errors['conversion_errors'] = conversion_error

src/tests/test_rcv_parse_csv.py:157

  • This test is currently a stub and does not validate any behavior; consider implementing tests for missing required fields and conversion errors in the 'compra' CSV parsing to match the coverage added for 'venta'.
    def test_parse_rcv_compra_registro_csv_file(self) -> None:

@svillegas-cdd svillegas-cdd merged commit 636ab25 into develop Jul 7, 2025
21 checks passed
@svillegas-cdd svillegas-cdd deleted the task/sc-15534-improve-rcv-parsing-error branch July 7, 2025 17:43
@svillegas-cdd svillegas-cdd mentioned this pull request Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: rcv enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants