You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build(aot): enable PublishTrimmed and PublishAot now Discord.Net is gone #430
Original prompts (live chat, while working on #423 / PR #428):
with the discord lib gone I'm guessing we're not too far from enabling PublishTrimmed and PublishAot ?
we should raie that as a follow on issue after this merges
that was "for after" not wait until it merges to raise
Goal
Enable PublishTrimmed and then PublishAot for src/BuildBot/BuildBot.csproj (currently both false). Work on this starts after PR #428 (Discord.Net replaced by a webhook) has merged.
Microsoft.Extensions.Http.Polly (Polly v7) is not trim-annotated; Microsoft.Extensions.Http.Resilience (Polly v8) is the AOT-friendly option but is a new package needing owner sign-off.
Note from PR #428 (owner, live chat: "q19 isn't that for when we're doing the trimming pr?"): after #428 rewrote DiscordMessageSender as a BackgroundService, no code in src uses Rx any more. System.Reactive 7.0.0 and System.Interactive.Async 7.0.1 are still referenced from src/BuildBot.ServiceModel/BuildBot.ServiceModel.csproj. Try removing both as part of this issue (keep System.Interactive.Async if the build shows its System.Linq async extensions are still used).
Raised in the PR #428 code review (round 2): with Discord.Net gone, check whether anything still needs ICU. If nothing does, set InvariantGlobalization=true and switch from the chiseled-extra base image to the plain chiseled one (smaller image, less CVE surface). See #428 (comment).
src/BuildBot/BuildBot.csproj - set PublishTrimmed=true, then PublishAot=true; remove Serilog.Enrichers.Demystifier; set InvariantGlobalization=true if nothing needs ICU; review/prune TrimmerRootAssembly entries.
src/BuildBot/Helpers/ServerStartup.cs (and any Serilog setup) - drop the .Enrich.WithDemystifiedStackTraces() call.
src/BuildBot.CloudFormation/*, src/BuildBot.Discord/* (and csproj files) - fix trim/AOT warnings found in a trial publish; Polly v7 (Microsoft.Extensions.Http.Polly) usage in DiscordSetup.cs / CloudformationSetup.cs is the likely hotspot (see open questions).
Dockerfile - if invariant globalization is viable, switch to runtime-deps:11.0-resolute-chiseled and update the comment. The base image stays runtime-deps, which suits AOT.
Related unit tests (*SetupTests.cs) and CHANGELOG.md - updated to match.
Approach
Work in small, separately committed steps. (1) Remove unused Rx packages and confirm the build. (2) Run a trial dotnet publish -r linux-x64 -p:PublishTrimmed=true and fix every trim warning (warnings are errors). (3) Remove Demystifier. (4) Repeat with -p:PublishAot=true and fix AOT warnings, confirm AWSSDK.CloudFormation 4.x is compatible. (5) Check whether ICU is needed; if not, set InvariantGlobalization=true and use the plain chiseled image. (6) Turn the properties on in the csproj and smoke-test the published binary (startup, --health-check, /ping). Trial-publish results will be reported on the PR.
Test strategy
Existing unit tests must pass with the coverage ratchet intact. Evidence of success: dotnet publish for linux-x64 with PublishTrimmed and with PublishAot, both with zero warnings, and the published binary starting and answering --health-check//ping. Local container build if the sandbox allows it.
Assumptions
Polly v7 (Microsoft.Extensions.Http.Polly) may emit trim/AOT warnings; replacing it needs a new package.
The AOT toolchain (clang/zlib) is available for the trial publish; if not, AOT validation is left to CI and noted on the PR.
The TrimmerRootAssembly entries may be obsolete; they are removed only if the publish and smoke test prove it safe.
Open questions
If Polly v7 is not trim/AOT-clean, may I add Microsoft.Extensions.Http.Resilience (Polly v8) as a new package? Otherwise I'd try to drop the Polly policies in favour of built-in handlers. Please approve the package or say which way to go.
If the trial shows AOT is blocked by a dependency I can't fix, should I deliver PublishTrimmed only and leave PublishAot=false with a follow-up issue?
Activity
credfeto commentedon Oct 15, 2026
Priority set by the repository owner in live chat:
Highlabel applied.credfeto commentedon Oct 15, 2026
Note from PR #428 (owner, live chat: "q19 isn't that for when we're doing the trimming pr?"): after #428 rewrote
DiscordMessageSenderas aBackgroundService, no code insrcuses Rx any more.System.Reactive7.0.0 andSystem.Interactive.Async7.0.1 are still referenced fromsrc/BuildBot.ServiceModel/BuildBot.ServiceModel.csproj. Try removing both as part of this issue (keepSystem.Interactive.Asyncif the build shows itsSystem.Linqasync extensions are still used).credfeto commentedon Oct 16, 2026
Raised in the PR #428 code review (round 2): with Discord.Net gone, check whether anything still needs ICU. If nothing does, set
InvariantGlobalization=trueand switch from the chiseled-extra base image to the plain chiseled one (smaller image, less CVE surface). See #428 (comment).dnyw4l3n13 commentedon Oct 19, 2026
Implementation Plan
Files to change
src/BuildBot.ServiceModel/BuildBot.ServiceModel.csproj- removeSystem.Reactive(andSystem.Interactive.Asyncunless the build shows its async LINQ extensions are still used), per the refactor(discord): replace Discord.Net bot login with a Discord webhook #428 follow-up note.src/BuildBot/BuildBot.csproj- setPublishTrimmed=true, thenPublishAot=true; removeSerilog.Enrichers.Demystifier; setInvariantGlobalization=trueif nothing needs ICU; review/pruneTrimmerRootAssemblyentries.src/BuildBot/Helpers/ServerStartup.cs(and any Serilog setup) - drop the.Enrich.WithDemystifiedStackTraces()call.src/BuildBot.CloudFormation/*,src/BuildBot.Discord/*(and csproj files) - fix trim/AOT warnings found in a trial publish; Polly v7 (Microsoft.Extensions.Http.Polly) usage inDiscordSetup.cs/CloudformationSetup.csis the likely hotspot (see open questions).Dockerfile- if invariant globalization is viable, switch toruntime-deps:11.0-resolute-chiseledand update the comment. The base image staysruntime-deps, which suits AOT.*SetupTests.cs) andCHANGELOG.md- updated to match.Approach
Work in small, separately committed steps. (1) Remove unused Rx packages and confirm the build. (2) Run a trial
dotnet publish -r linux-x64 -p:PublishTrimmed=trueand fix every trim warning (warnings are errors). (3) Remove Demystifier. (4) Repeat with-p:PublishAot=trueand fix AOT warnings, confirm AWSSDK.CloudFormation 4.x is compatible. (5) Check whether ICU is needed; if not, setInvariantGlobalization=trueand use the plain chiseled image. (6) Turn the properties on in the csproj and smoke-test the published binary (startup,--health-check,/ping). Trial-publish results will be reported on the PR.Test strategy
Existing unit tests must pass with the coverage ratchet intact. Evidence of success:
dotnet publishforlinux-x64with PublishTrimmed and with PublishAot, both with zero warnings, and the published binary starting and answering--health-check//ping. Local container build if the sandbox allows it.Assumptions
Microsoft.Extensions.Http.Polly) may emit trim/AOT warnings; replacing it needs a new package.TrimmerRootAssemblyentries may be obsolete; they are removed only if the publish and smoke test prove it safe.Open questions
Microsoft.Extensions.Http.Resilience(Polly v8) as a new package? Otherwise I'd try to drop the Polly policies in favour of built-in handlers. Please approve the package or say which way to go.PublishTrimmedonly and leavePublishAot=falsewith a follow-up issue?build(aot): prototype native AOT publish on the arm64 runner