Skip to content

Tool: find orphaned ComponentGroups and ComponentPositions #190

Description

@silverbackdan

Idea

A Symfony console command (and optionally an admin UI panel under site maintenance) that identifies:

  • Orphaned ComponentGroups — groups whose owning Layout/Page/Component no longer exists or no longer references them
  • Orphaned ComponentPositions — positions not linked to any active group
  • Unused components — components that appear in no ComponentPosition anywhere

Use case

Over time, as content is restructured and components are removed from pages, orphaned records accumulate. This tool surfaces them for review and cleanup.

How component group references work (important for orphan detection)

The DB reference field on ComponentGroup is always:

reference = "{groupName}_{locationReference || ownerIri}"

Where:

  • groupName — the group name set in the fixture builder or <CwaComponentGroup reference="..."> prop
  • locationReference — optional stable string (e.g. "global-nav") set via the fixture builder's locationReference arg or the Vue location-reference prop; stable across environments
  • ownerIri — the IRI of the owning Page/Layout/Component (e.g. /_/layouts/abc123); environment-specific

Groups using locationReference have stable, human-readable references. Groups without it have references tied to the owner's IRI — the console command can still detect these as orphaned by checking whether the owning entity still exists.

Notes

  • Read-only by default (report mode), with an optional --fix flag to delete
  • Self-contained: the API has direct DB access and doesn't need a front-end script to cross-reference. The equivalent Nuxt module issue (cwa-nuxt-module#240) has been closed in favour of this one.
  • Could live in a new "Application Maintenance" section of the admin panel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions