Skip to content

feat(ui): rebuild the interface on colony-ui - #53

Merged
MotherSphere merged 106 commits into
mainfrom
gitspace-colony-ui
Nov 25, 2026
Merged

MotherSphere merged 106 commits into
mainfrom
gitspace-colony-ui

Conversation

@MotherSphere

Copy link
Copy Markdown
Member

Rebuilds the interface on colony-ui 0.1.6 and iced 0.14, so GitSpace looks and behaves like the other Colony programs.

Shell:

  • The sidebar lists repositories: pinned first, then by last opened. The magnifier (or Ctrl+K) turns the title row into a search field of the same height, so the list does not move. Each entry shows changed files, ahead/behind and a dot for uncommitted work. "+ Clone or open" sits at the bottom.
  • The list has no 15-entry cap and also picks up the repositories in the default clone folder. A removed scanned entry stays hidden.
  • A repository opens with a header (branch, ahead/behind, open folder, open terminal, Fetch/Pull/Push, remotes menu) and four tabs: Changes, History, Branches, Stashes. Ctrl+1 to Ctrl+4 switch tabs on any keyboard layout; Alt+Up/Down move between repositories.

Screens:

  • Changes: staged and unstaged files with line counts, diff with line numbers, discard one file (with confirmation), commit box with summary counter, description, templates and sign-off.
  • History: branch, remote and tag badges, merge markers, commit detail with files and diff.
  • Branches: one primary action (check out), merge and rebase in a two-part button with a sentence saying what happens, rare actions in a menu, an ahead/behind card, the branch's own commits.
  • Stashes: new stash bar, stash cards with branch, date and file count (untracked files included), contents view.
  • Add a repository: GitHub, GitLab, URL or local folder, with clone progress.

Preferences: the colony-ui page (General, Appearance, Accessibility, About) plus Accounts, Git and Network. 26 theme families, accents, text size, dyslexia font, reduced motion, English and French. Changes apply at once; there is no Save button.

Files move once from <config>/gitspace/ to Colony/GitSpace/ (config, tokens, keys, logs). An interrupted move resumes on the next start, a different file on both sides is never overwritten, and secret files stay 0600. An existing config.json keeps every value; the old Catppuccin theme maps to the colony-ui Catppuccin variant.

Checked locally with Rust 1.100: fmt, clippy -D warnings, 209 tests, also with core.autocrlf=true to match the Windows runner. The release build was launched and each tab looked at on Linux (Wayland). macOS and Windows rely on CI. Sign-in with GitHub and GitLab was not run against the real services.

Snapshot of the iced rewrite as it stood locally: new views under src/ui,
the git, auth and .NET helper glue they need, and the Cargo changes. It
does not build or pass CI yet; it is pushed so the work is not only on one
machine.
Conflicts resolved as follows:
- auth and config come from main (GitHub device flow, https-only token
  hosts). Token validation stays async for the iced runtime.
- git modules keep the repository cache from this branch and use the
  git2 0.21 API from main.
- the UI keeps the iced rewrite. The built-in updater, removed on main,
  is also removed from the iced preferences, app and notifications.
- dependencies follow main's pinned versions; eframe, egui and
  poll-promise give way to iced 0.13.1, tokio and arboard. The vendored
  objc2 patch was only needed by eframe 0.27 and is dropped.
Ports the device flow from main: the panel shows the user code with copy, open and cancel actions while a background task polls GitHub. Built-in client IDs win over the ones typed in the panel, as on main.
…and line

Ports the terminal launcher from main to the iced overview panel, with its test.
The iced clone panel now streams progress from the clone thread, and a failed clone or search raises a notification with Retry and Copy log path, as the egui panel did. Copying uses iced's clipboard task: arboard dropped its clipboard right after writing, which loses the text on Linux, so the crate is removed.
Unused message variants are removed. Git helpers that are tested but not used by the iced UI yet keep an allow(dead_code) with that reason.
The repository tracked 96 JetBrains Mono Nerd Font files (223 MB) and the binary embedded 8 of them, but no widget asks for a weight, style or the Mono family. Only Regular and the OFL licence stay.
Pull received the upstream branch name and used it as the local branch:
on feature tracking origin/main it moved refs/heads/main, switched HEAD
to main and ran a forced checkout, which discarded uncommitted changes.

pull_branch now takes the local branch and the upstream branch
separately, refuses to run when HEAD is not the local branch, and
fast-forwards that branch with a safe checkout. A modified file that the
update would touch makes the pull fail and leaves the file and the ref
as they were.

push_branch takes the same pair and pushes
refs/heads/<local>:refs/heads/<upstream>. RemoteInfo gains push_url so
the overview resolves the push token from the URL the push goes to.
is_ssh_url only knew ssh:// and user@host:path. git+ssh://, ssh+git://
and host:path without a user slipped past the allow_ssh setting, and the
saved token could be offered to them as a password.

SSH detection now follows git: the three SSH schemes, or a colon before
any slash when there is no scheme, except a Windows drive letter. The
token is only handed out for https:// URLs.
validate_token chose the API with a substring test, so a GitHub
Enterprise host such as github.company.com, which contains github.com,
had its personal access token sent to https://api.github.com/user.

The host is now parsed from the normalized origin and compared exactly:
github.com and api.github.com use https://api.github.com, other hosts
starting with github. use {origin}/api/v3, and gitlab.com or hosts
starting with gitlab. use {origin}/api/v4. Any other host is accepted
without a request, as before. The trimmed token is the one sent.
A manual token was saved under the host exactly as typed, while lookups
go through extract_host, which returns the lowercase host name without
scheme or port. Tokens typed for https://gitlab.example.com,
GitLab.example.com or gitlab.example.com:8443 were saved but never found.

extract_host now also handles host:port, which Url::parse reads as a
URL with a scheme and no host, and always lowercases. Manual and OAuth
tokens are saved, read and cleared under that key. clear_token also
removes an entry saved under the host as typed by an older release.
Branch checkout and stash apply both used a forced checkout. Checkout
replaced modified files with the target branch's version, and stash
apply reset unstaged edits in files the stash does not touch. Both now
use libgit2's safe checkout and report an error when a modified file is
in the way.

Stash apply and drop went by index only, so a stash list that changed
since the panel was refreshed could apply or drop another stash.
StashEntry now carries the stash commit id, and apply_stash and
drop_stash refuse to act when the stash at that index has a different
id.

Stashes are now signed with the repository's configured identity. The
GitSpace placeholder is kept for repositories without one.
With the encrypted fallback off, clear_token left tokens.enc as it was,
so turning the fallback back on brought a signed-out token back. A
failed keyring delete was only logged while the host still left the
host list, which hid a token that remained in use.

clear_token now removes the host from tokens.enc whenever the file
decrypts, whatever the fallback setting. A keyring error is returned and
the host stays listed. clear_oauth_token returns the error of either
entry instead of ignoring the one for the refresh token.
The local key and salt files were written with the default mode and
chmod 0600 afterwards, so they were briefly readable by other users. A
key file of the wrong size, for example after a truncated write, was
regenerated and overwritten, which made tokens.enc unreadable for good.
A salt file of the wrong size was overwritten the same way.

Secret files are now written through write_private, a variant of
write_atomic that creates the temporary file with mode 0600 on Unix
before renaming it into place. tokens.enc and token-hosts.json use it
too, so a file left 0644 by an older release becomes 0600 on its next
write. A key or salt file of the wrong size is treated like an
unreadable one: an error is logged, a secret for this session only is
used and the file is left as it is.
detect_conflicts runs on the thread-local cached repository, whose index
object is loaded once. After `git merge` wrote a conflicted index, it
still saw the old one and reported no conflicts. It now calls
index.read(false) first. Status and diff already refresh the index, and
refs and HEAD are read from disk on each lookup.

The cache kept a RwLock inside the thread-local RefCell, so a closure
that called with_cached_repo again deadlocked on the lock. The cache is
now a map of Rc<Repository> borrowed only during lookup. RepoCache,
RepoHandle and their helpers were only used by the module's own tests,
and invalidate_cached had no caller; they are removed, along with the
module-wide allow(dead_code).
When the keyring was locked at startup, tokens.enc was written with the
local key. On the next start with the keyring unlocked, the keyring key
was used and the file could no longer be decrypted.

