Skip to content

feat(presentation): app state and the repository session - #143

Merged
dwikiriyadi merged 1 commit into
mainfrom
feat/g1-task9-app-state-session
Nov 15, 2026
Merged

dwikiriyadi merged 1 commit into
mainfrom
feat/g1-task9-app-state-session

Conversation

@dwikiriyadi

Copy link
Copy Markdown
Member

G1 Task 9 (closes #12).

What

:module:presentation

  • WindowState: windows, their tabs in order, and the tab in front.
    • A repository already shown in any tab comes to the front instead of opening twice.
    • Closing a tab brings its neighbour forward; closing a window's last tab leaves Home in it.
    • openRepositories is the set of repositories the sessions follow.
  • OperationsState: running background work, by kind, target and percent. An entry is removed however its work ends.
  • RepoSnapshot: refs, the status summary, which parts are loaded or refreshing, the last failure per part, and whether the watcher fell back to polling.
  • RepositorySession and RepositorySessions: the interfaces features observe.

:app:desktop

  • GitRepositorySession, a Sinew AppService with Session lifetime.
    • File-watcher changes request refreshes: a ref change reads refs and status, a status change reads status, and a full refresh or polling fallback reads both.
    • Each part reads in its own loop over a conflated channel, so a burst of changes during a read queues exactly one more read.
    • Writes go through WriteQueue, one at a time per repository.
  • RepositorySessionsService, with App lifetime.
    • Runs one session per repository that some tab shows: it starts with the first tab and stops with the last, cancelling the watcher and any running git read.
    • windowFocused reads a window's repositories again.
  • sinew-presentation 1.1.0 is added to the version catalog. It's already listed in the Libraries note.

Tests

  • 9 session tests on a fake watcher and fake repositories.
  • 5 app-state tests.
  • ./gradlew check passes.

Rulings (in plans/progress.md)

  • Sessions run under one App-lifetime service, because AppServiceHost takes a fixed list of services.
  • The snapshot has no "operation in progress" field until the operation banner arrives in G2.
  • A focused window reads every part again, not only the stale ones.
  • :module:presentation exposes :module:data:git as an api dependency.
  • The 4-reader cap per repository is deferred to the runner.

🤖 Generated with Claude Code

WindowState keeps windows and tabs, opening a repository once in
whichever window shows it. OperationsState tracks background work for
the status bar. A GitRepositorySession keeps each open repository's
snapshot (refs, status) current from the file watcher, queues writes
one at a time, and runs from its first tab to its last under
RepositorySessionsService, which also reads a window's repositories
again when it comes to the front.

Closes #12

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Dwiki Riyadi <[email protected]>
@dwikiriyadi
dwikiriyadi merged commit 0cdcd51 into main Nov 15, 2026
6 checks passed
@dwikiriyadi
dwikiriyadi deleted the feat/g1-task9-app-state-session branch November 15, 2026 23:04
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.

:module:presentation and :app:desktop: app state and the repository session

1 participant