Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Source Argument Validation in SourceWorkflow for Default Source Type #4891

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Madhusudhan-MSFT
Copy link
Contributor

@Madhusudhan-MSFT Madhusudhan-MSFT commented Oct 19, 2024

Fix for Source Argument Validation in SourceWorkflow for Default Source Type

[Issues:] The current validation in the source flow correctly detects duplicate source names. However, when the source argument is validated along with the source type, it allows different source names with the same arguments for the empty source type. This happens because, during source type comparison, if the source type is not provided, it defaults to an empty string, which is compared against the default type (Microsoft.PreIndexed). This allows multiple different source names with the same argument to be considered valid sources. For an empty source type, the default source type is assigned during the source add operation, not beforehand. Consequently, after the source add operation is finished, the source will have some source arguments, but only the name will differ.

[Fix:]

For an empty source type, we should compare against the default source to prevent different source names with the same arguments for the default types. During validation, we obtain the default type to replace the empty source type and use it for comparison to validate argument duplication.

  • Extended source tests to validate the duplicate source argument scenario for the default source type.
  • Fixed additional failing source origin tests with appropriate fixes.

[How Validated:]

  • Compiled the latest modifications and deployed the AppInstallerCLIPackage.
  • Executed CLI SourceTests to ensure all tests pass without issues.

Microsoft Reviewers: Open in CodeFlow

…ce Type

[Issues:] The current validation in the source flow correctly detects duplicate source names. However, when the source argument is validated along with the source type, it allows different source names with the same arguments for the empty source type. This happens because, during source type comparison, if the source type is not provided, it defaults to an empty string, which is compared against the default type (Microsoft.PreIndexed). This allows multiple different source names with the same argument to be considered valid sources. For an empty source type, the default source type is assigned during the source add operation, not beforehand. Consequently, after the source add operation is finished, the source will have some source arguments, but only the name will differ.

[Fix:]

For an empty source type, we should compare against the default source to prevent different source names with the same arguments for the default types.
During validation, we obtain the default type to replace the empty source type and use it for comparison to validate argument duplication.

- Extended source tests to validate the duplicate source argument scenario for the default source type.
- Fixed additional failing source origin tests with appropriate fixes.

[How Validated:]
- Compiled the latest modifications and deployed the AppInstallerCLIPackage.
- Executed CLI SourceTests to ensure all tests pass without issues.

This comment has been minimized.

@Madhusudhan-MSFT Madhusudhan-MSFT marked this pull request as ready for review October 21, 2024 06:13
@Madhusudhan-MSFT Madhusudhan-MSFT requested a review from a team as a code owner October 21, 2024 06:13
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.

1 participant