Skip to content

Bau: Stop setting metadata on audit context in Mfa Methods Put Handler#8404

Merged
BeckaL merged 14 commits into
mainfrom
BAU/no-metadata-in-audit-context
Jun 2, 2026
Merged

Bau: Stop setting metadata on audit context in Mfa Methods Put Handler#8404
BeckaL merged 14 commits into
mainfrom
BAU/no-metadata-in-audit-context

Conversation

@BeckaL
Copy link
Copy Markdown
Contributor

@BeckaL BeckaL commented Jun 1, 2026

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

  1. Code Review commit by commit - I've done this refactor very incrementally so it should be easy to see what's going on when going through each commit individually.

BeckaL added 14 commits June 1, 2026 13:51
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 BeckaL requested review from a team as code owners June 1, 2026 14:32
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 1, 2026

@BeckaL BeckaL added this pull request to the merge queue Jun 2, 2026
Merged via the queue into main with commit 2bade4a Jun 2, 2026
19 checks passed
@BeckaL BeckaL deleted the BAU/no-metadata-in-audit-context branch June 2, 2026 08:26
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.

2 participants