Skip to content

fix: intermittent stale push statusline after commit#36

Merged
martinabeleda merged 1 commit intomainfrom
hotfix/stale-push-status
Mar 30, 2026
Merged

fix: intermittent stale push statusline after commit#36
martinabeleda merged 1 commit intomainfrom
hotfix/stale-push-status

Conversation

@martinabeleda
Copy link
Copy Markdown
Owner

Summary

This fixes an intermittent issue where, after committing, the statusline sometimes failed to update the ↑N commits to push indicator right away.

Root cause (observed behavior)

Immediately after git commit, the first snapshot refresh could occasionally return stale upstream/ahead state, causing the statusline to continue showing the previous
unpushed count.

What changed

  • App::refresh refactor
    • Added refresh_now() for immediate refreshes.
    • refresh() still enforces debounce.
    • force_refresh() now uses direct non-debounced refresh.
  • Post-commit refresh hardening
    • In execute_commit(), capture previous_unpushed.
    • After successful commit, refresh once.
    • If unpushed count did not advance (after <= before), refresh a second time.
  • Testability + regression coverage
    • Extracted logic into refresh_unpushed_after_commit(...).
    • Added tests:
      - refresh_unpushed_after_commit_retries_when_first_refresh_is_stale
      - refresh_unpushed_after_commit_does_not_retry_when_unpushed_advances

Why this is safe

  • Retry is narrowly scoped to successful commit flow.
  • Second refresh only occurs when the first result looks stale.
  • Existing debounce behavior for normal periodic refresh remains unchanged.

Testing

  • Added targeted unit tests for retry/no-retry behavior.
  • Ran full suite:
  cargo test -q

All tests pass.

…times after a successful commit, the push statusline could stay stalej and not reflect the new "to push" count immediately.jj Refactor refresh internals to support explicit non-debounced refreshes andj add a guarded second refresh after commit when the first refresh appearsj stale (unpushed count did not advance).jj Also extract post-commit refresh behavior into a testable helper and addj regression tests for:j - retry when first refresh is stalej - no retry when first refresh is already correctj
@martinabeleda martinabeleda merged commit fad86fd into main Mar 30, 2026
4 checks passed
@martinabeleda martinabeleda deleted the hotfix/stale-push-status branch March 30, 2026 17:18
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