Skip to content

Fix a365.config.json missing user principal name#13

Merged
sellakumaran merged 4 commits intomainfrom
users/sellak/cliReliability
Nov 15, 2025
Merged

Fix a365.config.json missing user principal name#13
sellakumaran merged 4 commits intomainfrom
users/sellak/cliReliability

Conversation

@sellakumaran
Copy link
Contributor

No description provided.

Enhanced logging with detailed summaries, actionable error messages, and refined log levels. Improved resilience by wrapping critical operations in try-catch blocks and adding fallback instructions. Enhanced validation for Service Principals and OAuth2 permissions with clearer error messages.

Added comprehensive test coverage for dry-run execution, error handling, and setup summaries. Refactored repetitive logging patterns and improved code readability. Updated test framework to use FluentAssertions and better mock dependencies.
Enhanced error handling for installation issues, including fixes for PATH configuration. Updated `ConfigCommand` to enforce strict separation of static and dynamic properties in `a365.config.json`. Improved `SetupCommand` with better logging, inheritable permissions checks, and clearer user guidance.

Refactored `SetupResults` to include new properties for tracking setup status. Adjusted logging levels in `A365SetupRunner` and `InteractiveGraphAuthService` for better clarity.

Added regression tests to ensure static/dynamic property separation and validated `GetStaticConfig()` and `GetGeneratedConfig()` methods. Improved inline documentation and logging for maintainability.
- Made `AgentUserPrincipalName` immutable in `Agent365Config.cs`.
- Updated `CleanupCommand` to accept `graphApiService` in `Program.cs`.
- Refactored `CreateFederatedIdentityCredentialAsync` in `A365SetupRunner.cs`:
  - Made `graphToken` a required parameter.
  - Added fallback for multiple Graph API endpoints.
  - Introduced exponential backoff for retries.
  - Improved error handling and logging.
  - Added `ConsistencyLevel` header for eventual consistency.
- Replaced `LocalAppData` with a global config directory in `ConfigService.cs`.
- Adjusted logging level for transient errors in `DelegatedConsentService.cs`.
@sellakumaran sellakumaran requested a review from a team as a code owner November 14, 2025 23:58
Copilot AI review requested due to automatic review settings November 14, 2025 23:58
Josina20
Josina20 previously approved these changes Nov 15, 2025
Copy link
Contributor

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 critical bug where AgentUserPrincipalName and other dynamic properties were being incorrectly saved to a365.config.json. The fix enforces strict separation between static configuration (saved to a365.config.json) and dynamic/generated properties (saved to a365.generated.config.json).

Key Changes:

  • Changed AgentUserPrincipalName from mutable (set) to init-only (init) property to ensure it's treated as static configuration
  • Modified ConfigCommand to use GetStaticConfig() when saving configuration, preventing dynamic properties from leaking into static config file
  • Added comprehensive test coverage to prevent regression of this bug
  • Improved logging levels (changed warnings to info/debug where appropriate)
  • Enhanced error handling and setup summary reporting in SetupCommand

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
Agent365Config.cs Changed AgentUserPrincipalName from mutable to init-only property
ConfigCommand.cs Added filtering to only save static properties to a365.config.json
ConfigCommandStaticDynamicSeparationTests.cs New comprehensive test suite to verify static/dynamic property separation
SetupCommand.cs Enhanced error handling, setup tracking, and summary reporting
SetupCommandTests.cs Added tests for error handling and logging behavior
A365SetupRunner.cs Improved logging levels and FIC creation with multiple endpoint fallbacks
ConfigService.cs Refactored config path resolution to use consistent global directory helper
InteractiveGraphAuthService.cs Changed permission messages from Warning to Information level
DelegatedConsentService.cs Changed transient grant error from Warning to Debug level
Program.cs Added missing graphApiService parameter to CleanupCommand
DEVELOPER.md Added troubleshooting guide for PATH configuration

Refactored `ConfigCommand` to always include the `init` subcommand, simplifying logic and enhancing error handling. Updated `SetupCommand` to support test invokers, improve logging for inheritable permissions, and streamline configuration steps. Simplified `SetupResults` class structure for consistency.

Adjusted `Program` to remove unused `graphApiService` dependency in `CleanupCommand`. Improved retry logic in `A365SetupRunner` for better readability and maintained exponential backoff.

Enhanced `SetupCommandTests` by replacing static flags with dynamic logging assertions, improving test coverage and readability. General cleanup included formatting, comment adjustments, and removal of redundant code.
@sellakumaran sellakumaran merged commit 30d9129 into main Nov 15, 2025
2 checks passed
@sellakumaran sellakumaran deleted the users/sellak/cliReliability branch November 15, 2025 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants