Skip to content

Projects 0.8.0: Sub-projects inside projects and project assignees

Projects 0.8.0 lets a project sit inside another project as one of its steps. The sub-project keeps its own tasks, and its status, progress, hours and completion roll up into the parent. Projects also get an assignee: a team, a department or a person.

Sub-projects

When adding a step to a project, you can now create a new sub-project or nest an existing standalone project, instead of picking a task from the library. On the project page the sub-project row behaves like any task: drag it to reorder, give it dependencies or remove it. It can be expanded to show its own tasks inside the parent, opened with Open, or turned back into a standalone project with Make standalone. Removing it removes its whole subtree.

The sub-project is the source of truth. Its status, progress, planned hours and completion are copied up the tree each time it changes, to a fixed depth. An empty sub-project does not pull the parent’s progress down. A project can only have one parent, and nesting that would create a loop is refused.

Sub-projects do not appear as separate rows in the top-level project list, buckets, counts or the workload tile; you reach them through their parent. If the link disappears, the project shows up at the top level again. Creating a project from a template that contains sub-templates now copies the whole tree.

Project assignees

The project form gets an assignee picker with the same team, department or person choice that tasks already have.

Fixes

  • The progress on a project page now leaves out empty sub-projects, the same way the dashboard already did.
  • Deleting a project that is still nested in another is now refused cleanly instead of raising a database error.

Upgrading

Projects 0.8 needs PhoenixKit 1.7.128 or later: core’s migrations V127 and V128 add the sub-project link and the project assignee. Update core, run its migrations, then update the module.

Full release notes: Projects 0.8.0

0.8.0 · 1 June 2026

Nested sub-projects — an assignment can now embed a whole child project in its parent’s timeline instead of a task template, so a project becomes a first-class step inside another project. The child is the source of truth; its status, progress, planned hours, and completion roll up the tree (depth-capped, empty children neutral) and the linking row behaves like any task — drag to reorder, give it dependencies, remove it. Also adds a polymorphic assignee on projects (and therefore sub-projects), mirroring the one-of team/department/person shape assignments already use.

Added

  • Sub-projects (core V127 — child_project_uuid on phoenix_kit_project_assignments). An assignment carries exactly one of task_uuid / child_project_uuid (DB XOR check + Assignment.validate_task_xor_child/1). Context API: create_subproject/2 (fresh child), link_subproject/2 (nest an existing standalone project), detach_subproject/1 (pop a child back out as standalone), available_projects_to_link/1. The single-parent guarantee is a partial unique index; cycles are blocked by an ancestor check serialized with a transaction-scoped advisory lock.
  • Rollup — a linking row carries denormalized status / progress_pct / hours / completion synced from the child via Assignment.subproject_changeset/2; recompute_project_completion/1 propagates changes up the parent chain after each child settles. Empty sub-projects are neutral in the progress average (kept in the count, dropped from the denominator).
  • Projects.project_tree_summary/1 — recursive per-node dashboard summary (task breakdown + nested child summaries), rendered by the reworked running_card component.
  • Assignee on projects (core V128 — polymorphic assigned_team_uuid / assigned_department_uuid / assigned_person_uuid, one-of via a num_nonnulls(...) <= 1 CHECK + Project.validate_single_assignee/1). Projects.get_project_with_assignee/1 preloads it.
  • Helpers — Assignment.label/2 (locale-aware title for a task or sub-project, single render source of truth), Assignment.subproject?/1, and Statuses.lock_status_source/2 (server-side freeze of the status source once a project has started).
  • UI — sub-project rows on ProjectShowLive (expand/collapse inset child tasks, “Make standalone”, “Open”, remove-with-subtree), AssignmentFormLive sub-project mode (“create new child” / “nest existing project”), and a project-assignee picker on the project form.

Changed

  • Minimum phoenix_kit is now ~> 1.7.128 — the release shipping V127 (child_project_uuid, task_uuid made nullable, the task/child XOR check, single-parent unique index) and V128 (the project assignee columns). The features can’t run on older cores.
  • Top-level listings, buckets, counts, and the workload tile exclude sub-projects (exclude_subprojects/1) — an embedded child is reached through its parent’s timeline, not as a standalone row. The exclusion is self-correcting: if the linking row disappears, the child re-surfaces at the top level.
  • Cloning a template deep-clones its sub-project subtree — create_project_from_template/2 recursively instantiates each sub-template into a fresh child project (the single-parent index forbids sharing), carrying multilang content, settings, status source, and assignee.
  • Deleting is subtree-aware — delete_project/1 and the sub-project clause of delete_assignment/1 tear down the whole child subtree in one transaction (the child_project_uuid FK is ON DELETE RESTRICT, so children are removed explicitly, not orphaned).

Fixed

  • Show-page progress matches the dashboard — the project header now excludes empty sub-projects from the progress denominator, the same way project_summaries/1 and project_tree_summary/1 already did.
  • delete_project/1 on a still-linked sub-project returns {:error, :still_a_subproject} instead of raising Ecto.ConstraintError on the ON DELETE RESTRICT FK mid-transaction.
  • No nil-task crash on crafted events — the start / complete / reopen / track_progress / update_progress handlers log activity metadata via the nil-safe Assignment.label/1, so an event aimed at a sub-project linking row (which has no task) can’t dereference a nil task.
  • PR #16 review follow-ups — clone fidelity (multilang/settings/assignee carried into deep clones), the link-cycle race (advisory lock), and child-task dependency rendering inside expanded sub-projects.

Projects 0.8.0. Install or update: {:phoenix_kit_projects, "~> 0.8"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.