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

2695 field spaces #2704

Merged
merged 26 commits into from
Nov 6, 2023
Merged

2695 field spaces #2704

merged 26 commits into from
Nov 6, 2023

Conversation

elipe17
Copy link

@elipe17 elipe17 commented Sep 15, 2023

Summary of Changes

How to Test

cd tdrs-frontend && docker-compose up
cd tdrs-backend && docker-compose up
  • Log in as user who can submit datafiles
  • Submit tanf_section1_blanks.txt and verify all records parse and there are no ParserErrors

Deliverables

More details on how deliverables herein are assessed included here.

Deliverable 1: Accepted Features

Checklist of ACs:

  • relevant T1 data elements with spaces as values are not flagged as cat 2 (out-of-range) errors
  • relevant T2 data elements with spaces as values are not flagged as cat 2 (out-of-range) errors
  • relevant T3 data elements with spaces as values are not flagged as cat 2 (out-of-range) errors
  • Testing Checklist has been run and all tests pass
  • lfrohlich and/or adpennington confirmed that ACs are met.

Deliverable 2: Tested Code

  • Are all areas of code introduced in this PR meaningfully tested?
    • If this PR introduces backend code changes, are they meaningfully tested?
    • If this PR introduces frontend code changes, are they meaningfully tested?
  • Are code coverage minimums met?
    • Frontend coverage: [insert coverage %] (see CodeCov Report comment in PR)
    • Backend coverage: [insert coverage %] (see CodeCov Report comment in PR)

Deliverable 3: Properly Styled Code

  • Are backend code style checks passing on CircleCI?
  • Are frontend code style checks passing on CircleCI?
  • Are code maintainability principles being followed?

Deliverable 4: Accessible

  • Does this PR complete the epic?
  • Are links included to any other gov-approved PRs associated with epic?
  • Does PR include documentation for Raft's a11y review?
  • Did automated and manual testing with iamjolly and ttran-hub using Accessibility Insights reveal any errors introduced in this PR?

Deliverable 5: Deployed

  • Was the code successfully deployed via automated CircleCI process to development on Cloud.gov?

Deliverable 6: Documented

  • Does this PR provide background for why coding decisions were made?
  • If this PR introduces backend code, is that code easy to understand and sufficiently documented, both inline and overall?
  • If this PR introduces frontend code, is that code easy to understand and sufficiently documented, both inline and overall?
  • If this PR introduces dependencies, are their licenses documented?
  • Can reviewer explain and take ownership of these elements presented in this code review?

Deliverable 7: Secure

  • Does the OWASP Scan pass on CircleCI?
  • Do manual code review and manual testing detect any new security issues?
  • If new issues detected, is investigation and/or remediation plan documented?

Deliverable 8: User Research

Research product(s) clearly articulate(s):

  • the purpose of the research
  • methods used to conduct the research
  • who participated in the research
  • what was tested and how
  • impact of research on TDP
  • (if applicable) final design mockups produced for TDP development

@elipe17 elipe17 self-assigned this Sep 15, 2023
- Add datafile
@elipe17
Copy link
Author

elipe17 commented Sep 15, 2023

Adding patch that implements disabling validators.
disable_validators.patch

@elipe17 elipe17 changed the title Draft: 2695 field spaces 2695 field spaces Sep 21, 2023
@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Merging #2704 (9a53a06) into develop (8ec31f9) will decrease coverage by 0.56%.
Report is 53 commits behind head on develop.
The diff coverage is 91.63%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2704      +/-   ##
===========================================
- Coverage    92.99%   92.43%   -0.56%     
===========================================
  Files          219      239      +20     
  Lines         4482     5354     +872     
  Branches       385      473      +88     
===========================================
+ Hits          4168     4949     +781     
- Misses         242      312      +70     
- Partials        72       93      +21     
Flag Coverage Δ
dev-backend 92.32% <92.15%> (-0.52%) ⬇️
dev-frontend 92.95% <78.26%> (-0.65%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
tdrs-backend/tdpservice/core/logger.py 100.00% <100.00%> (ø)
tdrs-backend/tdpservice/data_files/serializers.py 100.00% <100.00%> (ø)
...rs-backend/tdpservice/data_files/test/factories.py 100.00% <100.00%> (ø)
tdrs-backend/tdpservice/data_files/validators.py 96.15% <ø> (ø)
tdrs-backend/tdpservice/data_files/views.py 90.65% <100.00%> (+0.08%) ⬆️
tdrs-backend/tdpservice/email/email.py 76.78% <100.00%> (-1.55%) ⬇️
...vice/email/helpers/account_deactivation_warning.py 100.00% <100.00%> (ø)
...backend/tdpservice/email/helpers/account_status.py 84.84% <100.00%> (ø)
tdrs-backend/tdpservice/email/helpers/data_file.py 100.00% <100.00%> (ø)
tdrs-backend/tdpservice/parsers/admin.py 100.00% <100.00%> (ø)
... and 53 more

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 7115532...9a53a06. Read the comment docs.

- Updated logic on when to run field validators
- Updated schemas
Copy link

@George-Hudson George-Hudson left a comment

Choose a reason for hiding this comment

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

lgtm though I am mostly just trying to familiarize myself.

@elipe17 elipe17 requested a review from andrew-jameson October 4, 2023 15:42
Copy link

@jtimpe jtimpe left a comment

Choose a reason for hiding this comment

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

minor conversation topic, maybe some unused code. overall looks good, thank you!

tdrs-backend/tdpservice/parsers/validators.py Outdated Show resolved Hide resolved
@@ -114,7 +114,9 @@ def run_field_validators(self, instance, generate_error):
else:
value = getattr(instance, field.name, None)

if field.required and not value_is_empty(value, field.endIndex-field.startIndex):
is_empty = value_is_empty(value, field.endIndex-field.startIndex)
Copy link

Choose a reason for hiding this comment

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

value_is_empty doesn't test for 0-filled strings, which i think is fine but worth calling out since we have other 'space'-fill operators (@ and #). the end result currently is

'000' -> 0
' ' -> None
'###' -> None
'@@@' -> None

maybe a possibility is to add 0-fills to value_is_empty so that 0 becomes None for non-required fields, but i think this could cause side effects with actual 0 values we want to preserve. moreover, i think you're currently meeting the requirements as i understand them - treat 0 as 0 but allow for space-filling as well - space filling just results in a slightly different result.

Copy link
Author

Choose a reason for hiding this comment

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

Ya I didn't think we wanted to add zero fill to the value_is_empty function since there are so many fields across the schemas that expect zero as a valid value. I will point Alex at this as well to make sure everything is good.

Copy link
Author

Choose a reason for hiding this comment

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

@ADPennington can you verify that this is the logic we want in these situations?

Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure i understand how we are using "#" and "@" but im seeing the expected behavior @elipe17 @jtimpe

Copy link
Collaborator

@andrew-jameson andrew-jameson left a comment

Choose a reason for hiding this comment

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

LGTM

@ADPennington ADPennington added Deploy with CircleCI-qasp Deploy to https://tdp-frontend-qasp.app.cloud.gov through CircleCI and removed Deploy with CircleCI-qasp Deploy to https://tdp-frontend-qasp.app.cloud.gov through CircleCI labels Oct 18, 2023
Copy link
Collaborator

@ADPennington ADPennington left a comment

Choose a reason for hiding this comment

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

lgtm! @elipe17 🚀

@reitermb can you investigate during UX research if users understand that None means a space-filled value was provided? (see below)

2695p3

@ADPennington ADPennington added Ready to Merge and removed QASP Review Deploy with CircleCI-qasp Deploy to https://tdp-frontend-qasp.app.cloud.gov through CircleCI labels Oct 20, 2023
@andrew-jameson andrew-jameson merged commit 6785277 into develop Nov 6, 2023
12 checks passed
@andrew-jameson andrew-jameson deleted the 2695-field-spaces branch November 6, 2023 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As tech lead, I need some space-filled values to be allowed in TANF Section 1 data files
6 participants