Skip to content

Let 3D Diff name its own base ref #35

Description

@Dillpickleschmidt

Part of #1

Blocked by #34, which lands the scope selector this control sits beside.

Question

3D Diff's window is whatever the 2D panel's Automatic base resolves to, because the server asks that panel's own service for it. Give the surface the same base-ref combobox the 2D panel has, and stop borrowing.

Graduated from the map's fog, where it sat as an answered question folded into #32; split out by that ticket's resolution.

The plumbing

ReviewDiffPreviewInput already accepts a baseRef and GitVcsDriverCore already prefers it over its own resolution (:2153). So this is one query param on EnvironmentDiffOverlayQuery (environmentHttp.ts:541), through DiffOverlayService.getOverlay, into readSteps, which already takes baseRef as an argument (DiffOverlay.ts:200-218).

The combobox itself is the 2D panel's, and its ref list is already independent of the diff preview — localBranchRefs / remoteBranchRefs are their own queries (DiffPanel.tsx:366-409). Nothing new server-side to list refs.

What it buys, stated accurately

#32 claimed this retires the 255ms getDiffPreview call outright. It does not — the saving is conditional on an explicit base:

  • With a named base, getDiffPreview is not needed for the window. headRef comes from the same call today (DiffOverlay.ts:145) and has to come from the vcs driver instead.
  • Automatic stays the default, and on that path the call remains. Most requests keep paying.

assertWorkspaceBoundCwd is already called independently of the preview, deliberately, and the comment at DiffOverlay.ts:122-126 says why — so removing the preview on the explicit-base path must not quietly take the workspace boundary with it. That comment predicted this ticket; keep it honest.

The arbitrary twenty-commit fallback also goes away for an explicit base. Not hypothetical: this clone sits on main, undiverged, so the fallback is what the surface actually shows here today.

How big this is

Settled, not open. #34 resolved that 3D uses diffPanelStore rather than keeping its own selection, so this ticket is the query param plus wiring — the base ref is read from and written to branchBaseRefByThreadKey, the same field the 2D combobox uses. One control, one stored value, nothing to keep in sync.

The combobox is rendered twice, in two surfaces, over one piece of state. That is the point: a second stored base ref would be exactly the drift the map's renderer rule exists to prevent.

Done when

Differentially verified, not eyeballed: for at least three explicit bases the steps match an independently spelled git log <base>..HEAD, and the Branch changes aggregate matches git diff --numstat <base>...HEAD. Automatic's behaviour is unchanged — same range, same steps as before this ticket. Confirm the workspace boundary still rejects an out-of-workspace cwd on the explicit-base path, since that path no longer runs the preview. Measure the warm request on both paths so the conditional saving is a number rather than a claim. Commit to a branch and push it; no PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions