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

Deprecate Validators #3383

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

Deprecate Validators #3383

wants to merge 18 commits into from

Conversation

elipe17
Copy link

@elipe17 elipe17 commented Dec 18, 2024

Summary of Changes

  • Added capability to deprecate cat 1-4 errors
  • Deprecated specific cat4 errors as called out in the ticket
  • Added migration for new deprecated flag
  • Updated all validators to return whether they're deprecated or not
  • Don't include deprecated error in case aggregates/total aggregates calculations
    Pull request closes Deprecate Cat 4 validation checks for case closure #3342

How to Test

cd tdrs-frontend && docker-compose up
cd tdrs-backend && docker-compose up
  1. Open http://localhost:3000/ and sign in.
  2. Submit files that introduce parser errors for the validators in the ACs.
  3. Verify that cases with those errors are still serialized to the DB
  4. Play around with the new deprecate_validator decorator and deprecate_call function. Validators encapsulated in these functions should not add errors to the error report or effect case aggregates/total aggregates

Deliverables

More details on how deliverables herein are assessed included here.

Deliverable 1: Accepted Features

Checklist of ACs:

  • __validate_case_closure_employment() deprecated
  • __validate_case_closure_ftl() deprecated
  • __validate_t5_atd_and_ssi() deprecated
  • Testing Checklist has been run and all tests pass
  • README is updated, if necessary

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

- deprecated cat4 validators, add deprecation warning message
- added migration
@elipe17 elipe17 self-assigned this Dec 18, 2024
- Updated row schema to collect the deprecated flag from the validators and create the parser error with it
- Updated error generators to use deprecated flag in util.py
- update cat3 validators to leverage deprecated flag
- add inline and decorator versions of validator deprecators
- removed prints from reparse
- Add tests for deprecation functions
@elipe17 elipe17 changed the title - Added deprecated flag to parser error model Deprecate Validators Dec 19, 2024
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 98.63014% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.51%. Comparing base (62fde87) to head (2be3cf2).
Report is 8 commits behind head on develop.

Files with missing lines Patch % Lines
...backend/tdpservice/parsers/validators/category1.py 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3383      +/-   ##
===========================================
+ Coverage    91.48%   91.51%   +0.02%     
===========================================
  Files          299      300       +1     
  Lines         8595     8624      +29     
  Branches       636      636              
===========================================
+ Hits          7863     7892      +29     
  Misses         615      615              
  Partials       117      117              
Flag Coverage Δ
dev-backend 91.35% <98.63%> (+0.03%) ⬆️
dev-frontend 92.65% <ø> (ø)

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

Files with missing lines Coverage Δ
tdrs-backend/tdpservice/data_files/views.py 88.88% <100.00%> (ø)
tdrs-backend/tdpservice/parsers/aggregates.py 98.03% <100.00%> (+0.03%) ⬆️
...d/tdpservice/parsers/case_consistency_validator.py 96.65% <100.00%> (+0.05%) ⬆️
.../parsers/migrations/0012_parsererror_deprecated.py 100.00% <100.00%> (ø)
tdrs-backend/tdpservice/parsers/models.py 76.92% <100.00%> (+0.29%) ⬆️
tdrs-backend/tdpservice/parsers/parse.py 82.69% <100.00%> (ø)
tdrs-backend/tdpservice/parsers/row_schema.py 96.58% <100.00%> (ø)
tdrs-backend/tdpservice/parsers/util.py 93.91% <100.00%> (ø)
...backend/tdpservice/parsers/validators/category3.py 97.70% <100.00%> (ø)
tdrs-backend/tdpservice/parsers/validators/util.py 100.00% <100.00%> (ø)
... and 2 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 62fde87...2be3cf2. Read the comment docs.

@elipe17 elipe17 added backend dev raft review This issue is ready for raft review labels Dec 19, 2024
@elipe17 elipe17 marked this pull request as ready for review December 19, 2024 17:39
return wrapper


def deprecate_call(validator):
Copy link
Author

Choose a reason for hiding this comment

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

I realized after OH 12/20/24 why this had to be a function/decorator as opposed to passing deprecated=True in the kwargs of the validators. The reason is because we need to modify the return value of the validator function where as the kwargs are intended to manipulate the input of the validator function. I can't see a way to get around that for the time being, but open to other suggestions! Or, if im missing something and it can be done with kwargs i'd love to pair on it!

Copy link
Author

Choose a reason for hiding this comment

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

We also will not be able to deduce the validators true name because it has already been invoked and returns the function named validator from the make_validator function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend dev raft review This issue is ready for raft review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate Cat 4 validation checks for case closure
1 participant