Skip to content

RDBC-1029/1030 Fix bulk insert error detection and Enum dict key serialisation#273

Open
redknightlois wants to merge 2 commits intoravendb:v7.1from
redknightlois:RDBC-1029
Open

RDBC-1029/1030 Fix bulk insert error detection and Enum dict key serialisation#273
redknightlois wants to merge 2 commits intoravendb:v7.1from
redknightlois:RDBC-1029

Conversation

@redknightlois
Copy link
Member

Issue link

https://issues.hibernatingrhinos.com/issue/RDBC-1029
https://issues.hibernatingrhinos.com/issue/RDBC-1030

Additional description

RDBC-1029BulkInsert._get_exception_from_operation called the non-existent str.starts_with method (Python has str.startswith), raising AttributeError on any bulk-insert server error. Fixed the typo.

RDBC-1030Utils.entity_to_dict passed a dict with Enum keys directly to json.dumps, which raises TypeError because Enum instances are not JSON-serialisable as keys. Fixed by recursively normalising Enum keys to their .value before serialisation.

Type of change

  • Bug fix
  • Regression bug fix
  • Optimization
  • New feature

How risky is the change?

  • Low
  • Moderate
  • High
  • Not relevant

Backward compatibility

  • Non breaking change
  • Ensured. Please explain how has it been implemented?
  • Breaking change
  • Not relevant

Is it platform specific issue?

  • Yes. Please list the affected platforms.
  • No

Documentation update

  • This change requires a documentation update. Please mark the issue on YouTrack using Documentation Required tag.
  • No documentation update is needed

Testing by Contributor

  • Tests have been added that prove the fix is effective or that the feature works
  • Internal classes added to the test class (e.g. entity or index definition classes) have the lowest possible access modifier (preferable private)
  • It has been verified by manual testing
  • Existing tests verify the correct behavior

Testing by RavenDB QA team

  • This change requires a special QA testing due to possible performance or resources usage implications (CPU, memory, IO). Please mark the issue on YouTrack using QA Required tag.
  • No special testing by RavenDB QA team is needed

Is there any existing behavior change of other features due to this change?

  • Yes. Please list the affected features/subsystems and provide appropriate explanation
  • No

UI work

  • It requires further work in the Studio. Please mark the issue on YouTrack using Studio Required tag.
  • No UI work is needed

…tion

result['$type'].starts_with(...) is not a Python method; the correct name is str.startswith(). The typo swallowed all server-side bulk insert errors with an AttributeError, hiding the real cause.

Regression test: test_bulk_insert_error_handling.py verifies that a server-side abort surfaces as BulkInsertAbortedException with the server's error detail rather than the generic "Failed to execute bulk insert" message.
json.dumps raises TypeError for non-string dict keys. Entities whose fields are dicts with Enum keys (e.g. {CheckType.ENGINE: CheckStatus.GOOD}) failed at session.store() time. Fix: wrap default_method to recursively convert Enum keys to their .value before json.dumps sees them.

Regression test: test_store_enum_key_dict.py verifies that an entity with an Enum-keyed dict field stores and round-trips correctly.
@redknightlois redknightlois changed the title RDBC-1029 | RDBC-1030 RDBC-1029 Fix bulk insert error detection and Enum dict key serialisation Feb 26, 2026
@redknightlois redknightlois changed the title RDBC-1029 Fix bulk insert error detection and Enum dict key serialisation RDBC-1029/1030 Fix bulk insert error detection and Enum dict key serialisation Feb 26, 2026
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