Repository navigation
C# and C/C++: Make autobuild script selection deterministic. - #23276
Draft
michaelnebel wants to merge 4 commits into
Draft
michaelnebel wants to merge 4 commits into
michaelnebel wants to merge 4 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the deterministic build-script selection change.
No open issues 🎉
What changed in this PR
This PR makes build-script selection deterministic in the shared C# and C/C++ autobuilder, preventing filesystem enumeration order from changing which script runs.
Changes:
- Preserve shallowest-script priority and break ties using ordinal path order.
- Store candidates in a backing array and expose their paths through a get-only projection.
- Add regression tests for enumeration order, depth, Windows candidates, and no candidates, plus change notes for both languages.
| File | Description |
|---|---|
| csharp/​ql/​lib/​change-notes/​2026-11-27-deterministic-build-script.md | Documents deterministic C# script selection. |
| csharp/​autobuilder/​Semmle.Autobuild.Shared/​BuildCommandAutoRule.cs | Adds deterministic tie-breaking and array-backed candidate storage. |
| csharp/​autobuilder/​Semmle.Autobuild.CSharp.Tests/​BuildScripts.cs | Tests ordering, depth priority, Windows candidates, and empty results. |
| cpp/​ql/​lib/​change-notes/​2026-11-27-deterministic-build-script.md | Documents the shared C# and C/C++ autobuilder fix. |
Review effort: Balanced (adaptive)
This branch has not been deployed
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.
The non-determinism showed itself during a QA run (It picked different scripts in the different runs) when the autobuilder attempted to build the code from https://github.com/aspnet/AspNetKatana.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
5f16783f73dd714209747a538cff208b85215817↓ No real-world build or CI result has been inspected.
↓ The linked job logs are SAML-protected and could not be inspected.
Summary
OrderBy,ThenBy, andFirstOrDefault, breaking ties by ordinal path order while retaining existing candidate matching. .NET optimizes selection to a linear-time minimum scan without sorting.Validation
dotnet test csharp/autobuilder/Semmle.Autobuild.CSharp.Tests/Semmle.Autobuild.CSharp.Tests.csproj(.NET 11): 41 passed.dotnet test csharp/autobuilder/Semmle.Autobuild.Cpp.Tests/Semmle.Autobuild.Cpp.Tests.csproj(.NET 11): 2 passed.@semmle_coderepository lacksgit_info.The reported example job logs could not be inspected because access requires SAML authorization: successful run and failed run.