Skip to content

fix: Fix the dataset can't load issue by unifying "values" keyword in tags object.#363

Merged
JasonW404 merged 1 commit intomainfrom
develop/anno_fix
Feb 12, 2026
Merged

fix: Fix the dataset can't load issue by unifying "values" keyword in tags object.#363
JasonW404 merged 1 commit intomainfrom
develop/anno_fix

Conversation

@JasonW404
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 12, 2026 03:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to resolve dataset loading failures caused by inconsistent tag field naming by standardizing the internal “full” tag format to use the values key (instead of value), aligning with the frontend parsing expectation.

Changes:

  • Update tag conversion output to emit values in the full tag format.
  • Update related docstrings/examples to reference values for the full format.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
runtime/datamate-python/app/module/dataset/service/service.py Updates tag format documentation to reflect values in the full format.
runtime/datamate-python/app/module/annotation/utils/tag_converter.py Changes full-format tag output to use values and updates example snippets, but also alters simplified-format detection logic.
Comments suppressed due to low confidence (1)

runtime/datamate-python/app/module/annotation/utils/tag_converter.py:175

  • is_simplified_format is currently broken: has_value duplicates has_values (both check 'values' in tag), so the return condition has_values and not has_type and not has_value will always be False when values is present. This prevents simplified tags from being converted in convert_if_needed. Update the detection logic (e.g., treat tags as simplified when 'values' in tag and 'type' not in tag, or additionally differentiate by checking whether tag['values'] is a dict vs list) and fix the related inline comment which still refers to nested value.
        # Simplified format has 'values' at top level and no 'type' field
        has_values = 'values' in tag
        has_type = 'type' in tag
        has_value = 'values' in tag
        
        # If it has 'values' but no 'type', it's simplified
        # If it has 'type' and nested 'value', it's already full format
        return has_values and not has_type and not has_value
    

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 142 to 150
full_tag = {
"id": tag_id,
"from_name": from_name,
"to_name": to_name,
"type": control_type,
"value": {
"values": {
control_type: values
}
}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

This change switches the full-format output key from value to values, but the existing unit tests in app/module/annotation/utils/test_tag_converter.py still assert on the value field (e.g., converted_update[0]["value"] == ...). Update the tests to validate the new values structure so CI doesn’t fail and the new format is covered.

Copilot uses AI. Check for mistakes.
如果提供了 template_id,会自动将简化格式的标签转换为完整格式。
简化格式: {"from_name": "x", "to_name": "y", "values": [...]}
完整格式: {"id": "...", "from_name": "x", "to_name": "y", "type": "...", "value": {"type": [...]}}
完整格式: {"id": "...", "from_name": "x", "to_name": "y", "type": "...", "values": {"type": [...]}}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

Docstring example for the full tag format uses "values": {"type": [...]}; in the actual converter the nested dict key is the control type value (e.g., "choices", "rectanglelabels"). Consider updating the example to something like "values": {"<type>": [...]} to avoid misleading callers.

Suggested change
完整格式: {"id": "...", "from_name": "x", "to_name": "y", "type": "...", "values": {"type": [...]}}
完整格式: {"id": "...", "from_name": "x", "to_name": "y", "type": "...", "values": {"<type>": [...]}}

Copilot uses AI. Check for mistakes.
@JasonW404 JasonW404 merged commit 61fe125 into main Feb 12, 2026
14 checks passed
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