fix(recompute): refresh a reader's derived values when its read peer is deleted
Why
Deleting a node that other nodes read across a relationship left the readers with derived values (display label, human-friendly id, computed attribute) that still named the deleted peer after a merge or rebase. Tracked in IFC-2852.
Root cause
The reader does appear in the merge/rebase change set, but as an update whose changed field is the relationship to the deleted peer. The coalesced deriver treated updates as needing no self recompute, on the assumption the node refreshed its own derived values inline on the save that recorded the change. A peer deletion never triggers that inline recompute (the reader is not saved, its edge is closed from the peer side). The only submission was a reverse lookup from the deleted peer, which finds no readers once its edges are closed, so the reader kept its stale value.
Fix
An update whose changed fields include a relationship now also recomputes the node's own derived values that read across it, keyed by the node's own id. This works because the reader still exists. It covers both merge and rebase through the shared build_coalesced_recompute. Attribute-only updates are unchanged, so the coalescing behavior for the common case is preserved.
Tests
- Un-marked the former strict xfail
test_deleting_read_peer_refreshes_reader_after_merge: it now asserts the reader's computed attribute refreshes across the deleted peer and its human-friendly id (local name) stays unchanged. - Component test
test_merge_delete_peer_coalesces_reader_recompute_by_own_id(intest_merge_submits_coalesced.py): a real merge with several readers of one deleted peer, asserting they are recomputed by their own id and coalesced into one submission per family. - Unit tests in
test_build_coalesced_recompute.pycover the selection logic: the own-id self recompute when a relationship changes, plus tolerance of profile/template and absent kinds.
Notes
- The live delete path (outside the coalesced deriver) is a separate concern noted in IFC-2852.
Summary by cubic
Fixes stale derived values on readers after a related peer is deleted during merge or rebase by recomputing the reader’s computed attribute, display label, and HFID by the reader’s own id (IFC-2852). Also hardens coalesced recompute for unscoped updates and profile/template or absent kinds.
- Bug Fixes
- Relationship updates also recompute the node’s own values by id and coalesce multiple readers; attribute-only updates unchanged.
- Unscoped updates imprecisely recompute cross-node readers and the node’s own values; coalescing preserved.
- Relationship resolution tolerates profiles/templates and absent kinds; recompute no longer aborts.