Skip to content

Conversation

@Prashant-Surya
Copy link
Member

@Prashant-Surya Prashant-Surya commented Nov 28, 2025

Description

  • Add test cases for setting options in create call
  • Refactor values tests

Type of Change

  • Improvement (change that would cause existing functionality to not work as expected)

Summary by CodeRabbit

  • New Features
    • Partial update and delete for work item property values, with smart handling of single vs. multi-value properties.
    • Project feature toggles can be enabled programmatically to ensure required features are active for workflows.
  • API / Data Model
    • Property value payload shape simplified to a single value field with optional external metadata; option items may include a description.
  • Tests
    • Tests reorganized and expanded for property types and options.
  • Chores
    • Package version bumped.

✏️ Tip: You can customize this high-level summary in your review settings.

@makeplane
Copy link

makeplane bot commented Nov 28, 2025

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Added partial-update (PATCH) and delete (DELETE) endpoints for WorkItem property values, changed the property value model to a flat value (supports multi-value and external metadata), refactored unit tests, added a project feature-enable call in e2e setup, and bumped package version.

Changes

Cohort / File(s) Summary
WorkItemProperty Values API
src/api/WorkItemProperties/Values.ts
Added update(...) (PATCH -> returns WorkItemPropertyValues) and delete(...) (DELETE -> returns void) methods for property values; retained existing create(...).
Model Changes
src/models/WorkItemProperty.ts
WorkItemPropertyOption now includes optional description?: string. UpdateWorkItemPropertyValue changed from { values: [{ value: any }] } to `{ value: string
Unit Tests — properties/options
tests/unit/work-item-types/properties-options.test.ts
Reorganized a monolithic test into separate suites for TEXT properties, OPTION properties, and property options; added focused lifecycle tests with setup/teardown.
Unit Tests — properties/values
tests/unit/work-item-types/properties-values.test.ts
Test payloads updated to use value: testValue instead of values: [{ value: testValue }] to match the new model shape.
End-to-end tests
tests/e2e/project.test.ts
Added call in beforeAll to enable project features: client.projects.updateFeatures(workspaceSlug, project.id, { cycles: true, modules: true }).
Projects API (public surface)
(invoked in tests)
New/public method used: updateFeatures(workspaceSlug: string, projectId: string, features: { cycles?: boolean; modules?: boolean }): Promise<any> (invoked as client.projects.updateFeatures).
Package manifest
package.json
Version bumped from 0.2.2 to 0.2.3.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay attention to model contract changes and ensure all call sites (internal and tests) match the new value shape and optional external fields.
  • Review Values.update()/Values.delete() for correct HTTP usage and handling of single-value vs multi-value semantics.
  • Verify e2e change (projects.updateFeatures) is added to the public Projects API with correct typings and side effects.
  • Confirm test refactor preserves coverage and that teardown/cleanup logic is robust.

Poem

🐰 I patched and pruned each value neat,
Flat fields and metadata make my day complete.
Tests hop tidy in orderly rows,
Features enabled — the garden grows.
✨📦

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title focuses on 'add support to set options in create option property api', but the changeset includes broader updates: partial-update and delete methods for property values, modified data structures, and comprehensive test refactoring. Revise the title to reflect all major changes, such as: 'Add update/delete methods to property values API and refactor property tests' or clarify the scope to match only the test changes if that is the primary intent.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3d002d and 4d5e1dc.

📒 Files selected for processing (2)
  • package.json (1 hunks)
  • tests/e2e/project.test.ts (1 hunks)

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/unit/work-item-types/properties-values.test.ts (1)

29-61: Add test coverage for the new update and delete methods.

The test only covers create, retrieve, and list operations. The Values API now exposes update and delete methods (added in src/api/WorkItemProperties/Values.ts), but this workflow test doesn't verify them.

Consider extending the test to include:

       expect(workItemPropertyValue).toBeDefined();
 
       // Retrieve the work item property value
       const retrievedWorkItemPropertyValue = await client.workItemProperties.values.retrieve(
         workspaceSlug,
         projectId,
         workItemId,
         propertyId
       );
 
       expect(retrievedWorkItemPropertyValue).toBeDefined();
+
+      // Update the work item property value
+      const updatedValue = randomizeName("Updated WI Property Value");
+      const updatedWorkItemPropertyValue = await client.workItemProperties.values.update(
+        workspaceSlug,
+        projectId,
+        workItemId,
+        propertyId,
+        {
+          value: updatedValue,
+        }
+      );
+
+      expect(updatedWorkItemPropertyValue).toBeDefined();
 
       // List all work item property values for the work item
       const workItemPropertyValues = await client.workItemProperties.values.list(workspaceSlug, projectId, workItemId, {
         limit: 10,
         offset: 0,
       });
 
       expect(workItemPropertyValues).toBeDefined();
+
+      // Delete the work item property value
+      await client.workItemProperties.values.delete(
+        workspaceSlug,
+        projectId,
+        workItemId,
+        propertyId
+      );
     });
src/api/WorkItemProperties/Values.ts (1)

1-7: Minor: Inconsistent import formatting.

The imports mix single and double quotes. While this doesn't affect functionality, consistent quote usage improves readability.

-import { BaseResource } from "../BaseResource";
-import { Configuration } from "../../Configuration";
+import { BaseResource } from '../BaseResource';
+import { Configuration } from '../../Configuration';
 import {
   UpdateWorkItemPropertyValue,
   ListWorkItemPropertyValuesParams,
   WorkItemPropertyValues,
-} from "../../models/WorkItemProperty";
+} from '../../models/WorkItemProperty';
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08368f4 and b3d002d.

📒 Files selected for processing (4)
  • src/api/WorkItemProperties/Values.ts (4 hunks)
  • src/models/WorkItemProperty.ts (2 hunks)
  • tests/unit/work-item-types/properties-options.test.ts (2 hunks)
  • tests/unit/work-item-types/properties-values.test.ts (1 hunks)
🔇 Additional comments (11)
tests/unit/work-item-types/properties-values.test.ts (1)

38-38: LGTM! Payload structure aligns with the updated model.

The simplified value field correctly reflects the new UpdateWorkItemPropertyValue structure defined in src/models/WorkItemProperty.ts.

tests/unit/work-item-types/properties-options.test.ts (5)

1-5: LGTM! Import cleanup improves clarity.

Removing unused WorkItemPropertyOption import and simplifying the describeIf alias usage makes the imports cleaner.


28-86: LGTM! Comprehensive TEXT property lifecycle test.

The test thoroughly covers the full CRUD workflow (create → retrieve → update → list → delete) with proper assertions on IDs, types, and list results.


88-182: LGTM! Well-structured OPTION property tests with proper cleanup.

The test suite properly uses beforeEach/afterEach hooks to manage test isolation and cleanup. The tests verify:

  • Property creation with predefined options
  • Option metadata (name, description, is_default, is_active)
  • Property retrieval, update, and listing

184-254: LGTM! Property options CRUD workflow is comprehensive.

The test properly validates the full lifecycle of property options (create → retrieve → update → delete) with appropriate cleanup using beforeEach/afterEach hooks.


91-108: The description field is fully supported by the Plane API.

Based on verification through Plane's official API documentation, work item property options include a description field across all supported endpoints (POST/GET/PATCH/DELETE /api/v1/.../issue-properties/:property_id/options/). The test code correctly implements this field, and the backend accepts and persists it. No changes are required.

src/models/WorkItemProperty.ts (2)

105-105: LGTM! Useful addition for option metadata.

Adding the optional description field to WorkItemPropertyOption allows for more descriptive options and aligns with the test data in properties-options.test.ts.


141-165: LGTM! Well-documented breaking change with clear multi-value support.

The restructured UpdateWorkItemPropertyValue type:

  • Simplifies the structure from nested values array to a single value field
  • Supports multi-value properties via string[] type
  • Adds external metadata fields (external_id, external_source)
  • Includes comprehensive documentation for different property types

The breaking change is properly reflected in the test updates.

src/api/WorkItemProperties/Values.ts (3)

48-70: LGTM! Clarified documentation for create behavior.

The updated documentation clearly explains the difference between single-value (upsert) and multi-value (sync) behavior, which is important for API consumers to understand.


72-96: LGTM! New update method provides partial update capability.

The method:

  • Uses PATCH for partial updates (as opposed to POST's upsert behavior)
  • Properly documents single-value vs multi-value behavior
  • Documents error handling (404 when value doesn't exist)
  • Aligns with the updated UpdateWorkItemPropertyValue type

98-113: LGTM! New delete method enables value removal.

The method:

  • Uses httpDelete for proper HTTP DELETE semantics
  • Documents behavior for both single and multi-value properties
  • Documents error handling (404 when value doesn't exist)
  • Follows consistent parameter patterns with other methods

@Prashant-Surya Prashant-Surya merged commit 29b5b10 into main Nov 29, 2025
1 of 2 checks passed
@Prashant-Surya Prashant-Surya deleted the feat/property-options-tests branch November 29, 2025 09:54
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.

4 participants