Skip to content

glitter: follow-ups from the stash and live-status PRs - #405

Merged
m4ttheweric merged 13 commits into
mainfrom
glitter-followups
Sep 24, 2026
Merged

m4ttheweric merged 13 commits into
mainfrom
glitter-followups

Conversation

@m4ttheweric

@m4ttheweric m4ttheweric commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

glitter: follow-ups from the stash and live-status PRs

The leftovers the final reviews of #399 and #400 flagged: an empty diff header after a failed Leave or a discarded last file, a stash-drop failure reported as a stash failure, a stale push after a worktree switch, and some code a third view would have copied. Plus a fetch-time bug found while checking it live.

What changed

Selection (lib/mission/driver.ts, lib/mission/model.ts)

  • One rule, reconcileSelectedPath, for the driver and the view's cursor: keep a file the filtered list still shows, else its first row, else nothing (the clean-tree card).
  • Checkout, worktree, repo, stash, and discard no longer reset the selection; a filter change reconciles it too.
  • A failed Leave or a discarded last file now shows the clean-tree card.

Background refresh

  • A git-status sweep reads everything, including a moved selection's diff, before it writes.
  • A sweep that any refresh() overtook is discarded and pushes nothing, which covers worktree, repo, and branch switches.
  • A sweep whose selection or filter moved mid-read runs again, so a file it saw still lands.
  • Selecting a file reads its diff before moving the selection, and another worktree's diff for the same path opens at its top.

Stash (lib/mission/stash.ts)

  • A failed drop of the old entry says the changes were stashed and the old entry stayed; a checkout that then fails reports both, stash message first.

Fetch time (packages/git-core/src/fetch-state.ts, lib/daemon/git-status-sweep.ts)

  • git empties FETCH_HEAD before it connects, so a failed fetch read as "Last fetched just now"; fetchState now counts only a written FETCH_HEAD.
  • The background sweep skips repos with no origin remote instead of failing their fetch every pass.

Also

  • S stash and h show stash on the Changes keybar.
  • toBadge moves to lib/git-badge.ts, so glitter imports nothing from lib/daemon/ directly. (lib/state/index.ts still loads two store modules that live in lib/daemon/ by design; they do no work on load.)
  • ui/internal/busyspin: one spinner helper for board and mission.
  • A test pins the top bar's layout across every spinner frame.
  • Fixture branch names, and the mission boards, no longer use a ticket-shaped branch name.

After merge

  • The sweep change is daemon code: restart the daemon to pick it up.

Verification

bun test for git-core, lib/mission, lib/ui and lib/daemon, root tsc, the Go suites, glitter e2e, test:pty, and repo purity are green. Each new driver and board test was checked to fail with its fix removed. Checked live: the keybar hints at 160 columns, discarding the only changed file lands on the clean-tree card, and a "src" filter moves the diff to the first file the list shows. CodeRabbit was rate limited, so two independent Opus reviews stood in; neither found a blocking issue, and their findings are fixed here.

🤖 Generated with Claude Code

m4ttheweric and others added 11 commits September 24, 2026 08:22
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… a discarded sweep

A refresh that no longer finds the selected file falls to the first
listed row, or to the clean-tree card when nothing is left, so a failed
Leave or a discarded last file no longer leaves an empty diff header.
A git-status sweep discarded by a worktree switch no longer pushes the
new worktree paired with the old one's status.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ing the stash

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Checkout, worktree, repo, stash and discard no longer reset the
selection; refresh keeps a file the filtered list still shows, else the
first row, exactly as the view's cursor does, and a filter change does
the same. A git-status sweep now reads everything before it writes and
is discarded by any refresh that started meanwhile, which also covers a
branch checkout in the same worktree. A checkout that fails after a
failed stash drop reports both.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
git empties FETCH_HEAD before it connects, so a fetch that fails leaves
an empty file with a fresh mtime. fetchState now reads only a written
FETCH_HEAD as a fetch, and the background sweep skips repos with no
origin remote instead of failing their fetch every pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 82 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2cf2caf7-285a-4ac8-9556-954facb4012a

📥 Commits

Reviewing files that changed from the base of the PR and between 5289e10 and ed08005.

⛔ Files ignored due to path filters (6)
  • docs/design/mission/BranchModal.png is excluded by !**/*.png
  • docs/design/mission/ContextMenu.png is excluded by !**/*.png
  • docs/design/mission/History.png is excluded by !**/*.png
  • docs/design/mission/Main.png is excluded by !**/*.png
  • docs/design/mission/Stash.png is excluded by !**/*.png
  • docs/design/mission/WorktreeModal.png is excluded by !**/*.png
📒 Files selected for processing (31)
  • docs/design/mission/README.md
  • docs/design/mission/mission.pen
  • docs/superpowers/plans/2026-09-21-glitter-foldout-creation.md
  • lib/daemon/__tests__/git-status-sweep.test.ts
  • lib/daemon/git-status-sweep.ts
  • lib/git-badge.ts
  • lib/mission/__tests__/compose-stash.test.ts
  • lib/mission/__tests__/driver.test.ts
  • lib/mission/__tests__/imports.test.ts
  • lib/mission/__tests__/menu-action.test.ts
  • lib/mission/__tests__/model.test.ts
  • lib/mission/__tests__/stash.test.ts
  • lib/mission/driver.ts
  • lib/mission/model.ts
  • lib/mission/stash.ts
  • lib/ui/__tests__/protocol.test.ts
  • packages/git-core/src/__tests__/fetch-state.test.ts
  • packages/git-core/src/fetch-state.ts
  • ui/fixtures/session-model-mission.json
  • ui/internal/busyspin/busyspin.go
  • ui/internal/busyspin/busyspin_test.go
  • ui/internal/views/board/board.go
  • ui/internal/views/board/board_test.go
  • ui/internal/views/mission/changes.go
  • ui/internal/views/mission/history_test.go
  • ui/internal/views/mission/mission.go
  • ui/internal/views/mission/mission_test.go
  • ui/internal/views/mission/model_test.go
  • ui/internal/views/mission/render_test.go
  • ui/internal/views/mission/stash_test.go
  • ui/internal/views/picker/picker_test.go

Comment @coderabbitai help to get the list of available commands.

m4ttheweric and others added 2 commits September 24, 2026 09:42
A pass discarded because the selection or filter changed mid-read is
now run again instead of dropped, since the daemon emits only on a
change and nothing else would re-read what it saw. Selecting a file
reads its diff before moving the selection, and a joined checkout
notice leads with the stash message.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@m4ttheweric
m4ttheweric merged commit 936a024 into main Sep 24, 2026
6 checks passed
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