Skip to content

Cover the SSR re-render mode in CI: finish the astro example + add an admin-astro job #237

Description

@djay

Problem

The server-rendered re-render mode — the bridge's findChangedUnit diff that picks the smallest changed unit and does a targeted outerHTML swap instead of a full-page innerHTML swap (packages/hydra-js/hydra.src.js, the onEditChange → POST /render → swap handler) — has zero CI coverage.

It's only invoked by pure-SSR frontends that register a server-render endpoint (astro, nextjs). Reactive frontends (mock, nuxt) never call it. And the SSR frontends have no CI-gated admin tests:

  • admin-nextjs / admin-f7 projects exist but run in no CI job (opt-in only).
  • There is no admin-astro project at all.

This was made concrete in #236: findChangedUnit only scanned the items region, so editing a block in a non-items region (e.g. a footer) returned { unit: 'page' } → a full-page swap that destroys the contenteditable cursor every keystroke. That bug could only be caught by a unit test (packages/hydra-js/findChangedUnitRegions.test.js) — there was no integration path to exercise it, because the one render mode that uses findChangedUnit isn't tested end-to-end anywhere.

Why we can't just run the existing admin suite on astro today

The astro example (docs/examples/test-astro, the architecture proof from #229, "commit 1/3") isn't complete enough:

  • It is items-onlysrc/pages/api/render.ts literally types its input as blocks_layout: { items: string[] }, so it has no concept of a footer (or any multi-region) layout. (The same .items assumption we've been hunting elsewhere.)
  • The renderer is generic/minimal — it doesn't handle the block types the integration suite needs (columns, grid, teaser, listing, …).

So running the admin suite against it today would fail across the board for missing-renderer reasons, not real bugs.

Scope

  1. Finish the astro example (essentially feat(astro): Astro example frontend (architecture proof, commit 1/3) #229 commits 2/3, 3/3):
    • Multi-region rendering: walk blocks_layout.<region> (items, footer, …), not just items, in render.ts + [...slug].astro (mirror the test-frontend / nuxt footer-region rendering, incl. a #footer-content area).
    • Block-type coverage the integration suite exercises (slate, columns, grid, teaser, listing, …) — enough to pass tests-playwright/integration.
  2. Add an admin-astro Playwright project (modelled on admin-nuxt) pointing the iframe at the astro frontend, with its webServer entry gated like the other example frontends.
  3. Add a parallel CI job (test-astro-admin) running the integration suite (or a focused subset that drives editing) against astro.

Payoff

Context

Follow-up from the review of #236 (region-aware nested-container merge + page-level findChangedUnit). Tracks the only piece of regions-awareness we deliberately left to a unit test because no SSR integration coverage exists yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions