Skip to content

fix: use ConnectionOptions constructor for ServiceClient org metadata discovery#96

Merged
joshsmithxrm merged 2 commits intomainfrom
fix/serviceclient-org-metadata
Jan 2, 2026
Merged

fix: use ConnectionOptions constructor for ServiceClient org metadata discovery#96
joshsmithxrm merged 2 commits intomainfrom
fix/serviceclient-org-metadata

Conversation

@joshsmithxrm
Copy link
Copy Markdown
Owner

Summary

  • Credential providers using the token provider constructor don't trigger org metadata discovery
  • ConnectedOrgFriendlyName, ConnectedOrgUniqueName, and ConnectedOrgId remain empty
  • Switched to ConnectionOptions constructor which properly initializes org metadata

Affected credential providers:

  • InteractiveBrowserCredentialProvider
  • DeviceCodeCredentialProvider
  • ManagedIdentityCredentialProvider
  • GitHubFederatedCredentialProvider
  • AzureDevOpsFederatedCredentialProvider

Note: ClientSecretCredentialProvider, CertificateFileCredentialProvider, and CertificateStoreCredentialProvider use connection strings which already work correctly.

Test plan

  • ppds auth create --name test (interactive browser)
  • ppds env select --environment "any-env"
  • ppds env who - Verify Unique Name and Friendly Name are populated

Fixes #86

🤖 Generated with Claude Code

… discovery

Credential providers using the token provider constructor don't trigger
org metadata discovery, leaving ConnectedOrgFriendlyName, ConnectedOrgUniqueName,
and ConnectedOrgId empty.

Switch to ConnectionOptions constructor which properly initializes org metadata:
- InteractiveBrowserCredentialProvider
- DeviceCodeCredentialProvider
- ManagedIdentityCredentialProvider
- GitHubFederatedCredentialProvider
- AzureDevOpsFederatedCredentialProvider

Fixes #86

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 2, 2026 20:23
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @joshsmithxrm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where several credential providers failed to discover and populate organization metadata (such as friendly name, unique name, and ID) when initializing the ServiceClient. The change involves updating the ServiceClient instantiation method to use the ConnectionOptions constructor, which correctly triggers the necessary metadata discovery process, ensuring that these critical organization details are always available.

Highlights

  • Fix for ServiceClient Org Metadata Discovery: Credential providers now correctly populate ConnectedOrgFriendlyName, ConnectedOrgUniqueName, and ConnectedOrgId by switching from the token provider constructor to the ConnectionOptions constructor for ServiceClient initialization.
  • Affected Credential Providers: This fix impacts InteractiveBrowserCredentialProvider, DeviceCodeCredentialProvider, ManagedIdentityCredentialProvider, GitHubFederatedCredentialProvider, and AzureDevOpsFederatedCredentialProvider.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses an issue where organization metadata was not being discovered by switching to the ConnectionOptions constructor for ServiceClient. This is a good fix. However, in doing so, a pre-existing issue with token handling has been carried over. The current implementation fetches an access token only once and provides a function to the ServiceClient that always returns this initial token. This means the token will not be refreshed upon expiration, leading to authentication failures. I have added review comments to each affected credential provider with suggestions on how to implement proper token refresh logic by supplying a delegate that can acquire new tokens as needed. This will ensure the ServiceClient can maintain a long-lived, stable connection.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 2, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where organization metadata (ConnectedOrgFriendlyName, ConnectedOrgUniqueName, and ConnectedOrgId) was not being populated when using credential providers with the token provider constructor. The fix switches to using the ConnectionOptions constructor, which properly triggers org metadata discovery in the ServiceClient.

Key Changes:

  • Updated 5 credential providers to use ConnectionOptions constructor instead of the token provider constructor
  • Added CHANGELOG entry documenting the fix

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/PPDS.Auth/Credentials/ManagedIdentityCredentialProvider.cs Updated ServiceClient instantiation to use ConnectionOptions with token provider for proper metadata discovery
src/PPDS.Auth/Credentials/InteractiveBrowserCredentialProvider.cs Updated ServiceClient instantiation to use ConnectionOptions with token provider for proper metadata discovery
src/PPDS.Auth/Credentials/GitHubFederatedCredentialProvider.cs Updated ServiceClient instantiation to use ConnectionOptions with token provider for proper metadata discovery
src/PPDS.Auth/Credentials/DeviceCodeCredentialProvider.cs Updated ServiceClient instantiation to use ConnectionOptions with token provider for proper metadata discovery
src/PPDS.Auth/Credentials/AzureDevOpsFederatedCredentialProvider.cs Updated ServiceClient instantiation to use ConnectionOptions with token provider for proper metadata discovery
src/PPDS.Auth/CHANGELOG.md Added entry documenting the org metadata discovery fix

