Skip to content

Accept a tray group's snapshots in one request - #1071

Merged
SimonCropp merged 1 commit into
mainfrom
accept-group-in-one-request
Nov 18, 2026
Merged

SimonCropp merged 1 commit into
mainfrom
accept-group-in-one-request

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

What

Accepting a group's snapshots, from the tray's "Pending Snapshots (n)" button or from "Accept all in" a header in a window attached to the queue, now goes to the queue owner as one AcceptKeys request with every key in it.

Why

Both surfaces sent one Accept per snapshot, and the tray also sent a List after each. That was two round trips plus a rewrite of the source file per snapshot. With one solution, the group is the whole queue, so a long queue was slow. Each accept also moves the lines under the keys still to be sent. The owner rebases pending entries after an accept, so a later snapshot in the same file could be found gone and skipped as already settled.

How

  • ViewerVerb.AcceptKeys: the body is the keys, one per line (ViewerMessage.KeysBody / ReadKeys). IQueueOwner.AcceptKeys returns the batch's message and whether any named snapshot is still pending unwritten. That covers not written, failed, or conflicted (a conflicted snapshot is never tried). The reply carries this as Written. Tracked keys are left alone.
  • Each owner runs the accept-all batch it already has, limited to those keys, so a source file's snapshots are one read and one write:
    • viewer: ViewerSession.BeginAcceptKeys plus AcceptAllRunner.Drive(out tally). A batch already in flight is waited out first, as DiscardAll does.
    • tray: OwnedInlineHost.AcceptEvery with a key filter. Conflicts are counted within the group, not across the whole queue.
  • Tray: Tracker.Accept(IEnumerable<PendingSnapshot>) calls the new IInlineHost.Accept(list, out message). When not everything landed, it raises one balloon, "Could not accept every snapshot. …".
  • Attached viewer: OwnerLink.AcceptGroup sends the snapshots as one AcceptKeys and holds the deletes when the reply's Written is false, as before.

Compatibility

An owner that predates the verb fails to parse the request and answers Unreadable request (now ViewerServer.UnreadableRequest). RemoteInlineHost and OwnerLink take that as the cue to send one Accept per key, as before. A newer owner sent only Accepts by an older client behaves as it always did.

Tests

  • ViewerProtocolTests.AnAcceptOfKeysCarriesThemAllAndSaysWhetherTheyWereWritten
  • TrackerSnapshotTest: a group is one request, a group that was not written reaches the balloon, and an older owner gets an accept each
  • OwnedInlineHostTest: an accept of keys takes those alone and counts the conflicts it was handed; with the real applier, a group lands in its file and a snapshot left out of it keeps its literal
  • IpcTests.AcceptKeysTakesThoseAlone (viewer as owner)

Locally (Debug), these pass: DiffEngineTray.Core.Tests, DiffEngineViewer.Tests, ViewerProtocolTests and TrayViewerSyncTest. The Release build has not been run locally.

A group's accept from the tray menu, or from a window attached to the queue, sent an accept per snapshot, and from the tray a listing after each: two round trips and a rewrite of the source file per snapshot, with each accept moving the lines under the keys still to send. AcceptKeys carries every key in one request, and each owner runs it as its accept-all batch over those keys, a source file at a time. An owner that predates the verb answers that it cannot read the request, and is sent an accept per snapshot as before.
@SimonCropp SimonCropp added this to the 21.1.0 milestone Nov 18, 2026
@SimonCropp
SimonCropp merged commit 46d8334 into main Nov 18, 2026
16 checks passed
@SimonCropp
SimonCropp deleted the accept-group-in-one-request branch November 18, 2026 05:46
This was referenced Nov 18, 2026
This was referenced Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant