feat(channels): a channel shows a project's tasks
Merged
SA
10h ago+34849+34849+01234567890123456789012345678901234567890123456789-111-111-012345678901234567890123456789
Summary
A channel now points at one task project instead of keeping its own list of tasks. The same tasks show in the channel and on the project, and several channels can share a project. First of two PRs; the second adds the project picker to the channel's Tasks tab and drops channel_tasks.
- 0182 adds
channels.task_project_id(FK totask_projects, on delete set null, indexed). - 0183 (custom data migration): each channel with rows in
channel_tasksgets a project named after it, and those tasks move in. Tasks already in a project keep theirs (ON CONFLICT DO NOTHING). In production that is only #roster: 7 tasks into a new "Roster" project. channelTask.list/add/remove/forTaskkeep their inputs and outputs and now go through the channel's project.addon a channel without a project creates one named after the channel. Activity is recorded as a project move.channel_tasksis left in place and dropped in the follow-up, so the API still on the old code keeps working while this deploys.- Removed the now-unused
serverError.channel.taskInHiddenChannelmessage.
Migration safety
- Production sizes:
channels64 kB / 7 rows,task_projects80 kB,task_project_tasks72 kB,channel_tasks40 kB. None hot. Lock order:channels(child) thentask_projects(parent). Not rehearsed under load because every table touched is tiny and no job holds them. - No tRPC input or output change.
Verification
- Applied both migrations to a Neon branch of production (
br-tiny-meadow-af4htfbx) with the deploy's lock and statement timeouts: #roster → "Roster" with all 7 tasks. - Called the real router as my user against that branch: roster lists 7,
forTaskreturns #roster, add moves a loose task in (activity recorded), remove takes it out, add on #cloud (no project) made a "Cloud" project. packages/trpctests (830) andpackages/i18ntests (169) pass;check:i18nclean.
Summary by cubic
A channel now shows a task project's tasks instead of keeping its own list, so several channels can share a project and show the same tasks. This is the first of two PRs; the follow-up adds the project picker to the channel's Tasks tab and drops channel_tasks.
- Adds
channels.task_project_id(FK, on delete set null) and a data migration that gives each channel with tasks a project and moves the tasks in. In production that only affects #roster (7 tasks into a new "Roster" project); private channels get a generic "Channel tasks" project instead of one named after the channel. channelTask.list/add/remove/forTaskkeep their inputs and outputs and now read and write through the channel's project; adding a task to a channel without a project creates one.- Task moves in a project also refresh every channel showing that project.
channel_tasksstays in place until the follow-up, so the still-deployed API keeps working during the rollout.- Removes the unused
serverError.channel.taskInHiddenChannelmessage;addno longer rejects tasks in channels the user can't see. - No tRPC input or output changes, so this is safe as a data-only migration with the old API running.
Summary by CodeRabbit
- New Features
- Channels with tasks are now linked to task projects, and existing channel tasks are carried over to those projects.
- Adding a task to a channel creates a project for it if needed, then adds the task to that project.
- Channel task lists show tasks from the channel’s project. Tasks can appear in other channels linked to the same project, subject to channel visibility and organization membership.
- Behavior Changes
- Removing a task from a channel removes its association with the channel’s project.
- Task changes refresh channels that display the affected projects.