When the keyring key fails to decrypt tokens.enc, the local key file is
now tried as well, without creating it. After a successful fallback
decrypt the tokens are written again under the keyring key, and the
configuration guide says so. The doc comment of the local key now states
that GITSPACE_TOKEN_MASTER_PASSWORD only applies to that key, as the
guide already did.
stdout and stderr were piped but only read after the process exited.
Once git wrote more than a pipe buffer (64 KiB on Linux), it blocked on
the write and the wait loop ran until the 5-minute timeout. Both pipes
are now read on their own threads while the loop polls, and the
timeout still kills the process.
GitLab access tokens expire after about two hours. The refresh token was
saved but never used, so a GitLab OAuth sign-in stopped working after
that time.

OAuthToken now also saves the client ID and token endpoint it was issued
with. When resolve_for_host finds an expired OAuth token that has a
refresh token, it exchanges the refresh token through the blocking oauth2
client, saves the new token and returns its access token. A response
without a new refresh token keeps the current one. If the refresh fails,
including for tokens saved by older releases without a client ID, the
error is logged and no token is returned.
The callback server handled error= before it checked the state, and a
state mismatch ended the wait. Any request to
127.0.0.1:9876/callback, from any web page, could therefore end the
sign-in. The provider's error and error_description were put into the
answer page without HTML escaping. Accepted sockets inherit
non-blocking mode on macOS and Windows, so read() could fail with
WouldBlock and the real callback was dropped.

parse_callback now checks the state first. A request on another path or
without the expected state gets a 400 answer and the wait goes on. Query
values are percent-decoded, and the error page escapes the error text.
The accepted socket is switched back to blocking mode before it is read.
Only the setters clamped these values. An auto_fetch_interval_minutes of
0 in config.json or in an imported file reached iced::time::every with a
zero duration, which panics in tokio. With panic = "abort" in release
builds, GitSpace then closed on every launch.

The getters now clamp as well: the auto-fetch interval to 1 to 1440
minutes, so the conversion to seconds cannot overflow, and the log
retention to MIN_LOG_RETENTION_FILES to MAX_LOG_RETENTION_FILES.
Importing any JSON object yielded the default preferences, which were
then saved: the full config.json, whose fields sit under
"preferences", or {} reset every preference. Export wrote "{}" when
serialization failed and wrote the file in place.

Import now reads the "preferences" object of a whole config.json, and
refuses a file that has none of the known preference fields. Export goes
through write_atomic and returns serialization errors.
Diff:
- Commit summaries reported file sizes in bytes as additions and
  deletions. They now come from each delta's patch line stats.
- Patch text started header lines with libgit2's origin codes (F, H, B,
  =, >, <). Only added, removed and context lines get a prefix now.
- Single-file diffs treated the path as a glob, so `[draft].md` matched
  `d.md` instead of itself. Pathspec matching is now disabled for them.
- Non-UTF-8 paths no longer all map to one "(unknown)" entry.

Log:
- Filters ran after revwalk.take(limit), so the limit counted walked
  commits and a match older than the first `limit` commits was missed.
  The walk now stops once `limit` commits matched.
- The branch filter only looked in refs/heads; names such as origin/x
  are now resolved too.
- A repository with no commit yet returns an empty log instead of an
  error.

Status: an unborn HEAD now reports its branch name instead of failing.
- list_branches uses Branch::is_head instead of comparing names with
  HEAD's shorthand.
- merge.rs: the EmptyStringExt trait served one call and is inlined.
- compare.rs: include_untracked has no effect on a tree-to-tree diff.
- find_repo_root opened the discovered repository a second time through
  the cache and ignored it.
The repository cache was its only user and no longer needs a lock.
Nothing in the tree used these items:

- AuthManager::set_token
- the keybindings preference and the Keybinding type
- the branch_box_height preference and MIN_BRANCH_BOX_HEIGHT
- the AppError::Auth variant and the AppError constructor helpers, which
  only their own test called

The module-wide allow(dead_code) in error.rs is gone so the compiler
reports unused items again. The git2 conversion test now converts a real
git2::Error. Old config.json and exported files that still have the
removed fields load as before: unknown fields are ignored.
Removing a token returned an error when no Secret Service, Keychain or Credential Manager is running, so the account could never leave the list. That case now counts as nothing to remove; a locked keyring is still an error.
The Latte, Frappe, Macchiato and Mocha constructors repeated the same typography and spacing. Theme::from_mode now passes the palette to one private constructor.
Control height, motion intensity, reduced motion and performance mode were only read by animation.rs, which nothing used. They are removed from the panel, from Preferences and with animation.rs. Old config files that still hold these keys load as before; serde ignores them.

