Skip to content

feat(changelens): read main history when the checkout is off main - #414

Merged
byronwall merged 3 commits into
mainfrom
claude/changelens-off-main-6a8bed
Nov 22, 2026
Merged

byronwall merged 3 commits into
mainfrom
claude/changelens-off-main-6a8bed

Conversation

@byronwall

@byronwall byronwall commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

The Changes view now works on a checkout that sits on an old branch. It says which branch you are on and how far behind main it is. The 24 hours, 7 days and Custom time windows can read origin/main's history without checking anything out.

What you'll see

  • When HEAD is not on the default branch, or is behind it, the status row starts with the branch name and the count, for example codex/search-example-pages-2026-11-09 42 behind, 1 ahead of origin/main.
  • Time windows get a History toggle: Branch or origin/main. Srcly reads Git objects only (git log, git diff, git show on origin/main). It never switches the branch or touches the working tree.
  • When the branch has no commits in a time window, the window reads origin/main and a note says so. Pick Branch to go back. The choice is kept in the URL (chist=head|main).
  • When a window on the branch is empty and origin/main has commits in the same time, the empty view says why and offers Show origin/main's history (N commits). For This branch, the button offers origin/main's last 7 days.
  • This branch keeps its meaning: the branch against its merge base.
  • origin/main is used when it exists and local main is not ahead of it; otherwise local main.

Proof

Before, on explorEDA's stale checkout (7 days): the lens read only the branch and showed nothing.

Before: 7 days on a stale branch is empty

After, same checkout and window: the status row names the branch and the gap, and the window reads origin/main (11 commits, 335 chunks).

After: status row with branch notice and History toggle

After, with Branch picked: the empty view explains why and offers origin/main's history.

After: empty Branch history offers origin/main

Checks on this branch:

  • scripts/check.sh client: 67 files, 492 tests pass, typecheck clean.
  • scripts/check.sh server: 624 tests pass. Two new tests pin the off-main window: test_a_time_window_off_main_reads_main_history_when_head_has_none (auto switch, ahead/behind, origin/main preferred over a stale local main, the branch window unchanged) and test_head_history_off_main_is_empty_and_counts_main_commits.
  • pnpm e2e: 21 passed, 1 skipped.
  • explorEDA's checkout stayed on its branch with a clean status after the run.

Limits

  • Main history leaves out uncommitted edits, because the working tree belongs to the checked-out branch.
  • The empty-state count uses git rev-list --since/--until on origin/main, so it can differ a little from the window's own first-parent run.
  • No git fetch: origin/main is only as new as the last fetch.
  • The CLI (srcly changes) gets the automatic switch but has no --history flag.

Survey moves: corpus only. This PR adds code to client/ and server/, which the survey samples (the new Branch dataclass and branch helpers in changelens/window.py, and BranchNotice.tsx). That adds one server trace (partial) and moves its frontier and boundary stops (+16 external-code, +2 budget-exhausted, -1 unproven-handoff in each repo). No analysis code changed.

🤖 Generated with Claude Code

byronwall and others added 3 commits November 21, 2026 23:12
…branch

Selection now carries where HEAD stands against the default branch
(ahead, behind, origin/main or local main) and which history a time
window read. A time window on a branch with no commits in it reads the
default branch instead. history=head|main picks one explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The status row names the checked-out branch and how far it is behind
the default branch when HEAD is off it. Time windows get a History
toggle between the branch and origin/main. An empty window offers
main's history when main has commits there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@byronwall
byronwall enabled auto-merge (squash) November 22, 2026 04:26
@byronwall
byronwall merged commit 6e34ba6 into main Nov 22, 2026
9 of 10 checks passed
@byronwall
byronwall deleted the claude/changelens-off-main-6a8bed branch November 22, 2026 04:35
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