chore(entity-resolver): remove dead resolve_entity/_create_entity/link_unit_to_entity#2367
Merged
Merged
Conversation
…k_unit_to_entity These per-entity methods have no live callers — the retain/PATCH paths all go through the batched resolve_entities_batch + flush_pending_stats, which already sort their writes for consistent lock ordering. The dead _create_entity carried an unsorted 'entities ON CONFLICT ... DO UPDATE' that looked like a concurrent deadlock site (it isn't, since it's unreachable). Removing the dead code so it stops misleading readers/reviewers. _update_cooccurrence is removed too — its only caller was the dead link_unit_to_entity.
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.
Summary
Removes four dead methods from
EntityResolverthat have no live callers:resolve_entity(singular) — superseded by the batchedresolve_entities_batchpath used by retain/PATCH; zero callers anywhere (incl. tests)._create_entity— only reachable from the deadresolve_entity.link_unit_to_entity(singular) — superseded bylink_units_to_entities_batch; zero callers._update_cooccurrence— only reachable from the deadlink_unit_to_entity.Why
While reviewing #2353 (sort
unit_idsto avoid a concurrent-insert deadlock ongraph_maintenance_queue),_create_entity'sentities ... ON CONFLICT ... DO UPDATElooked like another live concurrent-deadlock site. It isn't — it's unreachable. The live entity paths are already deadlock-safe by consistent lock ordering:bulk_insert_entities) — caller sorts bylower(name)+DO NOTHINGDO UPDATE(flush_pending_stats) — bothsorted()with explicit "prevents deadlocks" commentsbulk_insert_links,bulk_insert_unit_entities— sorted at the callerDeleting the dead code so the misleading unsorted
DO UPDATEstops tripping up future readers and reviewers.Scope / safety
ruff check/formatandtyclean;lint.shpasses.test_entity_resolver.py,test_entity_labels.py,test_entity_resolver_pg_trgm.py,test_graph_entity_fanout_cap.py— 106 passed.check-unused-codejob).