Deduplicate sample binlog argument construction - #11740
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
Review outcome: No actionable findings — this is a behavior-preserving DRY refactor that correctly consolidates binlog-argument construction.
Change classification
- Build infrastructure / PowerShell tooling: New
Get-SampleBinlogArgumenthelper ineng/samples-tools.ps1, consumed by all 5 previously-duplicated call sites ineng/build-samples.ps1(UWP restore, UWP build, regulardotnet build, standalone projects) andeng/test-samples.ps1'sGet-BinlogArgument.
Confidence at a glance
🟢 Correctness & design — verified equivalent
- Why it applies: Refactor must preserve the exact binlog path/prefix produced at every call site.
- Evidence: Traced all 5 call sites:
/bl:prefix is preserved for the two UWP (restore/msbuild) sites via explicit-ArgumentPrefix "/bl:", and-bl:default is preserved for thedotnet buildand standalone-project sites. Intest-samples.ps1,Get-BinlogArgumentstrips the.binlogsuffix from$logNamebefore calling the helper (which re-appends it), so the composed path is byte-for-byte identical to before; the-bl:{}fallback (used by hot-reload/MSBuild-server style invocation) is untouched. The downstreamVisualStudioInvokemode's$binlogArgument.Substring(4)(stripping the 4-char-bl:prefix) still holds since the default prefix length is unchanged. - Gap or disposition: None found; pure mechanical consolidation with no behavioral drift.
🟢 Build, dependencies & scripts (PowerShell Scripting Hygiene) — clean
- Why it applies:
eng/**/*.ps1changes are always in scope for this dimension. - Evidence: No
$array += $itemloop accumulation, no parameter-name shadowing, no inlinegh/external-tool duplication, no batch-loop abort-on-first-failure pattern introduced.Set-StrictMode -Version Latestis already present in both calling scripts (unaffected by this change). The new function mirrors the existing siblingGet-SampleRelativePath's style (no comment-based help), so it's consistent with the file's conventions. - Gap or disposition: None.
⚪ Not applicable: Concurrency & lifecycle, Security & protocol, API & compatibility, Performance, Localization, Tests, Analyzers (no production code, public API, async/threading, security boundary, user-facing string, analyzer, or test-coverage-relevant behavior touched — purely mechanical build-script deduplication per the Edge Cases "mechanical changes" exception).
Sample build scripts repeated binlog path, suffix, and argument-prefix construction across several code paths, risking inconsistent naming and behavior.
Shared helper
Get-SampleBinlogArgumenttoeng/samples-tools.ps1..binlogsuffixing, path joining, and-bl://bl:formatting.Call-site consolidation
test-samples.ps1while preserving its-bl:{}fallback.