The changes are well-structured, consistent across all affected files, and properly documented. The implementation correctly addresses the issue described in #86 by switching from the token provider constructor to the ConnectionOptions approach, which ensures organization metadata is discovered and populated.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Pass GetTokenAsync delegate instead of captured token to ServiceClient,
allowing token refresh for long-running operations.

- Interactive/DeviceCode: Prime cache first, use silent refresh delegate
- Federated/ManagedIdentity: Use on-demand token acquisition delegate

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@joshsmithxrm joshsmithxrm merged commit 2eaeb95 into main Jan 2, 2026
8 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in PPDS Roadmap Jan 2, 2026
@joshsmithxrm joshsmithxrm deleted the fix/serviceclient-org-metadata branch January 3, 2026 18:03
joshsmithxrm added a commit that referenced this pull request Jan 8, 2026
* chore: migrate project tracking to GitHub Issues

- Create 37 GitHub issues for planned features and tech debt (#58-94)
- Create 8 epic labels for organization (epic:alm, epic:data, etc.)
- Convert accepted tradeoffs to ADRs in docs/adr/ (7 ADRs)
- Delete ROADMAP.md (GitHub Issues is now source of truth)
- Delete migrated docs/future/*.md files (kept design docs)
- Delete docs/technical-debt/ folder (issues + ADRs replace it)
- Update CLAUDE.md references to point to GitHub Issues and docs/adr/

Closes #56

* chore: simplify .claude/ structure for UI shell pattern

Remove agents, skills, examples, and workflow files that were overkill
for a UI shell extension. Keep only panel templates and essential
commands. Cross-repo commands (handoff, retrospective) moved to
workspace level.

Deleted:
- .claude/agents/ (design-architect, code-guardian)
- .claude/skills/ (code-cleanup, code-review-gateway)
- .claude/examples/
- .claude/WORKFLOW.md
- 8 obsolete commands
- 3 obsolete templates

Kept:
- Panel development templates
- prepare-pr, prepare-release, new-panel commands
- TROUBLESHOOTING.md

* chore: rewrite CLAUDE.md for UI shell architecture

* docs: prepare changelog for v0.3.4 release

* chore: bump version to 0.3.4

* docs: fix changelog formatting

* chore: clean up documentation for UI shell architecture

- Remove obsolete Clean Architecture docs (7 files)
- Delete TROUBLESHOOTING.md (obsolete agent references)
- Delete extension DOCUMENTATION_STYLE_GUIDE.md (use parent's)
- Simplify .claude/ commands and templates
- Fix absolute paths (C:\VS\ppds -> relative)
- Update docs/README.md to reflect simplified structure

* chore: remove obsolete docs for UI shell architecture

Delete obsolete documentation:
- Architecture: Clean Architecture patterns (SDK concern now)
- ADRs: Value objects, panel coordinators (obsolete patterns)
- Future: Design docs (use GitHub Issues instead)
- Testing: Domain/application layer guides (overkill for UI shell)
- Folders: quality, requirements, retrospective, work, design

Keep webview patterns and remaining ADRs relevant to extension.

* chore: renumber ADRs and fix broken references

- Renumber: 0004→0002, 0005→0003, 0006→0004, 0007→0005
- Remove references to deleted architecture docs
- Remove deleted .mcp.example.json and test-notebooks

* chore: fix broken references to deleted architecture docs

Removes references to deleted documentation files:
- CLEAN_ARCHITECTURE_GUIDE.md
- PANEL_ARCHITECTURE.md
- TESTING_GUIDE.md
- INTEGRATION_TESTING_GUIDE.md
- CODE_QUALITY_GUIDE.md
- MAPPER_PATTERNS.md

Updated files:
- CONTRIBUTING.md: Simplified testing section, removed broken links
- SECURITY.md: Removed code quality guide reference
- docs/architecture/*.md: Removed deleted pattern references
- Source files: Removed obsolete pattern references in comments

* fix: upgrade engines.vscode and remove broken ADR link

- Upgrade engines.vscode from ^1.74.0 to ^1.107.0 to match @types/vscode
- Remove broken reference to deleted ODATA_DOMAIN_PATTERN.md in ADR-0001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ppds env who: org friendly name and unique name are empty

3 participants