feat(tasks): add task-to-task relations (blocks / duplicates / relates)#221
Conversation
Adds linked-task support across the backend: - POST /api/v2/tasks/relations - add | remove | list actions behind an explicit allowlist, with companyId taken from the verified header (same convention as POST /api/v2/tasks/bulk) - relations mixin on taskMongo: a link is stored on BOTH task documents with the inverse type (blocks <-> blocked_by, duplicates <-> duplicated_by, relates_to is symmetric), so either side reads its links without a join; one link per task pair - socket emits for both updated tasks and activity history on both sides (messages use TaskKeys, not raw task names) - pure rules module (relationRules.js) shared by route, mixin, and tests; 17 unit tests in tests/task-relations-rules.test.js Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- new LinkedTasks.vue rendered below Subtasks: lists relations with type label, TaskKey, name and status chip; add-link flow with a relation-type dropdown and debounced same-project task search; live refresh via the projectData/gettaskDetailData socket watcher - task search wraps ProjectID in the backend objId marker (the field is an ObjectId and aggregate $match skips mongoose casting) - declare `relations` on the strict tasks schema so $push persists (P1-SEC-11 strict mode silently drops undeclared update paths) - 15 new en locale keys under Projects.*; other languages fall back to en per the i18n fallbackLocale config Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the βοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
Comment |
π§ͺ Integration test report β full feature matrixRan against a real local MongoDB through the app''s own data layer ( Result: 30/30 checks pass. Validation & guards (8)
Write correctness (8)
Read correctness (5)
History (1)
Isolation & removal (8)
Also covered
π€ Generated with Claude Code |
β¦s) (#224) Empty release-trigger commit. The feature itself landed on main in the #222 promotion, but the squash commit was typed chore(release), which release-please ignores when computing releases - so no v14.2.0 release PR was proposed. This commit restates the feature with its original conventional message so release-please proposes v14.2.0 with a proper changelog entry. Refs: #221, #222 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Summary
Adds task-to-task relations ("Linked Tasks"): any two tasks in a project can be linked as
blocks/blocked_by/duplicates/duplicated_by/relates_to, managed from a new Linked Tasks section in the task detail view.Motivation & Context
Modules/before this change.Closes / Relates to: roadmap item "Task relations & dependencies"
Proposed Solution
Backend (
58f6375)POST /api/v2/tasks/relationswith an explicit action allowlist (add|remove|list) and companyId taken from the verified header β same security convention asPOST /api/v2/tasks/bulk.relationsmixin on thetaskMongoclass. A link is stored on both task documents with the inverse type (blocks<->blocked_by,duplicates<->duplicated_by,relates_tosymmetric), so either side reads its links without a join. One link per task pair.relationRules.js(types, inverse map, validators) shared by route, mixin, and tests.relationsdeclared on the strict tasks schema (utils/mongo-handler/schema.js) β required since P1-SEC-11 strict mode silently drops undeclared update paths.Frontend (
8a3849c)LinkedTasks.vuerendered below Subtasks in the task detail for every task: rows show relation label + TaskKey + name + status chip, with hover X to unlink./api/v1/task/findaggregation;ProjectIDwrapped in theobjIdmarker because aggregate$matchskips mongoose casting).projectData/gettaskDetailData).enlocale keys underProjects.*; the other nine languages fall back to English per the i18nfallbackLocaleconfig.Scope of Change
Testing Strategy
tests/task-relations-rules.test.js); full suite 45/45 greenSteps to verify:
Breaking Changes
Purely additive: new endpoint, new schema field (
relations, default[]), new UI section. No existing behavior changed.Documentation Updates
Swagger entry for the new endpoint can follow in a docs PR.
Preflight Checklist
staging).π Additional Notes
π€ Generated with Claude Code