Skip to content

Spike multi-page architecture#11026

Draft
ChrisBAshton wants to merge 24 commits intomainfrom
spike-multi-page-architecture
Draft

Spike multi-page architecture#11026
ChrisBAshton wants to merge 24 commits intomainfrom
spike-multi-page-architecture

Conversation

@ChrisBAshton
Copy link
Contributor

@ChrisBAshton ChrisBAshton commented Jan 21, 2026

TODO:

  • Publish all draft child documents when publishing parent doc.

    • NB, we ONLY want publish child editions FROM THE PARENT EDITION. Don't allow independent publishing.
  • When creating new edition of parent (and its children), duplicate the EditionRelationships accordingly.

  • Currently, org associations are copied from parent to child when parent is updated. We need to also copy from parent to child on child instantiation.

  • Hide 'about' page from http://whitehall-admin.dev.gov.uk/government/admin/standard-editions/choose_type?group=all

  • Surface child page validation errors on parent page (maybe? But think perf issues if we're calling valid?(:publish) on a doc with >10 child pages). We at least need to do this when publishing.

  • Add callback to re-present parent page if child doc is updated (even just draft updates, so the draft preview of parent page will be updated)

  • Update the PR description below, accordingly.

Context

We need to support multi-page architectures for config-driven documents, in a way that scales for our requirements and in a way that solves the myriad of problems our existing implementations have.

MVP for multi-page architecture:

  • A StandardEdition edition can have 0..* child documents.
  • Creating a new parent edition draft automatically creates a new draft of its children.
  • We should have the data to be able to surface proper 'diffs' between versions of parent documents, including their children. So each parent edition should probably be linked to specific editions of its children - not their document IDs.
  • There is one publishing workflow, one set of associations, one changelog (all done via the parent)
  • Roughly speaking, this is how HtmlAttachments currently work.

But built flexibly enough to accommodate a future where:

  • Allow publishing of child pages in isolation
  • We may want to ship independent associations, changelogs and publishing workflows, e.g. be able to freely make a 'major' update to a child document. (In that world, we don't necessarily need to create a new draft of all child editions on parent edition draft creation - just copy the IDs forwards).
  • Roughly speaking, this is how Manuals currently work.

What this spike does

  • Adds way of expressing child doc relationship in the schemas
  • Adds "ChildDocuments" concern which is pulled into StandardEdition
  • Sets up EditionRelationships table to power the children and parent_edition attributes in StandardEdition::ChildDocuments
  • Adds "Child documents" section to parent edition UI
  • Reuses "Choose type" workflow (duplicated) to choose child doc to create
  • Reuses "New edition" page - with conditionals - to show UI for creating the child doc, omitting irrelevant sections like Associations/Settings, and adding a confirmation at the top of the form that we are creating a child document associated with a specific parent document.
  • Supports creating a child Topical Event About Page (and surfacing this on the parent edition)
  • Strips out irrelevant parts of the UI

What it doesn't cover:

  • Coordinated publishing (i.e. clicking Publish on parent should also publish its children)
  • Coordinated validation (i.e. it should not be possible to publish a parent if any of its children are invalid)
  • Edition lifecycles (i.e. creating a new draft of the parent should also create new drafts of its children, and update the EditionRelationships accordingly. But also need to NOT create new editions of children that are already withdrawn etc.)
  • Inheriting the organisation associations and change histories of their parents, at publish time.
  • Child Edition variances, and how to enforce them:
    • Topical Event About page - 0..1. Fixed slug about, variable title.
    • Corporate Information Pages - 0..n. Fixed types/slugs (like 'About'), and fixed title(?)
    • Manual Sections - 0..*. Reorderable.
  • Hiding child pages from other areas of Whitehall (e.g. Search, 'My draft documents')
  • Tests

Screenshots

New section for child documents, on parent page:

Image

Choosing child document screen;

Image

Filling in the child document page:

Image

Child document surfaced on the parent page:

Screenshot 2026-01-22 at 08 48 57

Invalid child document making it impossible to publish the parent doc:

Screenshot 2026-02-25 at 17 11 50

Why

We know we'll need to support topical event about pages in the near future. That will be our first foray into multi-page architecture in the config-driven world. This PR is a playground to explore some ideas / complexities to do with that.


⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

This application is owned by the Whitehall Experience team. Please let us know in #govuk-whitehall-experience-tech when you raise any PRs.

Follow these steps if you are doing a Rails upgrade.

@ChrisBAshton ChrisBAshton force-pushed the spike-multi-page-architecture branch 5 times, most recently from 9184c12 to 209e1b1 Compare January 22, 2026 09:06
@ChrisBAshton ChrisBAshton force-pushed the spike-multi-page-architecture branch from a8bfb83 to e7e39e3 Compare February 2, 2026 09:22
@ChrisBAshton ChrisBAshton force-pushed the spike-multi-page-architecture branch 3 times, most recently from 7c78d8c to 9e3b834 Compare February 12, 2026 15:03
@ChrisBAshton ChrisBAshton force-pushed the spike-multi-page-architecture branch 3 times, most recently from f172a71 to 1f4065e Compare February 25, 2026 14:39
- Adds way of expressing child doc relationship in the schemas
- Adds "Child documents" section to parent edition UI
- Reuses "Choose type" workflow (duplicated) to choose child doc
  to create
- Reuses "New edition" page - with conditionals - to show UI for
  creating the child doc, omitting irrelevant sections like
  Associations/Settings, and adding a confirmation at the top of
  the form that we are creating a child document associated with
  a specific parent document.

Screenshots:

<img width="729" height="555" alt="Image" src="https://github.com/user-attachments/assets/c2c1c583-337b-4771-a630-d10e174d063c" />
<img width="518" height="257" alt="Image" src="https://github.com/user-attachments/assets/a6015e5f-021c-4fde-ba59-72de5d4f590d" />
<img width="1844" height="4694" alt="Image" src="https://github.com/user-attachments/assets/7ff08b5d-78fa-4eb8-804d-cae5ad4bc74b" />
We'll call this at various points in the UI and logic.
For now, we only want the option to create/edit drafts, delete
drafts, and theoretically to unpublish/withdraw. But scheduling
and publishing and submitting for 2i in isolation is not part of
MVP.
No history section here (for MVP, child documents should inherit
the history of their parents). And no fact checking either.
Just to show it can be done. Seems to work 🎉
This reverts commit 3d5bd1f.

It feels unclean architecturally. The true fix is likely that we'll
want to send the Organisations at publish time, inheriting at the
PRESENTER level rather than trying to model it all before then.
This should really be done with configs too, e.g.

`can_set_organisation: false`
These are VERY noisy and make it difficult to spot debug / puts
statements when manually testing things.

We should disable this by default and only re-enable it when
debugging database queries / bottlenecks.
We know we want children documents to 'inherit' some of the
associations of the parent. We could do this at presenter time
but then we have to patch up all the parts of the workflow and UI
where it is expected that the organisations have already been set.
Doing it that way would also prevent us from being able to make
child document associations configurable in future. So whilst the
callback approach in this commit is "yet another callback" to have
to maintain, it seems the least worst option.
@ChrisBAshton ChrisBAshton force-pushed the spike-multi-page-architecture branch from 1f4065e to a61b656 Compare February 25, 2026 16:28
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.

1 participant