Closed hminsky2002 closed 7 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 87.50%. Comparing base (
a001236
) to head (8047724
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I'll give a review of the actual code soon but in the shorter term some meta changes requested:
Each commit should be self-contained and result in a "correct" state -- so the refactored tests should be added as the changes are made (they are part of the change, and actually serve as contextual documentation of the change because they communicate what you changed and how those changes change expectations of API behavior!)
It looks like there isn't much test coverage for the validation functions; could you add more so that there is 100% coverage?
Thanks for bearing with all the iteration!
This looks really great, well done!
Woooo!
@hminsky2002 @slifty I think the same principles for database schema migrations apply to database seed scripts. In other words, I don't think we should modify existing seed scripts but rather append new scripts that assume the previous ones ran. For example, in production we have run several more seed scripts that did not make it into the main branch for one reason or another, see #305. It looks like the ball might be in my court to respond to Jason's objections, though. Of course, another option is to start over with base fields seeds, and that might be preferred. In that case, we should delete all the data in the production database and create a new seed script and run it in prod.
@bickelj I am comfortable with that approach but also wanted to note... I think we should ditch the seed scripts entirely, and instead lean into #756
This PR introduces basic data validation for uploaded proposal fields. It modifies the base_fields and proposal_field_values tables in the database and related types in the service layer to accommodate
Validation is performed by a helper function, fieldValueIsValid, which uses regexes, though a more developed validation system will likely be necessary as we account for more complicated types.
Testing:
Resolves #760