components-web-app / components-web-app/api-components-bundle

Tool: find orphaned ComponentGroups and ComponentPositions

Open
#190 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
32
Forks
8
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the ComponentGroup and ComponentPosition persistence models and the Symfony console-command entry points; define report-mode checks for the three orphan categories and the optional --fix behavior. Done means the command can report these records read-only and coverage verifies its results.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
backend, cli, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.