The _updateCalculated logic looks correct, but can you add some tests for `#replace` and `#remove`, verifying that parents get updated in the correct ways?