Skip to content

Sync join repair keeps distinct pins and a Mac's split views - #1128

Open
advenimus wants to merge 2 commits into
yetanotherbrowser:mainfrom
advenimus:advenimus/sync-repair-followup
Open

advenimus wants to merge 2 commits into
yetanotherbrowser:mainfrom
advenimus:advenimus/sync-repair-followup

Conversation

@advenimus

Copy link
Copy Markdown
Contributor

What changes

Two fixes to the duplicate-Personal repair from #1106, found by Greptile after it merged:

  • A pin in the copy is no longer deleted just because a pin in the first Personal is on the same page right now.
  • A Mac's split view no longer disappears when its tabs move to another space.

Why it happened

  • Pins: the repair treated pins as the same pin when their current url matched. Two pins saved at different addresses can both sit on the same page, such as a sign-in page. The copy's pin was dropped, and deleting the copy then removed its record from every device. A pin is now the same pin only when its saved address (home) matches, falling back to the current page when home is missing.
  • Split views: a split view is a pair record kept under its tabs' space. PhoneSync.move wrote each tab's own record and left the pair under the old space. Deleting the old space then deleted the pair. A move now carries a pair to the new space once both of its tabs are there. This applies to every move between spaces, not only the repair's, because the cause is in move.

Proof

  • Logic: two new SyncBridgeTests that fail on main and pass here:
    • two pins saved at different addresses, on the same page, both survive the repair;
    • a split view in the copy moves into the first Personal and survives the copy's delete.

Checked on

  • iPad Pro 13" and iPhone 18 Pro simulators, iOS 27.2.
  • Engine(s) tried: not about a page.

Checklist

  • SyncBridgeTests pass on iPad and iPhone. Two join tests fail only when run after other suites, and they fail the same way on main.
  • ./design-check --base origin/main and scripts/swift-parse-check --base origin/main are clean.
  • Nothing visible changes.

The repair of a second Personal left out a pin of the copy when the first
space had a pin at the same current address, and the copy's delete then
took it from every device. Two pins saved at different pages can be on
the same page now, a sign-in page both sent to, and are still two: the
second went with its saved address (home), which only the Mac writes.

A pin is now the same pin by where it was saved: the record's home,
else the page it is on, when the repair and a first join fold the
starting space into the first.
A split view is a pair record under its tabs' space. Moving a tab to
another space wrote its own record only, so a pair whose tabs both moved
still named the old space: no row showed it, and that space's delete
took it. The join repair moves a second Personal's tabs into the first
space and deletes the copy, so a Mac lost the split views it had there.

A move now carries the tab's pairs once both tabs are in the new space,
for every move between spaces, not only the repair's.
@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect pin merging and split-view syncing within shared browser spaces.

The split-view fix needs to handle separate deliveries to a live Mac before merging.

Findings

  1. P1 Split views can still disappear ▶

Summary

The PR compares pins by their saved address and moves split-view records once both tabs reach another space.

  • Pin merging keeps pins saved at different addresses distinct.
  • A split view moves with its tabs when both reach another space.

Reviews (1) · Last reviewed commit: "fix: a Mac's split view moves with its t..." · Reviewed by Greptile

fields["order"] = Value(tab.order)
try write(SyncCollection.tab, id, fields)
emit(.local, [.tab(tab)])
let pairs = target == from ? [] : try carryPairs(of: id, from: from, to: target)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Split views can still disappear

When the repair reaches a live Mac in separate deliveries, write can send the first tab move before the second tab and the pair's new parent. The Mac saves the old row without the pair. Before taking the next delivery, SyncCenter.receive compares that saved row with its journal and deletes the missing pair. Pair removals always win, so the later carryPairs write cannot restore the split.

Preserve pairs across partial moves on the receiving side, and test separate deliveries through the real Mac row path.

Knowledge Base Used:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant