Broadening argument type for load_configuration_from_env - #552
Merged
Rodrigo Brandão (rodrigobr-msft) merged 4 commits intoAug 19, 2026
Conversation
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
August 19, 2026 22:12
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates load_configuration_from_env in the Activity library to accept broader mapping types for environment-variable parsing, aiming to improve type-safety and reduce unintended side effects when handling env var sources.
Changes:
- Broadened
env_varsparameter type fromdict[str, Any]toMapping[str, Any]. - Avoided the local name
vars(which shadows the built-invars()). - Switched from
env_vars.copy()tocopy(env_vars)to support non-dictmappings.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
August 19, 2026 22:18
View session
Rodrigo Brandão (rodrigobr-msft)
marked this pull request as ready for review
August 19, 2026 22:19
Rodrigo Brandão (rodrigobr-msft)
requested a review
from a team
as a code owner
August 19, 2026 22:19
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
libraries/microsoft-agents-activity/microsoft_agents/activity/config/_load_configuration.py:9
- The return type is still an unparameterized
dict, which limits the type-safety improvements from wideningenv_varstoMapping[str, Any]. This codebase commonly uses parameterized dict return types (e.g.,microsoft_agents/activity/channel_account.py:37returnsdict[str, Any]).
def load_configuration_from_env(env_vars: Mapping[str, Any]) -> dict:
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
August 19, 2026 22:20
View session
load_configuration_from_envload_configuration_from_env
load_configuration_from_envload_configuration_from_env
Kyle Rohn (kylerohn-msft)
approved these changes
Aug 19, 2026
Rodrigo Brandão (rodrigobr-msft)
enabled auto-merge (squash)
August 19, 2026 22:25
Rodrigo Brandão (rodrigobr-msft)
deleted the
users/robrandao/load-config
branch
August 19, 2026 22:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refines the
load_configuration_from_envfunction to improve type safety and avoid potential side effects when handling environment variables. The most important changes are:Type safety and immutability improvements:
env_varsparameter inload_configuration_from_envfromdict[str, Any]toMapping[str, Any], allowing for more flexible and type-safe usage.env_vars.copy()withcopy(env_vars)to create a shallow copy, ensuring that the original mapping is not mutated and supporting non-dict mappings.varstolocal_varsfor clarity and to avoid shadowing the built-invars()function.