Don't pass undefined context-values to Labkit
requested to merge reprazent/gitlab-ee:bvl-application-context-dont-override-without-setting into master
What does this MR do?
Don't pass values on to labkit that weren't explicityly defined. Otherwise, labkit will unintentionally overwrite any existing values with nil.
Consider the following example:
ApplicationContext.with_context(user: <User "jane-doe">) do
ApplicationContext.with_context(
project: <Project "gitlab-org/gitlab">
) do
# The inner context lives here
end
end
We want the inner context for Labkit to contain this hash:
{
user: "jane-doe",
project: "gitlab-org/gitlab",
root_namespace: "gitlab-org"
}
But before this change, we'd overwrite the user
value with nil when creating
the inner context, even though the inner context did not contain any
information that should override the user info.
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
Edited by Bob Van Landuyt