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

Add VerificationAttempt model to verify_student application. #35304

Merged

Conversation

MichaelRoytman
Copy link
Contributor

Description

This commits adds a VerificationAttempt model to store implementation and provider agnostic information about identity verification attempts in the platform.

Supporting information

Please see openedx/platform-roadmap#367 and [Proposal] Add Extensibility Mechanisms to IDV to Enable Integration of New IDV Vendor Persona for more details.

Testing instructions

None.

Deadline

ASAP.

@MichaelRoytman MichaelRoytman force-pushed the michaelroytman/COSMO-421-VerificationAttempt-model branch 2 times, most recently from 6a74d5d to 844e1a4 Compare August 13, 2024 13:18
Copy link
Contributor

@schenedx schenedx left a comment

Choose a reason for hiding this comment

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

👍

@MichaelRoytman MichaelRoytman requested review from a team and ormsbee August 13, 2024 15:04
@MichaelRoytman
Copy link
Contributor Author

@openedx/committers-edx-platform and @ormsbee, could you review, please? The openedx/platform-roadmap#367 ticket details the entire project. Thank you!

Copy link
Contributor

@ormsbee ormsbee left a comment

Choose a reason for hiding this comment

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

Minor comments and questions, but no major concerns. Thank you!

* The `verify_student Django application`_ will contain both concrete implementations of forms of IDV (i.e. manual, SSO,
Software Secure, etc.) and a generic, extensible implementation. The work to deprecate and remove the Software Secure
integration and to transition the other existing forms of IDV (i.e. manual and SSO) to Django plugins will occur
indepentendly of the improvements to extensibility described in this decision.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
indepentendly of the improvements to extensibility described in this decision.
independently of the improvements to extensibility described in this decision.

the platform.
"""
user = models.ForeignKey(User, db_index=True, on_delete=models.CASCADE)
name = models.CharField(blank=True, max_length=255)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is a blank name really ever okay?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It depends. Based on the current Software Secure flow, it is possible but is difficult and likely occurs seldomly. You'd have to really try to get around providing a name, likely by hitting the legacy IDV flow somehow.

The SoftwareSecurePhotoVerification instance can be created without a name if the full name isn't provided during IDV - this is the legacy view but is also true of the MFE based flow. The name is added in a subsequent mark_ready step, but profile_name is an optional field of the UserProfile model, so it can be empty.

I don't know the full history of the choice for blank=True, but my guess is that before we added the Name Affirmation feature, we only cared that the user was ID verified, and the name was secondary to that fact and was only used optionally for the purposes of a name change - it wasn't necessary to supply a name to become IDV verified. Now, you need to supply a name before IDV because of the Name Affirmation feature; although, there are ways around it.

Also, an SSOVerification can be created without a name because profile_name is an optional field. If we adopt the position that IDV is used to verify names and identities, then we could only create SSOVerifications only when the learner has a name to verify and that has been synced from the third party provider.

I don't think ManualVerification or our Persona integration will make sense without a name, but I tried to mimic the schema of the IDVerificationAttempt model here. I'm comfortable making it required based on those two verification methods, but I'm unsure about SSOVerification, and I don't know if additional implementations of IDV may require an IDV attempt without name.

If that's something we'd like to enforce, then I can make it required, but it's going to require some help from product re: SSOVerifications and will complicate process of deprecating the Software Secure integration. When deprecating the SoftwareSecurePhotoVerification model and migrating the data into VerificationAttempt, we'll have to drop any instances without a name value.

Do you have any thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I asked mostly just to check that it wasn't a simple oversight. If this were something being built from scratch, I might push to disallow blank entries here. But I'm not looking to do anything that would complicate the migration process, so blank=True it is.

null=True,
blank=True,
db_index=True,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

If your most common query is something like, "does this user have an unexpired verification?", you might want to explicitly make a composite index for that (["user", "-expiration_datetime"]). MySQL on RDS isn't always great about combining the intersection of two indexes, and can sometimes do a lot more work than it needs to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took a look at the the query patterns on the IDV tables, and they're almost always querying on the user field and then sometimes on the status field. I didn't see any examples of querying on the expiration_datetime; the rows are sorted in Python. I removed the index on that field and left the index on the user field.

I considered adding a composite index on ["user", "status"], but I wasn't sure if that the overhead of maintaining the index would be worth the benefits of the index, since the number of VerificationAttempts per learner should be relatively small. I wish I could see the query plan for MySQL with and without that index but couldn't figure out how to do that.

If you have any thoughts about an index like this, let me know. I'll merge this PR as-is, but I'm happy to put in a follow up PR to adjust the index. Thanks!

@kdmccormick kdmccormick removed the request for review from a team August 19, 2024 21:29
@MichaelRoytman MichaelRoytman force-pushed the michaelroytman/COSMO-421-VerificationAttempt-model branch from f734bde to 5a49c5d Compare August 26, 2024 14:05
This commits adds a VerificationAttempt model to store implementation and provider agnostic information about identity verification attempts in the platform.
@MichaelRoytman MichaelRoytman force-pushed the michaelroytman/COSMO-421-VerificationAttempt-model branch from 5a49c5d to b30318a Compare August 26, 2024 14:54
@MichaelRoytman MichaelRoytman merged commit e615540 into master Aug 26, 2024
49 checks passed
@MichaelRoytman MichaelRoytman deleted the michaelroytman/COSMO-421-VerificationAttempt-model branch August 26, 2024 17:37
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

zacharis278 added a commit that referenced this pull request Sep 11, 2024
…35311)

the new VerificationAttempt model (#35304) will now be taken into account when determining a user's verification status.
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.

5 participants