A theme change now applies the last applied preferences with the new theme, instead of every unsaved edit in the panel. Closing the panel restores the last applied values. Reset asks for confirmation first. Import and export errors are shown in red under the buttons, and a cancelled file dialog no longer reports an error.

The five button style closures share one helper.
GitLab searches no longer ask for the simple project listing, which left
out the visibility field. Rows now show public or private; internal
projects count as private because they need a GitLab account.

The clone progress bar moves a fifth of the way to the real progress on
each frame while effects are on, and shows the real value when they are
off. It jumps back to zero when delta resolution starts.
…d Network

The page replaces the content area and is built from the kit's
preferences_page, category_list, collapsible_section, setting_row,
dropdown and functional_toggle. Categories: General, Appearance and
Accessibility from the kit, then Accounts, Git and Network under a
GitSpace separator, then About. There is no Save button; each change
applies and is saved when it is made. The identity button, Close, Ctrl+,
and Escape all close it.

General adds the interface language (System, English, Français), the
option to reopen the last repository at startup (now honoured), and the
import, export and reset of the preferences file. Reset still asks for
confirmation.

Accounts holds what the old authentication panel did, unchanged in
behaviour: account cards with Disconnect, GitHub's device code with Copy,
Open github.com and Cancel, GitLab's browser sign-in, personal access
tokens, the encrypted-file fallback and the OAuth client IDs. The Add
repository screen's "Connect an account" opens this category.

Git has the default clone folder (applied on Enter or Browse, so a
half-typed path never starts a folder scan), the folder scan toggle,
background fetch with intervals of 1, 5, 15, 30 or 60 minutes, pinned
branches with remove, and log retention with a button that opens the
logs folder. Network has both proxies, the idle timeout, Prefer HTTPS and
Allow SSH. About shows the version, licence, source link and the settings
and logs folders with Copy and Open.

The old preferences, authentication and theme modules are gone, and the
test that rejects literal UI strings now runs.
Account cards for OAuth sign-ins now show the account name. It is read
once from the host's /user endpoint when the token is saved and kept in
the token entry. Tokens saved before this change, or saved while that
read failed, keep the old "signed in with OAuth" line.

A clone folder typed in Preferences without pressing Enter is now applied
when the page closes, from Close, the identity button, Escape or Add
repository. Before, it was dropped the next time the page opened.
GitSpace reopens the last repository on Changes only when "Reopen the
last repository at startup" is on and its folder still exists.
Otherwise it starts on the Add repository screen instead of showing an
error toast for a folder that is gone.
No screen uses Tone::Error, so the dead-code exception on the chip
module goes with it.
The README, the layout and UI stack pages, the architecture page and the
configuration guide now describe the sidebar, the four repository tabs,
the Add repository screen and Preferences, the colony-ui themes and the
English and French interface. Labels, endpoints and fetch intervals
match the current build.
A stash made with "Include untracked files" keeps those files in its
third parent, not in the stash tree. The file count, Show contents and
the file patch only compared the stash with its first parent, so a stash
of new files read "0 files" and looked empty before a Drop. The files of
the third parent are now added as new files.
iced's stack only hides the cursor from the layers below when the top
layer reports a mouse interaction, and the text and padding of an error
toast report none. A click meant for the toast could press Stage file,
Stash changes or a confirmation button underneath. The error toast now
reports an idle pointer over its whole area, as the kit's success toast
does through its button.
Opening a repository moves it to the top of RECENT, so the next step
counted from its new position and went back and forth between the two
most recent repositories. The list now keeps the order it had when the
steps began, both for stepping and on screen, until another row is
picked or the search opens.
The friendly messages and display prefixes of AppError, the checks of
pull and push, the SSH and HTTP policy errors, the clone stall message
and the token checks shown in Accounts were fixed English sentences, so
the French interface showed them in English. They now come from the
English and French label tables. Text from libgit2 and the HTTP client
is kept as the untranslated detail.
…ions

Fetch, push and auto-fetch only reloaded the header, and the window
gaining focus only reloaded Changes and Stashes. Branches, History and
the header could then show a HEAD, an upstream count or a merged state
that no longer held, and a merge, rebase or delete confirmation named
one branch while git acted on another.

