Skip to content

#570 Update NuGet packages; fix the worker's content-staging retention job - #575

Merged
ajs-uk-dev merged 2 commits into
mainfrom
feaure/570-update_nuget_packages
Oct 9, 2026
Merged

ajs-uk-dev merged 2 commits into
mainfrom
feaure/570-update_nuget_packages

Conversation

@ajs-uk-dev

@ajs-uk-dev ajs-uk-dev commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #570.

Every NuGet package is on its latest release that adds no cost. Every production project now reports no known vulnerabilities (dotnet list package --vulnerable --include-transitive). One Moderate advisory remains, in a test-only package; see Known limit.

What changed

Package updates. The upgrades were made in Visual Studio. Three of them needed code changes:

Package Change Why
Refit 13 → 16 Infrastructure references Refit.Reflection Refit 16 builds requests at compile time. IZendeskApi.GetTicketsForView takes a Dictionary query that can't be flattened at compile time (warning RF006). Without the reflection builder, resolving the Zendesk client throws NotSupportedException. The worker crash-looped and 11 unit tests failed. RF006 is still reported as a warning; it's now only a notice.
GovUk.Frontend.AspNetCore 4.4 → 5.0 [DateInput(ErrorMessagePrefix = …)] on the three window-admin dates: exercise start and end, and next opportunity <govuk-date-input> now throws without a prefix, so those pages returned an error page. The prefixes keep the wording users saw before ("Next opportunity must be a real date").
GovUk.Frontend.AspNetCore 5.0 .gitignore entries for the GOV.UK Frontend files 5.0 no longer serves the GOV.UK CSS, JS, fonts and icons from the assembly. It copies them into wwwroot on every build. They come from the package, so they aren't committed. The app's own images in wwwroot/assets/images stay tracked.
Microsoft.Playwright 1.62 → 1.63 E2E image v1.63.0-noble The bindings and the image's Chromium must match.

Directory.Packages.props cleanup. The file only applies to the projects under src/. The test projects set their own versions in their .csproj files, so the test-package entries in props did nothing and had drifted, for example Playwright 1.62 vs 1.63. I removed 17 entries that nothing in src/ references:

  • test packages: xunit, the xunit runner, SkippableFact, xRetry, NSubstitute, coverlet, Test.Sdk, both Playwright packages, Testcontainers.PostgreSql and ImageSharp
  • never referenced at all: the three NUnit packages, Microsoft.Extensions.Hosting, Options.ConfigurationExtensions and Cryptography.Pkcs

The file is now sorted, with a comment saying it doesn't reach tests/. The Playwright pin check (scripts/check-playwright-pin.sh), the CI browser-cache key and docs/E2E-Playwright.md were all reading the dead entry; they now read the E2E .csproj.

Worker bug fix (pre-existing, found during the upgrade). ContentStagingSessionRetentionJob, added in #354, looks up IContentStagingSessionStore from a new scope on each hourly run. The worker deliberately skips AddPersistenceDependencies and registers its persistence services by hand, and this store was never added. So since 1 September every run has thrown, logged "Content staging session retention tick failed", and deleted nothing. Abandoned import previews, each holding a whole parsed CMS bundle, were only removed when someone started another import. Host startup didn't catch it, because the job only looks the store up when it runs, and its unit tests pass the store in directly.

  • The worker's registrations move unchanged from Program.cs into WorkerServiceExtensions.AddWorkerServices, plus the one missing line.
  • RulesEngineWorkerProgramTests checks the text of the worker's startup code. It now reads both files.

Known limit

SixLabors.ImageSharp stays on 3.1.12 in the E2E project. GHSA-gwg2-r3hj-4w44 (Moderate) is only fixed in 4.1.2. ImageSharp 4 fails the build without a Six Labors licence key, which #570 rules out as added cost. The exposure is small:

  • it's a test-only dependency that is never deployed
  • it only reads PNG screenshots the suite takes itself

Dependabot PR #572 proposes the same 4.1.2 bump and will fail for the same reason. It should be closed, or ImageSharp added to Dependabot's ignore list, unless DfE takes a licence.

Verification

All run locally on this branch, with the containers rebuilt from it:

Suite Result
Unit 6,439 of 6,439 pass
Integration 997 of 997 pass
E2E (Linux Playwright container, make test-e2e) 305 pass, 2 skipped (the usual two)
  • web: /healthcheck returns 200. /govuk-frontend.min.css, .min.js, the fonts, favicon.ico and manifest.json all return 200 from the published image.
  • rules_engine: stays up. Its first maintenance run logs 0 exceptions; before the fix it logged the retention failure.
  • Builds: all projects build with 0 errors. scripts/check-playwright-pin.sh passes (NuGet 1.63.0 == image v1.63.0).

Tests added

IntegrationTests/Worker/WorkerMaintenanceJobsTests builds the worker's real service registrations (AddWorkerServices) against the Testcontainers Postgres:

  • Every maintenance job runs once through that setup. It finds the jobs by namespace, so a future job that isn't wired into the test fails it.
  • The content-staging job deletes an expired session row.

Both failed with the production error ("No service for type IContentStagingSessionStore") before the store was registered.

Andy Smith and others added 2 commits October 9, 2026 11:02
Bumps every package to its latest release that adds no cost, and fixes what
the majors broke:

- Refit 16 builds requests at compile time. IZendeskApi.GetTicketsForView takes
  a Dictionary query it cannot flatten (RF006), so Infrastructure now references
  Refit.Reflection; without it resolving the Zendesk client threw at startup and
  the rules-engine worker crash-looped.
- GovUk.Frontend.AspNetCore 5 copies the GOV.UK Frontend build into wwwroot on
  every build (it no longer serves it from the assembly) - those paths are
  gitignored - and <govuk-date-input> now throws without an error-message
  prefix, so the three window-admin dates carry [DateInput(ErrorMessagePrefix)]
  with the wording they rendered before.
- SixLabors.ImageSharp stays on 3.1.12 in the E2E project: 4.x fails the build
  without a paid Six Labors licence key.

Directory.Packages.props only reaches the projects under src/, so its test
package entries were never used and had drifted from the versions the test
projects pin. Those, plus the NUnit, Hosting, Options.ConfigurationExtensions
and Cryptography.Pkcs entries nothing references, are removed (17 in all).

The Playwright pin check, the CI browser-cache key and the docs read the E2E
.csproj instead, and the E2E image moves to v1.63.0-noble to match the bindings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… job needs

ContentStagingSessionRetentionJob (#354) resolves IContentStagingSessionStore
from a fresh scope each tick. The worker opts out of AddPersistenceDependencies
and registers its persistence services by hand, and this one was never added,
so every hourly tick since 1 September has logged "No service for type ...
IContentStagingSessionStore" and purged nothing. Abandoned previews - each a
whole parsed CMS bundle - were only removed when someone started another import.

The worker's registrations move out of the top-level Program into
WorkerServiceExtensions.AddWorkerServices, unchanged apart from the missing
store, so a test can build the container the worker actually runs with.
WorkerMaintenanceJobsTests runs every Maintenance job's tick through it against
Postgres, and fails for any new job that is not wired into it. It failed with
the production error before the registration was added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ajs-uk-dev
ajs-uk-dev merged commit fee9b5d into main Oct 9, 2026
8 checks passed
@ajs-uk-dev ajs-uk-dev mentioned this pull request Oct 9, 2026
11 tasks done
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.

Update NuGet packages in solution

2 participants