Skip to content

fix: parse Community Edition work item relation references - #82

Open
JustAmply wants to merge 1 commit into
makeplane:mainfrom
JustAmply:codex/fix-ce-relation-response
Open

JustAmply wants to merge 1 commit into
makeplane:mainfrom
JustAmply:codex/fix-ce-relation-response

Conversation

@JustAmply

@JustAmply JustAmply commented Nov 12, 2026 •

Copy link
Copy Markdown

Summary

client.work_items.relations.list() raises a Pydantic ValidationError whenever Plane Community Edition returns a non-empty relation group. The v1 endpoint returns {project_id, issue_id} references, while WorkItemRelationResponse currently requires strings.

 WorkItemRelationResponse (all eight groups)
-  list[str]
+  list[WorkItemRelationReference | str]

The new reference model requires both IDs and preserves extra response fields. Existing bare-ID inputs and serialization stay supported. The README demonstrates how to consume either shape. CI now runs the offline v1 contract tests and scoped lint alongside the existing v2 checks.

The response shape comes from Plane v1.4.3's IssueRelationListCreateAPIEndpoint. It also preserves project context for cross-project relations.

This complements makeplane/plane-mcp-server#265, which currently bypasses this model using _get, and relates to makeplane/plane-mcp-server#185. It does not change MCP endpoint selection or add endpoints missing from CE.

Evidence

  • Before: the new suite fails 9 tests with Input should be a valid string for valid reference objects.
    After: all 19 tests pass. Coverage includes all eight groups, empty groups, existing bare IDs, extra fields, malformed references, and propagation of HTTP 401/403/404/500.
  • python -m pytest tests/v2 --ignore=tests/v2/integration -q --tb=short: passed (two skips), on Windows / Python 3.14.7.
  • Ruff 0.6.9 passes on both changed Python files; Black 26.10.1 check passes; git diff --check passes.
  • Read-only live diagnosis: /relations/ returns 200, while /dependencies/ and /work-item-relation-definitions/ return 404 on the same self-hosted instance. That live response contained empty groups; non-empty reference parsing is verified with mocked HTTP responses matching the upstream implementation. No live records were changed.

Merge Danger

Door: two-way

Model-only runtime change; no persistence, transport, or dependency changes. Revert restores the previous parsing behavior.

Blast Radius: v1-relations

The eight response fields now have a union element type. Existing string entries remain strings; consumers handling object entries can use the typed project and issue IDs. Static callers assuming every entry is a string need to narrow the type, as shown in the README. The separate v2 relation models are untouched.

Summary by CodeRabbit

  • New Features
    • Work item relation responses now support both bare issue IDs and structured references containing project and issue IDs across all relation types.
    • Empty relation groups continue to be supported, while malformed structured references are rejected.
  • Documentation
    • Updated the work item sub-resources example to show both supported formats for blocked_by targets.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The work-item relation response model now accepts related items as either string IDs or reference objects with project and issue IDs. The README example and offline tests cover these response shapes, and the test workflow runs the new test.

Changes: Work-item relation response contract

Layer / File(s) Summary
Define relation response shapes
plane/models/work_items.py, README.md
WorkItemRelationReference requires project and issue IDs. All eight relation groups accept reference objects or string IDs. The example handles both shapes.
Validate relation responses
tests/test_work_item_relation_response.py, .github/workflows/test.yml
Offline tests check relation responses, validation errors, and HTTP errors. The workflow lints the model and test files, then runs the test.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: dheeru0198, prashant-surya

Merge Risk: Minimal · up to d6d3c

This change lets relation responses from Community Edition parse correctly while still accepting the previous string IDs. No merge-blocking risk was found. Consumers that handle relation entries may need to narrow the type to cover objects.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: parse Community Edition work item relation references" matches the main change. The PR changes WorkItemRelationResponse so its eight relation groups accept either bare string IDs or Wo…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix: parse Community Edition work item relation references" matches the main change. The PR changes WorkItemRelationResponse so its eight relation groups accept either bare string IDs or WorkItemRelationReference objects with project_id and issue_id. The title names the Community Edition context and the relation reference parsing, which are the core of the change. It is concise, specific, and follows a conventional commit prefix.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 44c2143a-9911-4897-94d7-8620e31de9ec
Commits

Reviewing files that changed from the base of the PR and between 4fe2ec8 and d6d3cd3.

Files selected for processing: 4

  • .github/workflows/test.yml
  • README.md
  • plane/models/work_items.py
  • tests/test_work_item_relation_response.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

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