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

BCDA-7480: Update errors returned from import-cclf #885

Merged
merged 6 commits into from
Nov 22, 2023

Conversation

laurenkrugen-navapbc
Copy link
Contributor

@laurenkrugen-navapbc laurenkrugen-navapbc commented Nov 20, 2023

🎫 Ticket

https://jira.cms.gov/browse/BCDA-7480

🛠 Changes

Updating import-cclf command to return an error when at least one file has failed to be imported or a file has been skipped, or if the successfully imported file count is 0.

Smoke tests are failing because the suppression files get added to the skipped count, if they exist in the directory. Since we don't want false positives, a check has been added to see if the file we are currently importing is an opt out file. If it is, we ignore it altogether and don't increment the count of the files skipped.

ℹ️ Context for reviewers

Smoke tests in dev are failing because opt-out files are being added to the skipped count, which causes the synthetic EFT import to fail.

✅ Acceptance Validation

modified tests that import cclf files to also check for opt out files and not add to skipped count.

🔒 Security Implications

  • This PR adds a new software dependency or dependencies.
  • This PR modifies or invalidates one or more of our security controls.
  • This PR stores or transmits data that was not stored or transmitted before.
  • This PR requires additional review of its security implications for other reasons.

If any security implications apply, add Jason Ashbaugh (GitHub username: StewGoin) as a reviewer and do not merge this PR without his approval.

@@ -119,6 +128,15 @@ func (p *processor) handleArchiveError(path string, info os.FileInfo, cause erro
return err
}

func isOptOut(filename string) (isOptOut bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this based on an existing function/regex? Just wondering if the CCLF and opt out importers can share the same utility function in case we ever need to change them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah - I pulled the regex out of this file, but can create an exported util function that both can use! I'll update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK - this has now been moved to the utils.go file used by optout to reduce repetitive code. 🎉

@@ -368,7 +368,7 @@ func setUpApp() *cli.App {
return err

}
if failure > 0 || skipped > 0 {
if failure > 0 || skipped > 0 || success == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this cause an error / alert if no files were available for import?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this will cause an alert if no files were successfully imported. There is another piece of logic that will catch an error if we've walked the contents of the directory and have no files that can be imported. I added this because when I was reviewing the logs and the output during the CCLF incident, I did see an instance of 0 files being imported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per our conversation during office hours, this success statement may be a bit too aggressive; removed it!

@codecov-commenter
Copy link

Codecov Report

Merging #885 (c45d2da) into master (e83513f) will increase coverage by 0.13%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #885      +/-   ##
==========================================
+ Coverage   79.20%   79.34%   +0.13%     
==========================================
  Files          93       93              
  Lines       10600    10611      +11     
==========================================
+ Hits         8396     8419      +23     
+ Misses       1663     1654       -9     
+ Partials      541      538       -3     
Files Coverage Δ
bcda/cclf/fileprocessor.go 86.45% <100.00%> (+0.51%) ⬆️
optout/utils.go 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e83513f...c45d2da. Read the comment docs.

Copy link
Contributor

@kyeah kyeah left a comment

Choose a reason for hiding this comment

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

nice!

@laurenkrugen-navapbc laurenkrugen-navapbc merged commit 99cc417 into master Nov 22, 2023
1 check passed
@laurenkrugen-navapbc laurenkrugen-navapbc deleted the lauren/BCDA-7480-import-returns branch November 22, 2023 15:27
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