Skip to content

Walk full DAG in entire checkpoint list and accept a git-style revrange#1117

Open
Soph wants to merge 6 commits intomainfrom
soph/make-list-like-git-log
Open

Walk full DAG in entire checkpoint list and accept a git-style revrange#1117
Soph wants to merge 6 commits intomainfrom
soph/make-list-like-git-log

Conversation

@Soph
Copy link
Copy Markdown
Collaborator

@Soph Soph commented May 5, 2026

https://entire.io/gh/entireio/cli/trails/299

entire checkpoint list now mirrors git log semantics on every branch — checkpoints on merged feature branches are visible from main, and on a feature branch we no longer stop at commits reachable from main. To opt back into the old "feature-only" view (or scope to any other range), pass a positional revrange: A..B, A.. (= A..HEAD), ..B / B (full from B). Symmetric-difference (A...B) is rejected with a hint.

Same shift for entire checkpoint explain <id>'s associated-commits scan: default is now a full DAG walk capped at commitScanLimit. If the cap is hit with zero matches, it auto-falls back to an uncapped walk and prints a one-line Searching full history (no match in last N commits)… note. --search-all still skips straight to uncapped for callers who know the target is older than the cap.

Removes the now-unused computeReachableFromMain / walkFirstParentCommits helpers and their direct test.

Examples

# All checkpoints reachable from HEAD (default, includes merged branches)
entire checkpoint list

# Only checkpoints unique to this branch — the old feature-branch view
entire checkpoint list main..

# Checkpoints landed between two release tags
entire checkpoint list v0.5.0..v0.6.0

Test plan

  • mise run check (fmt + lint + unit/integration/canary E2E) passes
  • entire checkpoint list on a feature branch shows checkpoints reachable from HEAD, including those on merged branches
  • entire checkpoint list main.. matches the prior feature-branch view
  • entire checkpoint list main...HEAD errors with a hint
  • entire checkpoint explain <id> for a checkpoint on a merged branch finds the associated commit without --search-all

Note

Medium Risk
Changes the default checkpoint/associated-commit discovery semantics to walk the full git DAG (including merged branches) and adds revision-range parsing, which could affect performance and the set/order of checkpoints shown. Risk is mitigated by scan caps with fallback behavior and expanded unit test coverage around merge scenarios and range parsing.

Overview
entire checkpoint list now accepts an optional positional git-style revision range (e.g. main.., A..B, <ref>) and defaults to git log-like reachability from HEAD, including checkpoints introduced via merged feature branches.

Checkpoint discovery for both the list view and entire explain <checkpoint> associated-commit lookup is refactored to walk the full DAG (instead of first-parent/default-branch filtering), with a bounded scan (commitScanLimit) and an automatic uncapped fallback that prints a one-line notice when needed. The PR removes the old first-parent/main-reachability helpers, updates CLI help/output labeling for scoped ranges, and adds/updates tests for merge-parent visibility, revision-range parsing, and the capped-scan fallback.

Reviewed by Cursor Bugbot for commit f0f2fdb. Configure here.

Soph and others added 4 commits May 5, 2026 10:12
`entire checkpoint list` now mirrors `git log` semantics on every branch:
the walk follows merge parents so checkpoints on merged feature branches
are visible from main, and it no longer stops at commits reachable from
main when on a feature branch. Shadow branch reachability reuses the
hash set built during the commit walk instead of doing a second pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Entire-Checkpoint: 3a867c1bcd46
`entire checkpoint list [<revrange>]` accepts git-style ranges:
A..B, A.. (= A..HEAD), ..B / B (full from B), and bare HEAD when
omitted. Symmetric-difference (A...B) is rejected with a hint.

The walk worker is now getBranchCheckpointsInRange, taking a
checkpointWalkRange. The right side seeds the DAG walk; the left side
builds an exclude set (capped at commitScanLimit) that filters both
committed checkpoints and shadow-branch reachability. The existing
getBranchCheckpoints is kept as a HEAD-only convenience wrapper for
callers and tests that don't need a range.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Entire-Checkpoint: 5c53998d0f97
The default search now walks the full DAG from HEAD bounded by
commitScanLimit, so checkpoints on merged feature branches show up
without --search-all. If the cap is reached without a match, it
auto-falls back to an uncapped walk and writes a one-line note to errW
("Searching full history (no match in last N commits)…"). --search-all
still skips the bounded pass for callers who know the target is older
than the cap.

Drops the now-unused first-parent helpers (computeReachableFromMain,
walkFirstParentCommits, errStopIteration) and their direct test.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Entire-Checkpoint: 4a2d3457aa5d
Covers the empty/HEAD default, single-ref / single-hash resolution,
A..B / A.. / ..B shortcuts, and the rejected-input paths
(symmetric-difference, unknown ref, unknown left side).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Entire-Checkpoint: ca62da6e74fa
@Soph Soph requested a review from a team as a code owner May 5, 2026 11:20
Copilot AI review requested due to automatic review settings May 5, 2026 11:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the checkpoint listing and checkpoint-to-commit association logic to match git log-style full-DAG reachability by default, and adds support for scoping entire checkpoint list to a git-style revision range (rejecting A...B with a hint). It also removes now-obsolete first-parent/default-branch filtering helpers.

Changes:

  • entire checkpoint list now walks the full DAG from HEAD by default and accepts a positional revision range (A..B, A.., ..B, <ref>).
  • entire checkpoint explain <id>’s associated-commit lookup now uses a bounded full-DAG scan with an automatic fallback to an unbounded scan when the cap is hit with zero matches.
  • Tests updated for the new associated-commit behavior; parsing tests added for revision ranges.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
cmd/entire/cli/explain.go Implements full-DAG walks for list/explain commit association, adds revision-range parsing + range-based checkpoint scanning.
cmd/entire/cli/explain_test.go Updates associated-commit tests for new semantics; adds tests for fallback scan and revision-range parsing.
cmd/entire/cli/checkpoint_group.go Extends checkpoint list command to accept an optional revision-range argument and updates help text.

Comment thread cmd/entire/cli/explain.go Outdated
Comment thread cmd/entire/cli/explain.go
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f0f2fdb. Configure here.

Comment thread cmd/entire/cli/explain.go Outdated
Soph and others added 2 commits May 5, 2026 13:59
Three fixes from Copilot + Cursor Bugbot:

* `buildReachableSet` docstring now matches the implementation:
  describes the empty-map return for the zero hash and the partial-set
  best-effort behavior on iteration errors, instead of the earlier
  "returns nil / errors only on context cancellation" claim.

* `getBranchCheckpointsInRange` no longer counts excluded commits
  toward `commitScanLimit`. Without this, a long left-side history in
  a range like `main..HEAD` (a feature branch that merged main) would
  consume the 500-commit cap before the walk reached older feature
  checkpoints. The exclude-set lookup now runs before the count++.

* Adds two end-to-end tests that exercise the range-filtered walk:
  one that asserts `A..B` semantics on a linear chain (full / left
  matches no checkpoint / left excludes B / single-side reach), and
  one regression test that puts the trailered commit past
  commitScanLimit excluded ancestors so the budget bug shows up if
  the count++ ever moves before the exclude check again.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Entire-Checkpoint: afba672398df
- Tighten the in-walk comment in getBranchCheckpointsInRange to lead
  with the why (`main..HEAD` budget starvation) instead of restating
  what the reordered code already shows.
- Drop em-dashes from table-driven test names so `-run` patterns are
  shell-friendly, and drop a redundant `wantNotContains: nil` line.
- Uncap buildReachableSet so a left-side history longer than
  commitScanLimit doesn't silently leak older commits past the
  exclude. Hashes are 20 bytes, so even 100k commits cost ~2MB.
- Rebuild the budget regression test on createCommitWithTree instead
  of worktree commits — same coverage, ~3x faster (0.79s → 0.24s).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Entire-Checkpoint: 3a65001cf1d8
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.

2 participants