feat: task dependency CRUD — create/update deps via CLI and API#2
Conversation
Adds a targeted relationship deletion method that removes relationships of a specific type between two entities in a single Cypher query. Used by the dependency CRUD to remove DEPENDS_ON edges without needing to fetch-filter-delete. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds add_depends_on/remove_depends_on fields to UpdateTaskRequest, enabling dependency management after task creation. Both sync and async (worker) paths handle DEPENDS_ON relationship creation and deletion. Extracts _build_update_data() helper to stay under PLR0915 statement limit after adding the new fields. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- create: Add --depends-on flag, switch from generic POST /entities to dedicated POST /tasks endpoint (create_direct, no worker queue) - update: Add --add-dep and --remove-dep flags for post-creation dependency management - client: Add create_task() method, add dep params to update_task() The create command now uses the task-specific endpoint which handles BELONGS_TO and DEPENDS_ON relationships synchronously, eliminating the need for the --sync flag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR adds task dependency mutation capabilities by extending the API update request with Changes
Sequence DiagramsequenceDiagram
participant Client
participant API as API Routes
participant Queue as Job Queue
participant JobProcessor as Job Processor
participant EntityMgr as Entity Manager
participant RelMgr as Relationship Manager
participant DB as Database
Client->>API: PATCH /tasks (add_depends_on, remove_depends_on)
API->>API: Build update payload with dependencies
API->>Queue: enqueue_update_task(add_depends_on, remove_depends_on)
Queue->>JobProcessor: pool.enqueue_job(update_task)
JobProcessor->>JobProcessor: Process dependency mutations
alt Has add_depends_on
JobProcessor->>RelMgr: Create DEPENDS_ON relationships
RelMgr->>DB: Create DEPENDS_ON for each dependency
DB-->>RelMgr: Success
end
alt Has remove_depends_on
JobProcessor->>RelMgr: delete_between() for each dependency
RelMgr->>DB: DELETE DEPENDS_ON relationships
DB-->>RelMgr: Count deleted
end
alt Has field updates beyond dependencies
JobProcessor->>EntityMgr: Update task entity fields
EntityMgr->>DB: Update task attributes
DB-->>EntityMgr: Success
end
JobProcessor->>DB: Broadcast websocket update
DB-->>Client: Task updated
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Closes the #1 gap identified in the Sibyl audit: users cannot build dependency chains after task creation. The dependency reader (graph traversal, cycle detection, topological sorting via
sibyl explore dependencies) was complete, but the writer was missing.PATCH /tasks/{task_id}now acceptsadd_depends_on/remove_depends_onfor post-creation dependency managementsibyl task create --depends-on task_aaa,task_bbbwires dependencies at creation time via the dedicatedPOST /tasksendpointsibyl task update task_xxx --add-dep task_yyy --remove-dep task_zzzmutates dependencies after creationRelationshipManager.delete_between()helper for targeted DEPENDS_ON edge removal in a single Cypher queryMotivation
Sibyl had a full dependency reader but an incomplete writer:
POST /tasksaccepteddepends_onat creation, but the CLI never wired it (used genericPOST /entitiesinstead)PATCH /taskshad no dependency mutation support at allWhat changed
sibyl_core/graph/relationships.pydelete_between()— single-query edge deletion between two nodessibyl/api/routes/tasks.pyadd_depends_on/remove_depends_ontoUpdateTaskRequest, handle in sync + async pathssibyl/jobs/queue.pysibyl/jobs/entities.pysibyl_cli/client.pycreate_task()method (dedicated endpoint), add dep params toupdate_task()sibyl_cli/task.py--depends-on,--add-dep,--remove-depflags; switch create toPOST /tasksDesign decisions
POST /entitiestoPOST /tasks: The generic endpoint queued a worker job that calledcreate_direct()anyway (no LLM extraction for tasks). The dedicated endpoint does the same thing inline, eliminating the worker round-trip and pending state complexity. The--syncflag was removed as it's no longer needed.delete_between()returns count (not bool): Follows the pattern ofdelete_for_entity()— bulk-style operations return count, scalar operations (delete()) return bool._build_update_data()extracted as helper: The PATCH handler hit PLR0915 (too many statements) after adding dep handling. Extracting the field mapping keeps it clean.Test plan
ruff checkpasses on all 3 packages (core, api, cli)ty check— no new type errors (11 pre-existing warnings in unrelated files)pytestsibyl-core — 769 passedpytestapi — 1229 passed, 1 failed (pre-existing:test_tools_managetries live FalkorDB connection)sibyl task create --title "Test dep" --depends-on task_aaa,task_bbb sibyl task update task_xxx --add-dep task_yyy sibyl task update task_xxx --remove-dep task_yyy sibyl explore dependencies task_xxx🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes