Content
View differences
Updated by Oliver Günther about 7 hours ago
This feature covers **global** sub-types, managed by instance administrators and available to every project. Project-owned sub-types, the project permission, in-project visibility isolation, and promotion to global are a separate, larger feature (to be creatd)
**As an** OpenProject administrator instance administrator or project administrator
**I want to** create and manage global sub-types under an existing work package type type, owned either globally or by my project
**so that** I can offer project-specific or instance-wide variations of a type that present as the parent but can behave differently.
## Acceptance criteria
* I can create a global sub-type under any root type. type, choosing whether it is global or owned by a specific project. _(F0-C1, F0-C4)_ F0-C4, F0-C5)_
* A sub-type cannot itself have sub-types; the system enforces a single level. _(F0-C1)_
* A sub-type cannot be its own parent, and standard types cannot be sub-typed or re-parented. _(F0-C1)_
* A new sub-type starts with every aspect (workflow, form configuration, settings) linked to its parent, so it behaves exactly like the parent until I change it. _(F0-C1, F0-C2)_
* A project administrator can create and manage only sub-types owned by their project; instance administrators manage global sub-types. _(F0-C4, F0-C5)_
* A sub-type appears in administration nested under its parent and labelled with its composite name ("Bug: Hardware"). _(F0-C3, F0-C4)_ F0-C5)_
* A sub-type has its own administrative name but no own color; its display always uses the parent's color. _(F0-C3)_
* The system prevents creating a cyclic dependency between reuse sources. _(F0-C2)_
* The entire capability is hidden and inert unless the `work_package_subtypes` feature flag is enabled. _(F0-C0)_
## Implementation chunks
* **F0-C0 — Feature flag.** Register `work_package_subtypes` (`allow_enabling: true`). Gate all downstream UI on it.
* **F0-C1 — Data model.** Migration on `types`: `parent_id` (FK to types) and the reuse source columns `workflow_source_id`, `form_source_id`, `settings_source_id` (nullable FKs to types). Associations (`parent`, `children`), helpers (`root`, `family`), scopes (`roots`, `subtypes`). Hierarchy validations (single level, no self-parent, standard-type guard, no re-parent with work packages). Name uniqueness among global types scoped to `parent_id`. (The `project_id` ownership column is added by [Feature 8](https://community.openproject.org/feature-8-project-owned-subtypes.md).)
* **F0-C2 — Reuse resolution and cycle prevention.** `effective_workflow_type`, `effective_form_type`, `effective_settings_type` walking the `*_source_id` chain to the owning type. Write-time `aspect_sources_acyclic` validation, a database `CHECK` blocking direct self-links per aspect, and a visited-set guard in the resolution walk. See [appendix-cycle-prevention.md](https://community.openproject.org/appendix-cycle-prevention.md).
* **F0-C3 — Display helpers.** `displayed_name` (root name), `displayed_color` (root color), `composite_name` ("parent: name") for admin, hover, and API.
* **F0-C4 — Global admin UI.** Create, edit, rename, reorder, and delete global sub-types nested under their parent in the global type administration. Extend `WorkPackageTypes::CreateService` to accept `parent_id`. Reuse the tabbed `work_package_types` admin namespace.
## Permissions and visibility considerations
* **To whom is this feature visible?** Instance administrators (the existing global type administration). admins (global sub-types); project members with `:manage_subtypes` (project-owned sub-types).
* **When is it not visible?** Flag off; non-admin users. users without `:manage_subtypes` in the project; project-owned sub-types are not visible or activatable outside their owning project.
## Translation considerations
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><thead class="op-uc-table--head"><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">English</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">German (verify)</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">French (verify)</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Spanish (verify)</p></th></tr></thead><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p">Sub-type</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Untertyp</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Sous-type</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Subtipo</p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p">Parent type</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Übergeordneter Typ</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Type parent</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Tipo principal</p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p">Manage sub-types</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Untertypen verwalten</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Gérer les sous-types</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Gestionar subtipos</p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p">Source type</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Quelltyp</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Type source</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Tipo de origen</p></td></tr></tbody></table></figure>
* Document the composite separator (`": "`) used in admin, hover, and API.
## Out of scope
* Project-owned sub-types, the `:manage_subtypes` project permission, in-project visibility isolation, and promotion to global (Feature 8).
* Per-aspect reuse behavior beyond the default parent links (Features 1, 2, 3).
* Project activation and the one-per-family rule (Feature 5).
* Display routing across the product (Feature 4).
**To be informed/consulted teams:** Backend, Frontend, Design/UX, Product, QA, Documentation, Architecture/Tech-lead.
**As an** OpenProject administrator
**I want to** create and manage global sub-types under an existing work package type
**so that** I can offer
## Acceptance criteria
* I can create a global sub-type under any root type.
* A sub-type cannot itself have sub-types; the system enforces a single level. _(F0-C1)_
* A sub-type cannot be its own parent, and standard types cannot be sub-typed or re-parented. _(F0-C1)_
* A new sub-type starts with every aspect (workflow, form configuration, settings) linked to its parent, so it behaves exactly like the parent until I change it. _(F0-C1, F0-C2)_
* A
* A
* A sub-type has its own administrative name but no own color; its display always uses the parent's color. _(F0-C3)_
* The system prevents creating a cyclic dependency between reuse sources. _(F0-C2)_
* The entire capability is hidden and inert unless the `work_package_subtypes` feature flag is enabled. _(F0-C0)_
## Implementation chunks
* **F0-C0 — Feature flag.** Register `work_package_subtypes` (`allow_enabling: true`). Gate all downstream UI on it.
* **F0-C1 — Data model.** Migration on `types`: `parent_id` (FK to types) and the reuse source columns `workflow_source_id`, `form_source_id`, `settings_source_id` (nullable FKs to types). Associations (`parent`, `children`), helpers (`root`, `family`), scopes (`roots`, `subtypes`). Hierarchy validations (single level, no self-parent, standard-type guard, no re-parent with work packages). Name uniqueness among global types scoped to `parent_id`. (The `project_id` ownership column is added by [Feature 8](https://community.openproject.org/feature-8-project-owned-subtypes.md).)
* **F0-C2 — Reuse resolution and cycle prevention.** `effective_workflow_type`, `effective_form_type`, `effective_settings_type` walking the `*_source_id` chain to the owning type. Write-time `aspect_sources_acyclic` validation, a database `CHECK` blocking direct self-links per aspect, and a visited-set guard in the resolution walk. See [appendix-cycle-prevention.md](https://community.openproject.org/appendix-cycle-prevention.md).
* **F0-C3 — Display helpers.** `displayed_name` (root name), `displayed_color` (root color), `composite_name` ("parent: name") for admin, hover, and API.
* **F0-C4 — Global admin UI.** Create, edit, rename, reorder, and delete global sub-types nested under their parent in the global type administration. Extend `WorkPackageTypes::CreateService` to accept `parent_id`. Reuse the tabbed `work_package_types` admin namespace.
## Permissions and visibility considerations
* **To whom is this feature visible?** Instance administrators (the existing global type administration).
* **When is it not visible?** Flag off; non-admin users.
## Translation considerations
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><thead class="op-uc-table--head"><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">English</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">German (verify)</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">French (verify)</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Spanish (verify)</p></th></tr></thead><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p">Sub-type</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Untertyp</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Sous-type</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Subtipo</p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p">Parent type</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Übergeordneter Typ</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Type parent</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Tipo principal</p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p
* Document the composite separator (`": "`) used in admin, hover, and API.
## Out of scope
* Project-owned sub-types, the `:manage_subtypes` project permission, in-project visibility isolation, and promotion to global (Feature 8).
* Per-aspect reuse behavior beyond the default parent links (Features 1, 2, 3).
* Project activation and the one-per-family rule (Feature 5).
* Display routing across the product (Feature 4).
**To be informed/consulted teams:** Backend, Frontend, Design/UX, Product, QA, Documentation, Architecture/Tech-lead.