Skip to content

_project.set_local_config sets incorrect local_config_uri for GCM-enabled projects #107

@himi

Description

@himi

In ELM Python Client, the method set_local_config incorrectly selects the last matching contribution
from get_gc_contributions instead of the first one.
For GCM-enabled projects, this can result in returning the wrong local_config_uri.

Steps to Reproduce

  1. Have a project with a Global Configuration (GCM) and multiple contributions for the same project/component.
  2. Call:
set_local_config(name_or_uri, global_config_uri=...)
  1. Observe that the returned local_config_uri corresponds to the last contribution in the flatList, not the first.

Expected Behavior

According to the official GC SDK documentation, the flatList returned by
flatListOfContributionsForGcHierarchy is depth-first ordered.
The first matching contribution should be used as it respects the "child overwrites parent" rule.

Actual Behavior

The last matching contribution is selected, which may be incorrect.

Proposed Fix

In set_local_config, break immediately after the first match:

for config in gc_contribs['configurations']:
    if config['componentUri'] == self.project_uri:
        config_uri = config['configurationUri']
        break  # first match is correct according to GC SDK

This ensures the local_config_uri is correctly selected according to the official ordering.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions