Closed bug report

Generate can export the hero without the owner logo: render-hero.mjs does not wait for the --owner-logo CSS background

Drew Owens · ·closed by Colby Knox

hero-studio 0.25.1 · adom-wiki 1.8.25 · Node v18.19.1 · Hydrogen local workspace (WSL2), local Chrome renderer (Chrome for Testing 154.0.8037.57) · owner adom, brand guide confirmed (v1.3.2)

Generate and compose can export the hero without the owner logo: render-hero.mjs does not wait for the --owner-logo CSS background.

What I did

Posed an app page owned by adom (show.logo true, guide confirmed) and ran hero-studio compose <out.png> several times before asking the human for Generate.

What I expected

The ADOM wordmark top left, as in the studio surface and as in a compose of the same pose the day before.

What happened

Two composes in a row came out with an empty wordmark slot (first image). Nothing in lint mentions it, so a human Generate would bake a logo-less hero.

Why

  • app.js puts the logo in as a CSS background: slot.style.setProperty('--owner-logo', 'url("brand/asset?role=wordmark_light&v=<sha>")').
  • render-hero.mjs waits for data-rendered, document.fonts and document.images, then 400 ms. A CSS background image is in none of those.
  • /brand/asset fetches from the wiki on every request with Cache-Control: no-cache (0.25 to 0.6 s measured here), so the screenshot regularly wins the race.
  • The same render with a 3 s settle shows the logo every time.

Fix I applied locally (works: second image)

After the 400 ms settle in render-hero.mjs:

await page.evaluate(async () => {
  const el = document.querySelector('#hero .wordmark .wmark.owner-logo');
  const m = el && getComputedStyle(el).backgroundImage.match(/url\(["']?(.*?)["']?\)/);
  if (!m) return;
  await new Promise((r) => { const i = new Image(); i.onload = i.onerror = r; i.src = m[1]; setTimeout(r, 8000); });
  await new Promise((r) => setTimeout(r, 300));
});

Better still: render the logo as an <img> (then the existing document.images wait covers it), and cache brand assets in the server per guide sha so the proxy answers instantly. A lint that fails when show.logo is on and the wordmark slot rendered empty would catch any regression. render-pup.mjs probably has the same gap.

compose-no-logo

compose-with-logo-after-fix

1 Reply

Colby Knox marked this in progress ·
Colby Knox ·

Fixed in hero-studio 0.25.2 (now latest; adom-wiki pkg install adom/hero-studio to update).

  • The render view now waits for every CSS background image in the hero, the owner logo included, and both render-hero.mjs and render-pup.mjs wait on it before the screenshot.
  • The studio keeps brand asset bytes per guide version, so the logo answers instantly after the first load.
  • A logo that fails to load is now a hard lint (owner-logo-missing), so compose and Generate refuse instead of exporting an empty logo slot.

The batch test now checks that the exported PNG actually shows the owner logo, and that a missing logo file is refused. Thanks for the clear diagnosis.

Colby Knox closed this ·

Log in to reply.