Skip to content

Conversation

@bmonjoie
Copy link
Member

process_mobile_bulk_upload was wrapped into one giant transaction. This was problematic because we can have multiple zips each with the full storage logs. The storage logs could point on entities that are created in one of the zips. If we have entities created in at least two zips, the storage logs can never succeed and therefore the import of all the zips is blocked.

Also, I extracted the logic of finding an entity to attach the storage logs to the proper entity even when there are duplicates.

Related JIRA tickets : WC2-852

Self proofreading checklist

  • Did I use eslint and ruff formatters?
  • Is my code clear enough and well documented?
  • Are there enough tests?

Changes

See top of the PR

How to test

It's quite hard to test because you need to send two zips with some entities created in each zips and have storage logs to point to those new entities.

The best is to test that synchronizing using zip is still working fine.

Follow the Conventional Commits specification

The merge message of a pull request must follow the Conventional Commits specification.

This convention helps to automatically generate release notes.

Use lowercase for consistency.

Example:

fix: empty instance pop up

Refs: IA-3665

Note that the Jira reference is preceded by a line break.

Both the line break and the Jira reference are entered in the Add an optional extended description… field.

`process_mobile_bulk_upload` was wrapped into one giant transaction.
This was problematic because we can have multiple zips each with the **full** storage logs.
The storage logs could point on entities that are created in one of the zips.
If we have entities created in at least two zips, the storage logs can never succeed and therefore
the import of all the zips is blocked.

Also, I extracted the logic of finding an entity to attach the storage logs to the proper entity even
when there are duplicates.

WC2-852
@bmonjoie bmonjoie self-assigned this Nov 20, 2025
@bmonjoie bmonjoie added the bug Something isn't working label Nov 20, 2025
Copy link
Member

@tdethier tdethier left a comment

Choose a reason for hiding this comment

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

I couldn't test that because I don't have the required setup, but LGTM 👍
Nitpick: I would add a unit test to show that import_storage_logs doesn't raise an exception anymore when an entity is missing

I'll let the others who are more familiar with entities and storage logs approve.

Comment on lines +939 to +949
if entity_type_id is not None:
filters = {
"uuid": entity_uuid,
"entity_type_id": entity_type_id,
"account": account,
}
else:
filters = {
"uuid": entity_uuid,
"account": account,
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if entity_type_id is not None:
filters = {
"uuid": entity_uuid,
"entity_type_id": entity_type_id,
"account": account,
}
else:
filters = {
"uuid": entity_uuid,
"account": account,
}
filters = {
"uuid": entity_uuid,
"account": account,
}
if entity_type_id is not None:
filters["entity_type_id"] = entity_type_id

@beygorghor beygorghor requested a review from tdethier November 21, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants