Skip to content

feat: task dependency CRUD — create/update deps via CLI and API#2

Draft
0pfleet wants to merge 3 commits intohyperb1iss:mainfrom
0pfleet:feat/task-dependency-crud
Draft

feat: task dependency CRUD — create/update deps via CLI and API#2
0pfleet wants to merge 3 commits intohyperb1iss:mainfrom
0pfleet:feat/task-dependency-crud

Conversation

@0pfleet
Copy link

@0pfleet 0pfleet commented Feb 13, 2026

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 accepts add_depends_on / remove_depends_on for post-creation dependency management
  • sibyl task create --depends-on task_aaa,task_bbb wires dependencies at creation time via the dedicated POST /tasks endpoint
  • sibyl task update task_xxx --add-dep task_yyy --remove-dep task_zzz mutates dependencies after creation
  • New RelationshipManager.delete_between() helper for targeted DEPENDS_ON edge removal in a single Cypher query

Motivation

Sibyl had a full dependency reader but an incomplete writer:

  • POST /tasks accepted depends_on at creation, but the CLI never wired it (used generic POST /entities instead)
  • PATCH /tasks had no dependency mutation support at all
  • No way to add/remove dependencies after task creation

What changed

File Change
sibyl_core/graph/relationships.py Add delete_between() — single-query edge deletion between two nodes
sibyl/api/routes/tasks.py Add add_depends_on/remove_depends_on to UpdateTaskRequest, handle in sync + async paths
sibyl/jobs/queue.py Pass dep params through to worker
sibyl/jobs/entities.py Handle dep mutations in async worker job
sibyl_cli/client.py Add create_task() method (dedicated endpoint), add dep params to update_task()
sibyl_cli/task.py Add --depends-on, --add-dep, --remove-dep flags; switch create to POST /tasks

Design decisions

  • CLI create switched from POST /entities to POST /tasks: The generic endpoint queued a worker job that called create_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 --sync flag was removed as it's no longer needed.
  • delete_between() returns count (not bool): Follows the pattern of delete_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 check passes on all 3 packages (core, api, cli)
  • ty check — no new type errors (11 pre-existing warnings in unrelated files)
  • pytest sibyl-core — 769 passed
  • pytest api — 1229 passed, 1 failed (pre-existing: test_tools_manage tries live FalkorDB connection)
  • Manual smoke test after install:
    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

0pfleet and others added 3 commits February 12, 2026 23:13
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>
@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant