Skip to content

fix(lark_trigger): fix serialization error for bitable record changed#2843

Closed
Night-stars-1 wants to merge 2 commits intolanggenius:mainfrom
Night-stars-1:fix/lark_trigger
Closed

fix(lark_trigger): fix serialization error for bitable record changed#2843
Night-stars-1 wants to merge 2 commits intolanggenius:mainfrom
Night-stars-1:fix/lark_trigger

Conversation

@Night-stars-1
Copy link
Copy Markdown
Contributor

Related Issues or Context

Fixed a PydanticSerializationError triggered when processing Bitable record change events.
The before_value and after_value fields contain instances of BitableTableRecordActionField. Since this class does not inherit from Pydantic's BaseModel, it causes a serialization failure when the event data is handled by Pydantic-based components

Solution:
Manually transform the BitableTableRecordActionField objects into standard dictionaries by extracting field_id and field_value. This ensures the action_info object consists only of JSON-serializable Python primitives.

This PR contains Changes to Non-Plugin

  • Documentation
  • Other

This PR contains Changes to Non-LLM Models Plugin

  • I have Run Comprehensive Tests Relevant to My Changes

Before:
image

After:
image

This PR contains Changes to LLM Models Plugin

  • My Changes Affect Message Flow Handling (System Messages and User→Assistant Turn-Taking)
  • My Changes Affect Tool Interaction Flow (Multi-Round Usage and Output Handling, for both Agent App and Agent Node)
  • My Changes Affect Multimodal Input Handling (Images, PDFs, Audio, Video, etc.)
  • My Changes Affect Multimodal Output Generation (Images, Audio, Video, etc.)
  • My Changes Affect Structured Output Format (JSON, XML, etc.)
  • My Changes Affect Token Consumption Metrics
  • My Changes Affect Other LLM Functionalities (Reasoning Process, Grounding, Prompt Caching, etc.)
  • Other Changes (Add New Models, Fix Model Parameters etc.)

Version Control (Any Changes to the Plugin Will Require Bumping the Version)

  • I have Bumped Up the Version in Manifest.yaml (Top-Level Version Field, Not in Meta Section)
    0.0.30.0.4

Dify Plugin SDK Version

  • I have Ensured dify_plugin>=0.3.0,<0.6.0 is in requirements.txt (SDK docs)
    Note: The current requirements.txt specifies dify_plugin>=0.5.0 which was already the case before this PR.

Environment Verification (If Any Code Changes)

Local Deployment Environment

  • Dify Version is: 1.13.1, I have Tested My Changes on Local Deployment Dify with a Clean Environment That Matches the Production Configuration.

SaaS Environment

  • I have Tested My Changes on cloud.dify.ai with a Clean Environment That Matches the Production Configuration

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 7, 2026
@Night-stars-1 Night-stars-1 temporarily deployed to triggers/lark_trigger April 7, 2026 06:54 — with GitHub Actions Inactive
@dosubot dosubot bot added the bug Something isn't working label Apr 7, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Lark Bitable record change event to process before_value and after_value as structured lists of field IDs and values, and increments the manifest version. Feedback highlights a typo in the after_value logic and a schema inconsistency where the YAML definition uses object instead of array for the new list-based fields.

for after_value_item in action.after_value:
after_value.append({
"field_id": after_value_item.field_id if after_value_item.field_id else "",
"field_value": after_value_item.field_value if after_value_item.field_id else ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

There is a typo in the conditional check for field_value. It currently checks after_value_item.field_id instead of after_value_item.field_value. This makes the logic inconsistent with the before_value processing on line 54 and may result in None being assigned to field_value if the actual value is None but the field_id exists.

Suggested change
"field_value": after_value_item.field_value if after_value_item.field_id else ""
"field_value": after_value_item.field_value if after_value_item.field_value else ""

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

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant