Skip to content

refactor: generate built-in plugin hashes at build time instead of committing them - #675

Merged
Hirogen merged 1 commit into
Developmentfrom
fix/build-time-plugin-hashes
Jul 28, 2026
Merged

refactor: generate built-in plugin hashes at build time instead of committing them#675
Hirogen merged 1 commit into
Developmentfrom
fix/build-time-plugin-hashes

Conversation

@Hirogen

@Hirogen Hirogen commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

refactor: generate built-in plugin hashes at build time instead of committing them

PluginValidator's hash table was a committed file regenerated after the build that produced it, then committed as a new commit. That ordering could never be right: the table described the previous build's binaries, and committing it changed HEAD, which changed the binaries again. CI papered over it by auto-committing the churn on Development and by gating fork PRs on a diff that could not come out clean.

Generate it during the build instead. PluginHashGenerator.targets hashes the plugin DLLs before PluginRegistry compiles and writes the table into obj/, so every build's table matches that build's own binaries by construction. The plugins are guaranteed to exist first via build-order-only ProjectReferences (ReferenceOutputAssembly=false) from PluginRegistry to each plugin project - making explicit a dependency PluginRegistry already had, since it hardcoded their hashes.

Hashing now uses MSBuild's built-in GetFileHash rather than a separate console project, which also breaks the cycle that project would otherwise create: it referenced PluginRegistry, which now needs the table before it compiles.

Removed as a result:

  • src/PluginHashGenerator.Tool (the console generator)
  • the committed PluginHashGenerator.Generated.cs
  • Nuke's GeneratePluginHashes target, including the PluginRegistry rebuild it needed and the version-stamping hazard that rebuild carried
  • the Generate / Verify / Commit steps in build_dotnet.yml, and that job's write permissions
  • the plugin-hash half of release.yml's generated-files PR

This also makes commit-to-commit reproducibility unnecessary, so EnableSourceControlManagerQueries=false is reverted and SourceLink is restored.

Verified on a clean Release build: all 21 table entries match the SHA256 of the DLLs shipped in bin/Release/plugins and pluginsx86, with the commit sha back in InformationalVersion. Debug and Release both generate 21 entries. Full suite passes: 1491 passed, 7 skipped, 0 failed.

…mmitting them

PluginValidator's hash table was a committed file regenerated after the build
that produced it, then committed as a new commit. That ordering could never be
right: the table described the previous build's binaries, and committing it
changed HEAD, which changed the binaries again. CI papered over it by
auto-committing the churn on Development and by gating fork PRs on a diff that
could not come out clean.

Generate it during the build instead. PluginHashGenerator.targets hashes the
plugin DLLs before PluginRegistry compiles and writes the table into obj/, so
every build's table matches that build's own binaries by construction. The
plugins are guaranteed to exist first via build-order-only ProjectReferences
(ReferenceOutputAssembly=false) from PluginRegistry to each plugin project -
making explicit a dependency PluginRegistry already had, since it hardcoded
their hashes.

Hashing now uses MSBuild's built-in GetFileHash rather than a separate console
project, which also breaks the cycle that project would otherwise create: it
referenced PluginRegistry, which now needs the table before it compiles.

Removed as a result:
- src/PluginHashGenerator.Tool (the console generator)
- the committed PluginHashGenerator.Generated.cs
- Nuke's GeneratePluginHashes target, including the PluginRegistry rebuild it
  needed and the version-stamping hazard that rebuild carried
- the Generate / Verify / Commit steps in build_dotnet.yml, and that job's
  write permissions
- the plugin-hash half of release.yml's generated-files PR

This also makes commit-to-commit reproducibility unnecessary, so
EnableSourceControlManagerQueries=false is reverted and SourceLink is restored.

Verified on a clean Release build: all 21 table entries match the SHA256 of the
DLLs shipped in bin/Release/plugins and pluginsx86, with the commit sha back in
InformationalVersion. Debug and Release both generate 21 entries. Full suite
passes: 1491 passed, 7 skipped, 0 failed.
@Hirogen
Hirogen merged commit 5fa1381 into Development Jul 28, 2026
3 checks passed
@Hirogen
Hirogen deleted the fix/build-time-plugin-hashes branch July 28, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant