Skip to content

Feat/show stashes#59

Merged
mabd-dev merged 13 commits into
mainfrom
feat/showStashes
Jun 2, 2026
Merged

Feat/show stashes#59
mabd-dev merged 13 commits into
mainfrom
feat/showStashes

Conversation

@mabd-dev

@mabd-dev mabd-dev commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Pull Request

Description

Update repodetails view to show stashes and changes in a tabbed view

Changes Made

  • Create tab layout in repodetails view
  • Render repo changes/stashes based on selected tab
  • Add unit test to repodetails view (covers ~90%)
  • Add "github.com/stretchr/testify/assert" testing package. Used only in repodetails view

Testing

  • Tested locally with example workflows
  • Added new tests (if applicable)
  • Tested with different filters, output, etc...

Screenshots

Screenshot 2026-06-02 at 1 22 57 PM

Checklist

  • I have starred the repository
  • My code follows the project's code style
  • I have updated the documentation (README, cli-flags, etc...)
  • My changes generate no new warnings
  • I have tested my changes in a real workflow
  • All tests pass locally

Greptile Summary

This PR refactors the repodetails view to display uncommitted file changes and stashes in a tabbed layout, with left/right (or h/l) key navigation between tabs. New unit tests covering ~90% of the view are also added alongside a testify/assert dependency.

  • Tab switching: selectedTabIndex is managed via modular arithmetic in Update(), and View() dispatches to buildUncommittedFiles() or buildStashes() depending on the active tab.
  • New tests: main_test.go, update_test.go, and additions to view_test.go validate tab initialization, key navigation, and rendering — but the test helper file lacks the _test.go suffix and will be compiled into the production binary.
  • Type safety gap: tabStashes is declared without an explicit tabKey type in the const block, making it an untyped string constant that bypasses the named-type constraint.

Confidence Score: 4/5

The change is self-contained and the tab navigation logic is sound; the issues found are minor conventions and design concerns that don't break runtime behaviour.

Tab switching uses correct modular wrap-around arithmetic, UpdateData keeps tab counts in sync, and the new tests cover the happy paths well. The two noteworthy items are: test_helpers.go lacking the _test.go suffix (causing helper code to land in the production binary) and selectedTab() silently mutating selectedTabIndex through a pointer receiver when called from View(), which contradicts the Elm architecture's expectation of a pure view.

internal/render/tui/repodetails/types.go (selectedTab mutation) and internal/render/tui/repodetails/test_helpers.go (missing _test.go suffix)

Important Files Changed

Filename Overview
internal/render/tui/repodetails/types.go Adds tab types, tab model, and selectedTab() helper; tabStashes is missing explicit tabKey type annotation, and selectedTab() mutates state via pointer receiver which is called from View()
internal/render/tui/repodetails/view.go Adds tabbed rendering with buildTabs() and buildStashes(); calls selectedTab() in both View() and per-tab loop which causes redundant pointer mutations
internal/render/tui/repodetails/test_helpers.go Test helper file without _test.go suffix — will be compiled into the production binary
internal/render/tui/repodetails/update.go Adds left/right/h/l key handling for tab switching with correct modular wrap-around arithmetic
internal/render/tui/repodetails/main.go Initializes tabs list on model creation and keeps it in sync on UpdateData; looks correct
internal/render/tui/update.go Forwards arrow/h/l keypresses to repoDetails.Update when the repos table is focused; straightforward delegation

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[KeyPressMsg: left/h/right/l] --> B[tui update.go
updateReposTable]
    B --> C[repodetails.Update]
    C --> D{Key?}
    D -- right / l --> E["selectedTabIndex = (index+1) % len(tabs)"]
    D -- left / h --> F["selectedTabIndex = (len(tabs)+index-1) % len(tabs)"]
    E --> G[Return updated Model]
    F --> G
    G --> H[View called]
    H --> I[selectedTab]
    I --> J{Active tab key?}
    J -- tabChanges --> K[buildUncommittedFiles]
    J -- tabStashes --> L[buildStashes]
    K --> M[Rendered output]
    L --> M
Loading

Reviews (1): Last reviewed commit: "docs: updated changelog" | Re-trigger Greptile

Greptile also left 3 inline comments on this PR.

@mabd-dev mabd-dev added this to the V 1.5.0 milestone Jun 2, 2026
@mabd-dev mabd-dev added enhancement New feature or request ui labels Jun 2, 2026
@mabd-dev mabd-dev self-assigned this Jun 2, 2026
Comment thread internal/render/tui/repodetails/types.go
Comment thread internal/render/tui/repodetails/helpers_test.go
Comment thread internal/render/tui/repodetails/types.go Outdated
@mabd-dev mabd-dev merged commit bd118f3 into main Jun 2, 2026
3 checks passed
@mabd-dev mabd-dev deleted the feat/showStashes branch June 2, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant