Keeps both halves of the #739 fix, which are complementary rather than
competing: selectChildBranch (dev, via #1071) points local state at the
freshly created sibling after an edit, and persistedBranchSelections
(this branch) keeps the optimistic negative ids out of what is written
back to the server.
switchBranch wrote negative client ids into selected_branches even though reload hydration drops them (n > 0 only). Keep local UI updates but only POST persisted ids.
#923 inlined 25 lines of orphan detection into the middle of
buildVisiblePath, between "group by parent" and "walk". Extract it as
walkStartKey() so the function reads as its three steps again; behaviour and
the #912 regression tests are unchanged.
Fixes#912. Deleting a turn left descendants pointing at deleted rows, so the session lost its root and rendered a blank page. Splice deleted rows out of the parent-pointer tree on delete, and let buildVisiblePath recover already-corrupted sessions from their oldest orphan.