Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #6174 by adding validation to prevent duplicate connection names when creating or renaming connections. The implementation migrates from the old validation pattern to Zod schema validation with async refine callbacks that check for duplicate names by querying all existing connections.
Key changes:
- Adds Zod schema validation with async duplicate name checking for the
connection setandlogincommands - Updates CLI core to use
safeParseAsyncinstead ofsafeParseto support async validation - Updates tests to reflect the new validation approach and adds coverage for duplicate name validation
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/m365/connection/commands/connection-set.ts | Migrates from old validation methods to Zod schema with async duplicate name checking for the newName option |
| src/m365/connection/commands/connection-set.spec.ts | Updates tests to use schema-based validation and adds test coverage for duplicate name validation |
| src/m365/commands/login.ts | Adds async duplicate name validation for the connectionName option using Zod refine |
| src/m365/commands/login.spec.ts | Adds test coverage to verify validation fails when connection name is already in use |
| src/cli/cli.ts | Changes from safeParse to safeParseAsync to support async validation in Zod schemas |
MartinM85
requested changes
Jan 8, 2026
Contributor
MartinM85
left a comment
There was a problem hiding this comment.
Looks great. Just a few minor suggestions from my side.
3d412ff to
a982125
Compare
a982125 to
86be9d6
Compare
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.
Closes #6174