Bau: Stop setting metadata on audit context in Mfa Methods Put Handler#8404
Merged
Conversation
Prefer instead to pass in as varargs. A step towards switching all the methods in the put handler towards this, as a step towards deprecating metadata pairs on the audit context
Even though this test doesn't particularly need the details of the audit event submitted, doing this as a first stage before updating how the metadata pairs are populated as it will make it clearer what has changed
Prefer instead to pass in as varargs. A step towards switching all the methods in the put handler towards this, as a step towards deprecating metadata pairs on the audit context
…ntext Prefer instead to pass in as varargs. A step towards switching all the methods in the put handler towards this, as a step towards deprecating metadata pairs on the audit context
…t context Prefer instead to pass in as varargs. A step towards switching all the methods in the put handler towards this, as a step towards deprecating metadata pairs on the audit context
…context Prefer instead to pass in as varargs. A step towards switching all the methods in the put handler towards this, as a step towards deprecating metadata pairs on the audit context
The logic here is a bit more complex, so introducing this helper method will make it easier to do the refactor to remove the metadata pairs from the audit context for this event
…ntext Prefer instead to pass in as varargs. A step towards switching all the methods in the put handler towards this, as a step towards deprecating metadata pairs on the audit context
Now that we don't set metadata pairs on the audit context, this method's signature can be simplified and it can be renamed according to its only function now (setting the phone number). It can probably be inlined where it is used
We're eventually going to stop setting any metadata pairs (including the journey type) on the audit context - renaming this method to make it clear what it does before we introduce a method that no longer sets this pair on the base audit context
…t context For now, this is just called by the helper method which does set the initial metadata pair. The idea, however, is to slowly migrate all the places that construct audit contexts to using the new helper method, at which point we can decommission the old one
Prefer to pass it in as varargs. A step to removing metadata pairs from the audit context object
Readable enough when inlined
The audit context should be the same for every event emitted by the handler (with the slight exception of whether it has a phone number or not. Creating it once, and failing at an appropriate point, means that the helper method logic can be simplified and we no longer create this object every single time we submit an audit event (resulting in multiple database calls etc
|
BeckaL
commented
Jun 1, 2026
alhcomer
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Switches all events emitted in the mfa methods put handler over to pass metadata items in as varargs rather than setting them on the audit context.
This is a step towards removing the metadata items entirely from the audit context - currently it is confusing as they can be set in either place, but the audit context is supposed to contain only data that is common to all events emitted by a handler (and can just be created once per handler) rather than any event-specific metadata.
How to review