test: failing reproducer for entity:persisting / entity:persisted (#28)#29
Draft
jonasnobile wants to merge 1 commit into
Draft
test: failing reproducer for entity:persisting / entity:persisted (#28)#29jonasnobile wants to merge 1 commit into
jonasnobile wants to merge 1 commit into
Conversation
Both the EntityHandle.intercept('entity:persisting', ...) interceptor
and the useOnEntityEvent('entity:persisted', ...) hook are publicly
advertised (the hook's own JSDoc literally documents the persisted
example), but never fire at runtime. The events/eventFactory.ts
createBeforeEvent / createAfterEvent switch statements have no case
for SET_PERSISTING (the action BatchPersister dispatches around the
mutation), so the EventEmitter never receives a before/after event
to fan out.
The two new tests assert the canonical advertised usage and currently
fail with `Received length: 0`. The mutation itself succeeds — the
mock store reflects the new value — proving the gap is purely in the
event factory, not in the persist pipeline.
Same root cause exists for entity:persistFailed (failure path) and
entity:deleting / entity:deleted (DELETE_ENTITY action). Adding
failure injection to MockAdapter is out of scope here; mirroring the
fix once the persisting/persisted path lands is a one-line addition
in the BatchPersister catch branch and the eventFactory switch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reproduces #28.
Two failing tests in
tests/cases/entityPersistEvents.test.tsxthat assert the canonical advertised usage ofentity:persistinginterceptors andentity:persistedlisteners:The mutation itself succeeds (the in-memory store reflects the new value — assert passes mid-test) which scopes the failure cleanly to the event factory, not the persist pipeline.
Tests are intentionally left failing so the fix-PR can flip them to green without rewriting the assertions.
See #28 for root-cause analysis and two proposed fix paths. Happy to follow up with the implementation against whichever path maintainers prefer.
🤖 Generated with Claude Code