microsoft / microsoft/azure-devops-python-api

Client Returns undefined while checking get_feature_state_for_scope for new project

Open
#482 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
684
Forks
218
Avg merge
8d 10h
Merged PRs (30d)
1

Description

Hello Team,

I am using python API to check if there are some features enabled/disbaled at Project level e.g Repo's and Pipeline's.

Issue is that when a Private Project is created, everything is enabled by default. When I check the state for such projects it returns undefined

Below is the sample code and results:

    feature_client = connection.clients_v7_0.get_feature_management_client()
    repo: ContributedFeatureState = feature_client.get_feature_state_for_scope(feature_id='ms.vss-code.version-control', user_scope='host', scope_name='project', scope_value='<PROJECT_ID/NAME>')
    pipeline: ContributedFeatureState = feature_client.get_feature_state_for_scope(feature_id='ms.vss-build.pipelines', user_scope='host', scope_name='project', scope_value='<PROJECT_ID/NAME>')
    print(repo)
    print(pipeline)

Results:

{
    'additional_properties': {}, 
    'feature_id': 'ms.vss-code.version-control', 
    'overridden': None, 
    'reason': None, 
    'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x10f2c2580>, 
    'state': 'undefined'
}

{
    'additional_properties': {}, 
    'feature_id': 'ms.vss-build.pipelines', 
    'overridden': None, 
    'reason': None, 
    'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x10f2c2af0>,
    'state': 'undefined'
}

When I manually disable these features at Project level then it is able to identify them:

Disabled:

{
    'additional_properties': {}, 
    'feature_id': 'ms.vss-code.version-control', 
    'overridden': None, 
    'reason': None, 
    'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x1019d4580>, 
    'state': 'disabled'
}

{
    'additional_properties': {}, 
    'feature_id': 'ms.vss-build.pipelines', 
    'overridden': None, 
    'reason': None, 
    'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x1019d4af0>, 
    'state': 'disabled'
}

enabled back again:

{
    'additional_properties': {}, 
    'feature_id': 'ms.vss-code.version-control',
    'overridden': None, 
    'reason': None, 
    'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x1050d4580>, 
    'state': 'enabled'
}
{
    'additional_properties': {}, 
    'feature_id': 'ms.vss-build.pipelines', 
    'overridden': None, 
    'reason': None, 
    'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x1050d4af0>, 
    'state': 'enabled'
}

Can you please guide on this, shall we assume that if it is undefined it is enabled

Best
Jashan

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Python feature-management client and the get_feature_state_for_scope call shown in the issue, then compare its undefined response with the documented Azure DevOps feature-state behavior. Determine whether undefined is an expected inherited state or a client/API defect; done means documenting the behavior or identifying a reproducible change needed to return the correct state.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.