Skip to content

Sync eng/common directory with azure-sdk-tools for PR 16621 - #50033

Open
azure-sdk-automation[bot] wants to merge 2 commits into
mainfrom
sync-eng-common-fix/regenerate-matrix-drops-packages-16621
Open

Sync eng/common directory with azure-sdk-tools for PR 16621#50033
azure-sdk-automation[bot] wants to merge 2 commits into
mainfrom
sync-eng-common-fix/regenerate-matrix-drops-packages-16621

Conversation

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#16621 See eng/common workflow

Wei Hu (live1206) and others added 2 commits July 29, 2026 05:03
Split-Items computed the number of oversized groups as
$itemCount % $itemsPerGroup instead of $itemCount % $JobCount. Since
$itemsPerGroup is the group size and not the group count, the remainder
is taken over the wrong quantity, and whenever

  $itemCount % $itemsPerGroup -lt $itemCount % $JobCount

too few groups are widened. The generated groups then hold fewer items
than were passed in, and the trailing items are silently omitted from
the matrix. Nothing fails, so those packages simply never get
regenerated.

The azure-sdk-for-net mgmt regeneration pipeline hits this: 230 packages
across 18 jobs produces groups summing to 218, dropping the last 12
packages including Azure.ResourceManager.AppService. This is visible in
the emitted job keys, where the final key is se_st_17 (ending at
"storagediscovery") rather than st_wo_17.

The bug was easy to miss because the worked example in the comment above
the function, 22 items into 5 jobs, happens to give the same answer under
both formulas: 22 % 4 and 22 % 5 are both 2.

Verified over all item counts 1..300 against job counts 1..30 (9000
combinations): before the fix 408 combinations lost items, after it none
do, every input item appears exactly once, and group sizes still differ
by at most one.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Both parameters are used as divisors when splitting items, so passing 0
or a negative value failed with "Attempted to divide by zero" or
"Arithmetic operation resulted in an overflow" from inside Split-Items
rather than with a message naming the bad parameter.

Use ValidateRange so the failure happens at parameter binding, matching
the declarative validation attributes already used across these scripts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-sdk-automation
azure-sdk-automation Bot requested a review from a team as a code owner August 5, 2026 03:33
@azure-sdk-automation
azure-sdk-automation Bot requested review from Wei Hu (live1206) and a lite review from Copilot August 5, 2026 03:33
@azure-sdk-automation azure-sdk-automation Bot added EngSys This issue is impacting the engineering system. Central-EngSys This issue is owned by the Engineering System team. labels Aug 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.

This PR improves the matrix regeneration script by preventing invalid parameter values and correcting the job-splitting remainder calculation to avoid dropping items.

Changes:

  • Added parameter validation to reject zero/negative values for $JobCount and $MinimumPerJob.
  • Fixed remainder calculation when splitting items across jobs to prevent silently dropped trailing items.
  • Added inline comments explaining the failure mode and the corrected logic.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
34 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Central-EngSys This issue is owned by the Engineering System team. EngSys This issue is impacting the engineering system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants