Fix silent no-op deep reindex for newly created individuals in assignFromIAAPI - #1704
Open
JasonWildMe wants to merge 1 commit into
Open
Fix silent no-op deep reindex for newly created individuals in assignFromIAAPI#1704JasonWildMe wants to merge 1 commit into
JasonWildMe wants to merge 1 commit into
Conversation
Follow-up to #1547 (GH-1514). The post-commit queueIndividualsByIdForDeepReindex call in IBEISIA.assignFromIAAPI queued the raw "name" request parameter. When assignFromIA / assignFromIANoCreation creates a new MarkedIndividual, the name is only registered via addName(); the individualID is a generated UUID. The helper resolves ids via getMarkedIndividualQuiet (a primary-key lookup), so for newly created individuals the queue call silently resolved nothing and their encounters kept stale denormalized fields (individualNumberEncounters etc.) in OpenSearch. Queue the datastore individualID instead, taken from the newMarkedIndividual returned by the assign call — the same fix #1547 applied in EncounterVMData, ImportIA, and AnnotationEdit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1704 +/- ##
=======================================
Coverage 51.23% 51.23%
=======================================
Files 312 312
Lines 12396 12396
Branches 3993 3993
=======================================
Hits 6351 6351
Misses 5763 5763
Partials 282 282
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Follow-up to #1547 (issue #1514). Fixes the one site where the post-commit deep-reindex added by that PR can still silently no-op.
Summary
IBEISIA.assignFromIAAPI(the IA-driven individual-assignment API used byIAGateway) queues its post-commit deep reindex with the rawnamerequest parameter. When the assign call creates a new MarkedIndividual, that queue entry never resolves, so the new individual and its member encounters keep stale denormalized fields (individualNumberEncounters, first/last encounter dates, etc.) in OpenSearch until something else touches the individual.Root cause
new MarkedIndividual(name, enc)generates a UUIDindividualIDand only registersnameviaaddName()— the name is not the datastore id.IndexingManager.queueIndividualsByIdForDeepReindexresolves ids withShepherd.getMarkedIndividualQuiet, a strict primary-key lookup that returns null (quietly) for anything that isn't anindividualID.The existing-individual path was unaffected: there,
indivIdhad already resolved via the same PK lookup insideassignFromIA/assignFromIANoCreation, proving it is a realindividualID.This is the same name-vs-UUID bug class #1547 fixed in
EncounterVMData,ImportIA, andAnnotationEdit; this fourth site was missed.Fix
Both
assignFromIAandassignFromIANoCreationalready return the newly created individual under thenewMarkedIndividualkey. Capture its realgetIndividualID()there and queue that instead of the rawnameparameter. When no new individual was created, the behavior is unchanged (indivIdis queued, as before).One file, +7/−1.
Test plan
mvn compilecleanindividualNumberEncountersin OpenSearch without waiting for the background reconciler🤖 Generated with Claude Code