Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kemingy
Copy link
Member

@kemingy kemingy commented Aug 1, 2025

Fix the bug when the __struct_fields__ length does not match the __struct_defaults__ length. Add tests.

Suppress the UniqueViolation error when creating new tables or indexes.

not match the __struct_defaults__ length. Add tests.

Suppress the UniqueViolation error when creating new
tables or indexes.

Signed-off-by: Keming <[email protected]>
@kemingy kemingy requested a review from Copilot August 1, 2025 03:04
Copy link
Contributor

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 fixes a bug in msgspec struct handling where the length of __struct_fields__ and __struct_defaults__ don't match, causing issues in the todict() method. Additionally, it suppresses UniqueViolation errors when creating database tables or indexes to handle concurrent creation scenarios.

  • Pads the defaults tuple with msgspec.NODEFAULT when defaults are shorter than fields
  • Changes zip operation to use strict=True for safer iteration
  • Suppresses UniqueViolation errors in database table/index creation
  • Updates error message to include "Graph" provider alongside OCR

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
vechord/spec.py Fixes struct defaults padding bug and adds kw_only parameter to DefaultChunk
vechord/client.py Suppresses UniqueViolation errors in table and index creation
vechord/pipeline.py Updates error message to mention Graph provider
tests/test_spec.py Adds comprehensive tests for the struct defaults bug fix
Comments suppressed due to low confidence (1)

tests/test_spec.py:115

  • [nitpick] The class name 'ReDocument' is unclear and doesn't convey its purpose as a test class for demonstrating the struct defaults mismatch scenario. Consider a more descriptive name like 'TestDocumentWithExtraField' or 'DocumentWithMismatchedDefaults'.
    class ReDocument(DefaultDocument):

@kemingy kemingy merged commit 2b46cd7 into tensorchord:main Aug 1, 2025
7 checks passed
@kemingy kemingy deleted the bug_todict branch August 1, 2025 06:18
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