Skip to content

LG-14028 | Model DMV maintenance windows in code#11142

Merged
n1zyy merged 12 commits intomainfrom
mattw/LG-14028_aamva_maintenance_windows
Aug 27, 2024
Merged

LG-14028 | Model DMV maintenance windows in code#11142
n1zyy merged 12 commits intomainfrom
mattw/LG-14028_aamva_maintenance_windows

Conversation

@n1zyy
Copy link
Contributor

@n1zyy n1zyy commented Aug 22, 2024

🎫 Ticket

Link to the relevant ticket:
LG-14028

🛠 Summary of changes

Many DMVs (or (insert other name for state entitities represented by AAMVA)) have recurring maintenance windows overnight. Most nights we get a bunch of alerts about high volumes of proofing errors.

We should not trigger an alert if we cannot reach a state during a known maintenance window. That will require an update to identity-devops to take effect.

Note that many of these maintenance windows are very broad and don't necessarily represent a guaranteed outage. It would be nice to eventually be smarter and not try to proof with AAMVA if we know there's an outage, but I think the data we have is too open-ended right now. This current PR is solely about allowing us to tweak our alerts, but there is potential room for doing something more advanced down the road.

📝 Still to do

  • Update the alert in identity-devops
  • Update the tests to actually assert the change in the analytics event

Model known maintenance windows in code, so that we can set alerts
to not fire if they're unreachable during a maintenance window.

changelog: Internal, Alerting, Model DMV maintenance windows in code
faraday (~> 2)
faraday-retry
foundation_emails
fugit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fugit is a dependency of goodjob, but make it a first-class citizen now that we're explicitly using it.


module Idv
class AamvaStateMaintenanceWindow
MAINTENANCE_WINDOWS = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See discussion in this Slack thread -- I initially had these in application.yml, but we decided they made sense in code. They will be changed very infrequently, and a deploy would have been needed anyway to update them.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should verify this assertion by tracking how often this file gets changed in the month or two after deploying it. If we have to edit them multiple times in a month, I think that's a little bit of evidence that they might be better off in config than in source code.

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 like that approach.

Realistically, these are currently from a doc from 2023 so I suspect it will not be changed often, unless we decide to move to modeling actual observed downtime vs. planned, recurring maintenance windows.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, what will trigger an update here is getting a new user guide from AAMVA, which doesn't happen all that often (as @n1zyy said, current one is from 2023, and the rev log in there says that they had 3 updates in 2022)

@n1zyy n1zyy requested a review from a team August 22, 2024 22:20

def jurisdiction_in_maintenance_window?
jurisdiction_in_maintenance_window
end
Copy link
Contributor Author

@n1zyy n1zyy Aug 23, 2024

Choose a reason for hiding this comment

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

This follows the pattern, but also feels... superfluous? Opinions on just passing through the instance variable where this is used rather than adding a predicate method?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's more common to not define the attr_reader for booleans and just have the predicat method like this

so more like:

    def jurisdiction_in_maintenance_window?
      !!@jurisdiction_in_maintenance_window
    end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was pretty much my instinct, but I followed the pattern of success (lines 38-40) that set up an attr_reader and then have a predicate method that just directly returns the attr_reader value.

(I think my other instinct was to write none of this code and just make line 77 be jurisdiction_in_maintenance_window: !!@jurisidiction_in_maintenance_window.)

Copy link
Contributor

Choose a reason for hiding this comment

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

I've also used alias_method for this, though I get the impression that opinions are mixed w.r.t. aliasing.

attr_reader :user_fully_authenticated
alias_method :user_fully_authenticated?, :user_fully_authenticated

@n1zyy n1zyy marked this pull request as ready for review August 26, 2024 20:04
@n1zyy n1zyy changed the title [80%, WIP] LG-14028 | Model DMV maintenance windows in code LG-14028 | Model DMV maintenance windows in code Aug 27, 2024
@n1zyy n1zyy merged commit 7bace88 into main Aug 27, 2024
@n1zyy n1zyy deleted the mattw/LG-14028_aamva_maintenance_windows branch August 27, 2024 18:47
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.

6 participants