Skip to content

fix: skip update logs for items whose identifier was cleared on removal - #41

Merged
paullla merged 1 commit into
Locastic:masterfrom
paullla:fix/skip-update-log-for-removed-items
Jul 3, 2026
Merged

fix: skip update logs for items whose identifier was cleared on removal#41
paullla merged 1 commit into
Locastic:masterfrom
paullla:fix/skip-update-log-for-removed-items

Conversation

@paullla

@paullla paullla commented Jul 3, 2026

Copy link
Copy Markdown
Member
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Issues -
License MIT

Problem

Deleting a parent entity together with its LoggableChildInterface children crashes the update handler. The child's delete log triggers an update log for the parent (ActivityLogger::handleLoggableChild()), but by then Doctrine has already cleared the parent's generated identifier. The current data tracker lookup then runs a term query with objectId: null, which Elasticsearch rejects with 400 illegal_argument_exception: field name is null or empty, failing the whole flush flow.

Found while driving a real application (demo app with Product -> ProductVariant as loggable child) against 2.0-dev.

Changes

  • UpdateActivityLogHandler returns early when the updated item's identifier is null: an item without an identifier has no current data tracker to compare against, its own delete log is already written, and an edit log for a removed entity is meaningless
  • Unit test asserting the tracker provider and processor are never called for an identifier-less item

Verification

  • Reproduced in the demo app: delete of a product with variants failed with the 400 before the fix and completes after it, with the expected Created/Edited/Deleted logs intact
  • Full PHPUnit suite (25 tests, 55 assertions) green against Elasticsearch 9.0; PHPStan clean; PHP-CS-Fixer clean

Deleting a parent entity together with its LoggableChildInterface
children dispatches an update log for the parent from the child's
delete log. By then Doctrine has cleared the parent's generated
identifier, so the current data tracker lookup ran with a null
objectId, which Elasticsearch rejects with a 400. Skip the update when
the item has no identifier: the parent's own delete log is already
written and an edit log for a removed entity is meaningless.
@paullla
paullla merged commit f933a6f into Locastic:master Jul 3, 2026
12 checks passed
@paullla
paullla deleted the fix/skip-update-log-for-removed-items branch July 3, 2026 12:28
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