Every successful fetch, pull or push on the open repository now reloads
the other tabs, and focus reloads the header and Branches. Branches
keeps its open band and a running action when the same repository is
read again, and a header reload of the open repository no longer
disables its buttons or restarts the auto-fetch timer. Merge, rebase
and delete also stop when HEAD, or the merged state a delete was
confirmed on, changed after the confirmation was shown.
Picking a repository in the sidebar, by a click, Enter in the search or
Alt+Up and Alt+Down, or pressing Ctrl+1 to Ctrl+4 changed the state
behind Preferences but left the page on screen. These now close
Preferences through its own message, as "+ Clone or open" already did,
so a clone folder typed without Enter is still applied.
iced reports the character a key types, and on an AZERTY keyboard the
top-row digit keys type "&", "é", the double quote and the apostrophe,
so the tab shortcuts never fired there. A key that does not type a digit
now falls back on its physical position, top row or keypad.
A successful fetch, auto-fetch or push on the open repository reloaded
every tab, History included. History then dropped the selected commit,
its diff and an open checkout question, and showed its loading state
again at each auto-fetch tick. During a History checkout its busy flag
went back to false, so the button could be pressed again.

A fetch or a push leaves HEAD and the working tree as they were, so it
now reloads only Branches, for its upstream counts. The header already
reloads itself. A pull still reloads every tab.
Six French labels of the token checks (empty, too short, too long,
invalid characters, host not on https, rejected) said "jeton", while
Preferences and every other French label say "token".
The physical-key fallback for Ctrl+1 to Ctrl+4 also matched Numpad1 to
Numpad4, but those arms never ran: with NumLock on the keypad types its
digit, which is read first, and with NumLock off it sends named keys
such as End, which never reach the fallback. The test now covers both
keypad cases through shortcut().
The check that stops a confirmed merge, rebase or delete when the
repository changed outside GitSpace compared only the name of HEAD. A
detached HEAD is named "HEAD" on every commit, so moving it from one
detached commit to another went unnoticed and the action ran against a
commit the confirmation did not describe.

The branch read now also keeps the commit HEAD points at, and the check
compares that commit too. A commit made on the current branch from a
terminal also stops the action now, since the counts shown with the
confirmation no longer hold.
…tail

The Branches tab selected the current branch when it opened, and the
detail of the current branch showed only its name and a subtitle such
as "no upstream · last commit 2 h ago", so the screen looked empty.

The tab now selects the first local branch other than the current one,
pinned branches first as in the list, and the current branch only when
there is no other. The current branch's detail shows the relation card
against its upstream when it has one, then its last 10 commits under
"Latest commits on <branch>" with "View in History →".
A commit row cut its summary where the ref badges began, with no sign
that text was missing: "feat: add file 3" with the badges v0.1.0 and
main showed "feat: add file". The summary now ends in "…" where it is
cut, and the badges and the short hash keep their full width. The
badges sit right after the summary instead of at the right edge of the
row.

The new widget measures the text with the renderer's paragraphs and
searches for the cut again only when the text, its size, its font or
the available width change.
GitSpace still wrote some of its own errors as fixed English sentences,
so the French interface showed them in English: the commit checks, the
discard checks, starting and waiting for git merge and rebase, the stale
stash list, the token and SSH answers to a remote, the OAuth sign-in,
the token storage in the keyring and in the encrypted file, and the
preferences import. They now come from the English and French label
tables. Text from libgit2, the system and the provider is kept as the
untranslated detail, and the log messages stay in English.

The tests that matched the English text now compare with the labels.
The Windows runner checks files out with CRLF (core.autocrlf), so the pull test failed on content that was otherwise correct.
On Windows the restored file is checked out with CRLF (core.autocrlf), which the test compared byte for byte.
…psis

The branch list and the commit list under a branch clipped long names and summaries without a mark. They now use the ellipsis widget, like the History list.
The literal-string and hex-colour guards stopped reading a file at its first #[cfg(test)] line, so the test-only helper in the middle of history.rs hid the rest of that file. They now skip only the test item itself, tracked by its brackets, and read on. A self-test checks a sample with a test function, a test use and a test module in the middle.
@MotherSphere
MotherSphere merged commit 1ed9b7d into main Nov 25, 2026
10 checks passed
@MotherSphere
MotherSphere deleted the gitspace-colony-ui branch November 25, 2026 10:23
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