fix add_edge_to_view leaving edge_id to -1 in SQL - #331
Open
TeunHuijben wants to merge 1 commit into
Open
Conversation
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.
Fix:
add_edge_to_viewleaves the localedge_idas -1 on a SQL rootReviving a soft-deleted edge into a view with
add_edge_to_viewleft the view's local copy of the edge withedge_id = -1(the placeholder) when the root is aSQLGraph. The id map was updated correctly, soview.edge_id(a, b)returned the right root id whileview.edge_attrs()still showed -1 for that row — the two disagreed, and any read of that edge's attributes by edge id hit zero rows.Reproduction
The root graph is fine throughout, and the in-memory backends are unaffected: there the view reuses the root's edge payload by reference, so the id comes along for free.
_add_edge_localonly breaks for a non-rx root, where it re-fetches the edge attrs, dropsedge_id, and never stamps it back.Fix
Stamp the root edge id into the reconstructed payload in
_add_edge_local, the same wayadd_edgeandbulk_add_edgesalready do.Test
test_add_edge_to_view_keeps_edge_id— revive an edge into a view, then assert the id map, theedge_attrs()row, and a read by edge id all agree. Parametrized over all three backends; it failed onSQLGraphonly before the fix.