Files

2.8 KiB

H4 Host injection: code summary

Built 2026-11-16 on feature/hero-module. The CI solution filter is green (Core 921, Hero 141, Offerings 212, Availability 171, Identity 145, Api 47, Contact 349, Master 61). The Api tests run the whole chain on the master host with a real MariaDB.

Area What
Shared data block ICmsDataBlockContributor and CmsDataBlockTransform in Core (Hosting/Website/CmsDataBlock.cs), registered next to the injector in both website modes. Keys follow the contributors order (100 offerings, 110 banners, 200 hero); a failing contributor fails the whole block, so the page keeps its baked block
Offerings OfferingsHtmlTransform no longer writes the block; OfferingsDataContributor and BannersDataContributor supply offerings and banners. The block is byte-for-byte what it was (the existing assertions on shape, escaping and the ASF pipeline test pass unchanged apart from calling the new transform)
Hero regions HeroPictureRenderer (pure) writes the <picture> region and the preload links exactly as the ASF golden files; HeroHtmlTransform fills <!--CMS:HERO-HTML--> and <!--CMS:HERO-PRELOAD--> and leaves the page alone when the hero is unusable
Hero data HeroDataContributor adds hero (the full public hero with all slides, or null)
Missing files HeroPageModel checks that the files of the first slide exist in the media store; when they do not, region, preload and data are left baked (no broken first image)
Golden files ASF commit 13f78c4 copied to Hero.Tests/Golden/host-injection/hero (6 cases, region and preload byte-exact)
Tests golden files, renderer details (focus, no tall, no AVIF, first usable slide, encoding, property test that nothing breaks out of the HTML), transform behaviour, page model (files present or missing), data block order and escaping (Core), and a full pipeline test on the master host: no hero leaves the baked page and hero: null; a hero made through the services shows in the first HTML with the preload and the data block (same JSON as GET /api/v1/hero), every variant address is served immutable, 304 works, switching the hero off and losing the media directory both restore the baked page

Found and fixed while building

  • The EF MySQL provider cannot translate IN on a Guid list parameter (found only by the real-database test; the in-memory tests hid it): the images of a save are now read and filtered in memory (a few dozen rows).
  • Re-uploading a photo whose row exists but whose files were lost (a restored database without the media directory) now repairs the files instead of returning the broken image.

Not yet

The admin screens (H5), the seed script, the smoke test and the docs (H6), the LCP measurement on the test hosts (needs the sites with the markers).