Skip to content

Don't pass undefined context-values to Labkit

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

Availability and Testing

Edited by Bob Van Landuyt

Merge request reports