Skip to content

fix source/target directory + add source-commit option#5334

Merged
adamzip merged 8 commits intodotnet:mainfrom
adamzip:repro-tool-fixes
Oct 10, 2025
Merged

fix source/target directory + add source-commit option#5334
adamzip merged 8 commits intodotnet:mainfrom
adamzip:repro-tool-fixes

Conversation

@adamzip
Copy link
Copy Markdown
Contributor

@adamzip adamzip commented Oct 4, 2025

Copilot AI review requested due to automatic review settings October 4, 2025 05:39
Copy link
Copy Markdown
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 enhances the Product Construction Service ReproTool's FlowCommitOperation by adding support for specifying source commits directly and fixing source/target directory assignment logic. The changes improve flexibility in testing dependency flow scenarios.

Key changes:

  • Added optional source-commit parameter as an alternative to source-branch
  • Refactored source/target directory assignment logic with proper forward/backward flow detection
  • Simplified codeflow metadata detection using dedicated helper methods

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
tools/ProductConstructionService.ReproTool/Options/FlowCommitOptions.cs Added source-commit option and made source-branch optional
tools/ProductConstructionService.ReproTool/Operations/FlowCommitOperation.cs Refactored directory assignment logic and added VMR detection methods

Comment thread tools/ProductConstructionService.ReproTool/Options/FlowCommitOptions.cs Outdated
Comment thread tools/ProductConstructionService.ReproTool/Operations/FlowCommitOperation.cs Outdated
@adamzip adamzip requested review from dkurepa and premun October 6, 2025 09:02
Comment thread tools/ProductConstructionService.ReproTool/Operations/FlowCommitOperation.cs Outdated
Comment thread tools/ProductConstructionService.ReproTool/Operations/FlowCommitOperation.cs Outdated
Comment thread tools/ProductConstructionService.ReproTool/Operations/FlowCommitOperation.cs Outdated
@adamzip adamzip requested review from Copilot and dkurepa October 6, 2025 09:41
Copy link
Copy Markdown
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment on lines 106 to 108
_logger.LogInformation("Creating build for {repo}@{branch} (commit {commit})",
_options.SourceRepository,
_options.SourceBranch,
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

The log message references _options.SourceBranch which can now be null when source-commit is provided. This will log 'null' for the branch parameter when using the commit option.

Suggested change
_logger.LogInformation("Creating build for {repo}@{branch} (commit {commit})",
_options.SourceRepository,
_options.SourceBranch,
var branchOrCommit = !string.IsNullOrEmpty(_options.SourceBranch)
? _options.SourceBranch
: Microsoft.DotNet.DarcLib.Commit.GetShortSha(sourceCommit);
_logger.LogInformation("Creating build for {repo}@{branch} (commit {commit})",
_options.SourceRepository,
branchOrCommit,

Copilot uses AI. Check for mistakes.
Comment thread tools/ProductConstructionService.ReproTool/Options/FlowCommitOptions.cs Outdated
[Option("source-branch", HelpText = "Either --source-branch or --source-commit is required. Branch whose commit will be flown. Ignored if source-commit is provided.", Required = false)]
public string? SourceBranch { get; init; }

[Option("source-commit", HelpText = "Either --source-branch or --source-commit is required. Source commit that will be flown.", Required = false)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does this work with --realBuildId? Probably you can either supply a build or a commit? Or does the source commit override the build SHA? Or the other way?

Copy link
Copy Markdown
Contributor Author

@adamzip adamzip Oct 6, 2025

Choose a reason for hiding this comment

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

I haven't been using --realBuildId. Should I make it impossible to provide both a --sourceCommit and a --realBuildId?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it might be easier to forbid providing both - build will just use it's own SHA.

If you also can rename it to --build-id it would better match what we have elsewhere.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we use the realBuildId just for the assets. We don't use it for the sha, as in you can give a branch/sha that's not corresponding to the build

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So maybe it should be named like that - --assets-from-build or something?

dkurepa
dkurepa previously approved these changes Oct 6, 2025
@adamzip adamzip enabled auto-merge (squash) October 10, 2025 11:33
@adamzip adamzip merged commit 0f1c878 into dotnet:main Oct 10, 2025
7 of 9 checks passed
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.

4 participants