Repository navigation
Description
Code Simplification - 2026-10-05
This PR simplifies code from ApplyEngine.cs (introduced in merged PR #11733, "Split ApplyEngine into focused partial modules") to reduce duplication while preserving all functionality.
Files Simplified
.github/workflows/unskip-closed-tests-tool/ApplyEngine.cs- Extracted two small, named helper methods to remove repeated LINQ expressions that appeared 3–4 times each.
Improvements Made
-
Reduced Duplication
- The expression
candidates.ToDictionary(static candidate => candidate.CandidateId, StringComparer.Ordinal)was repeated 3 times for building a candidate-ID lookup map fromrequestedManifest.Candidates,freshResolved.Candidates, andfinalEligibility.Candidates. Extracted intoToCandidateMap(IEnumerable<Candidate>). - The byte-dictionary deep-clone expression (
source.ToDictionary(pair => pair.Key, pair => pair.Value.ToArray(), StringComparer.Ordinal)) was repeated twice fororiginalBytessnapshots. Extracted intoCloneBytesMap(Dictionary<string, byte[]>).
- The expression
-
Enhanced Clarity
- Named helper methods make the intent of each dictionary construction self-documenting at each call site.
-
No Behavior Change
- Both helpers are pure, allocation-equivalent wrappers around the original inline LINQ expressions (same comparer, same projection, same deep-copy semantics).
Testing
- ✅
dotnet build UnskipClosedTests.Tool.csprojsucceeds with 0 warnings/errors. - ✅
dotnet run --project Tests/UnskipClosedTests.Tool.Tests.csproj— all 5 existing tests pass, unchanged. - ✅ No functional changes - behavior, ordering, and comparer semantics are identical.
- ✅ UTF-8 BOM preserved in the edited file.
Review Focus
Please verify:
- The two new private helpers (
ToCandidateMap,CloneBytesMap) match prior inline semantics exactly (comparerStringComparer.Ordinal,staticlambdas where applicable). - No unintended side effects on
ApplyEngine.ApplyAsynccontrol flow.
Warning
Protected Files — Push Permission Denied
This was originally intended as a pull request, but the change modifies protected files. A human must create the pull request manually.
Protected files
The push was rejected because GitHub Actions does not have workflows permission to push these changes, and is never allowed to make such changes, or other authorization being used does not have this permission.
Create the pull request manually
# Download the artifact from the workflow run
gh run download '37317221010' -n agent -D '/tmp/agent-37317221010'
# Resolve the bundle source ref, fetch it into a temporary ref, then create the local branch
bundle_path='/tmp/agent-37317221010/aw-code-simplifier-unskip-tool-dedup.bundle'
temp_ref='refs/bundles/create-pr-code-simplifier-unskip-tool-dedup-4e79fcd046a56932-300d1cb5'
target_ref='refs/heads/code-simplifier/unskip-tool-dedup-4e79fcd046a56932'
bundle_source_ref=$(git bundle list-heads "$bundle_path" | awk '$2 ~ /^refs\/heads\// { print $2 }')
if [ -z "$bundle_source_ref" ]; then
bundle_source_ref=$(git bundle list-heads "$bundle_path" | awk '$2 == "HEAD" { print $2 }')
fi
if [ "$(printf '%s\n' "$bundle_source_ref" | sed '/^$/d' | wc -l | tr -d ' ')" != "1" ]; then
echo "Expected exactly one bundle source ref, found: $bundle_source_ref" >&2
exit 1
fi
git fetch "$bundle_path" "${bundle_source_ref}:${temp_ref}"
git update-ref "$target_ref" "$temp_ref"
git checkout 'code-simplifier/unskip-tool-dedup-4e79fcd046a56932'
# Ensure the working tree matches the updated branch
git reset --hard
# Remove the temporary bundle ref
git update-ref -d "$temp_ref"
# Push the branch and create the pull request
git push origin code-simplifier/unskip-tool-dedup-4e79fcd046a56932
gh pr create --title '[code-simplifier] Dedup candidate-map and byte-map cloning helpers in ApplyEngine' --base main --head code-simplifier/unskip-tool-dedup-4e79fcd046a56932 --repo microsoft/testfxWarning
Firewall blocked 8 domains
The following domains were blocked by the firewall during workflow execution:
96bvsblobprodcus338.vsblob.vsassets.iodc.services.visualstudio.comgithub.life-white.ukkgfvsblobprodcus314.vsblob.vsassets.iol49vsblobprodcus358.vsblob.vsassets.iom6xvsblobprodcus342.vsblob.vsassets.iopkgs.dev.azure.comyluvsblobprodcus367.vsblob.vsassets.io
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "96bvsblobprodcus338.vsblob.vsassets.io"
- "dc.services.visualstudio.com"
- "github.com"
- "kgfvsblobprodcus314.vsblob.vsassets.io"
- "l49vsblobprodcus358.vsblob.vsassets.io"
- "m6xvsblobprodcus342.vsblob.vsassets.io"
- "pkgs.dev.azure.com"
- "yluvsblobprodcus367.vsblob.vsassets.io"See Network Configuration for more information.
🤖 Automated content by GitHub Copilot. Generated by the Code Simplifier workflow. · copilot · auto · 131.8 AIC · ⌖ 13.5 AIC · ⊞ 14.5K · [◷]( · ◷)
Add this agentic workflow to your repo
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/code-simplifier.md@main
- expires on Oct 6, 2026, 1:42 PM UTC
Activity