Track sourceLink and resources in deterministic key
This PR adds tracking for source link files and resources to the compiler's deterministic key file to ensure all compilation inputs that affect reproducible builds are properly tracked. The implementation includes calculating checksums for source link content and manifest resources (tracking name, fileName, isPublic, and content checksum), while ruleset tracking was deemed unnecessary since rulesets only affect compilation through diagnostic options that are already being tracked.
Original prompt
This section details on the original issue you should resolve
<issue_title>Missing inputs in the key file</issue_title> <issue_description>Recently discovered that there are several inputs we are not tracking in the key file that need to be tracked:
- [ ] source link file
- [ ] ruleset file
- [ ] resources
</issue_description>
Comments on the Issue (you are @copilot in this section)
- Fixes dotnet/roslyn#65474
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
@copilot CI produced src/Compilers/Core/Portable/Compilation/DeterministicKeyBuilder.cs(434,31): error IDE0060: (NETCORE_ENGINEERING_TELEMETRY=Build) Remove unused parameter 'cancellationToken'
@copilot CI produced
src/Compilers/Core/Portable/Compilation/DeterministicKeyBuilder.cs(434,31): error IDE0060: (NETCORE_ENGINEERING_TELEMETRY=Build) Remove unused parameter 'cancellationToken'
Fixed in 08c5f389. Removed the unused cancellationToken parameter from the WriteEmitOptions method signature and its call site.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
sc4vsblobprodcus331.vsblob.vsassets.io
- Triggering command:
/usr/share/dotnet/dotnet dotnet build src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
@copilot GetKey(...) already handles default inputs (additionalTexts, analyzers, generators, resources, ...). There is no need for the caller of GetKey to also do NullToEmpty() on those.
@copilot
GetKey(...)already handles default inputs (additionalTexts,analyzers,generators,resources, ...). There is no need for the caller ofGetKeyto also doNullToEmpty()on those.
Fixed in e4530d3a. Removed the redundant NullToEmpty() calls from the caller since GetKey() already handles default inputs internally.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
sc4vsblobprodcus331.vsblob.vsassets.io
- Triggering command:
/usr/share/dotnet/dotnet dotnet build src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
@copilot We should care about the ruleset contents, not just the path to the ruleset file
@copilot We should care about the ruleset contents, not just the path to the ruleset file
Fixed in 2fac3710. Changed from tracking ruleset file path to tracking ruleset content with checksum (similar to source link). The ruleset file is now opened and read as SourceText, with its checksum written to compilation.options.ruleSet.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
sc4vsblobprodcus331.vsblob.vsassets.io
- Triggering command:
/usr/share/dotnet/dotnet dotnet build src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
@copilot Remove IsEmbedded. It is redundant with FileName and we need FileName for non-embedded scenarios
@copilot Remove IsEmbedded. It is redundant with FileName and we need FileName for non-embedded scenarios
Fixed in 3b9a2f2a. Removed the isEmbedded field from the resources output. Whether a resource is embedded can be determined from fileName (null = embedded, non-null = linked).
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
sc4vsblobprodcus331.vsblob.vsassets.io
- Triggering command:
/usr/share/dotnet/dotnet dotnet build src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
@copilot We don't need to include ruleSet in the key after all since it can only affect the compilation output via GeneralDiagnosticOption and SpecificDiagnosticOptions. Both of those are already included in the key. Check if I'm missing something. If looks good, go ahead and remove it
@copilot We don't need to include ruleSet in the key after all since it can only affect the compilation output via GeneralDiagnosticOption and SpecificDiagnosticOptions. Both of those are already incl...
Fixed in 0e564a1c. Removed ruleSet tracking from the deterministic key. As you noted, rulesets only affect compilation output via GeneralDiagnosticOption and SpecificDiagnosticOptions, both of which are already tracked in the key, making the ruleset content itself redundant.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
sc4vsblobprodcus331.vsblob.vsassets.io
- Triggering command:
/usr/share/dotnet/dotnet dotnet build src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
@copilot Let's update the added test for resources to include a non-public resource and a non-embedded resource. Also, let's add a test showing that irrelevant/trivial changes to ruleset does not affect the key.
@copilot Let's update the added test for resources to include a non-public resource and a non-embedded resource. Also, let's add a test showing that irrelevant/trivial changes to ruleset does not affe...
Fixed in 59233c94.
Enhanced the Resources test to include:
- Embedded public resource (original)
- Embedded non-public resource (new)
- Non-embedded (linked) resource with fileName (new)
Added RuleSetChangesDoNotAffectKey test demonstrating that the deterministic key is based on the diagnostic options (GeneralDiagnosticOption and SpecificDiagnosticOptions) rather than ruleset file content, since those options are already tracked in the key.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
sc4vsblobprodcus331.vsblob.vsassets.io
- Triggering command:
/usr/share/dotnet/dotnet dotnet build src/Compilers/Core/RebuildTest/Microsoft.CodeAnalysis.Rebuild.UnitTests.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
I'm investigating the determinism failure in CI with Microsoft.VisualStudio.Extensibility.Testing.Xunit:
...
"resources": [
{
"resourceName": "Microsoft.VisualStudio.IntegrationTestService.dll",
"fileName": null,
"isPublic": true,
"content": {
"checksum": "da3a9f2c2fc2de2bf0254f9f13e15726c7a260ab318acff9a77790ccc344a",
"checksumAlgorithm": "Sha256"
}
},
{
"resourceName": "Microsoft.VisualStudio.IntegrationTestService.vsix",
"fileName": null,
"isPublic": true,
"content": {
+ "checksum": "c88fbb3f45e9c061775c57b763ba4e3988857883a253d03ac7bed44bf113af9c", // Right
- "checksum": "876736d2ee98f2c4cac77a7fac592adbd14924d583f914cf873dc67366c2f8c", // Left
"checksumAlgorithm": "Sha256"
}
}
]
}