Skip to content

feat(git-history): ragged gutters and a ten-lane window; fix(app-workspaces): id entropy - #1673

Merged
huichen merged 6 commits into
mainfrom
pr/huichen
Nov 22, 2026
Merged

huichen merged 6 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

The git lane graph now sizes each row's gutter to the lanes that row actually
uses, widens the drawing window from six lanes to ten, and draws the bundle's
folded thread broken. The change spans all three surfaces: the host decoder,
the TUI /git panel, and the desktop/mobile history panels. A one-lane row no
longer reserves the width of the busiest row on the page, so subjects start
next to their own lane while a page still pays only for its busiest row; work
past the tenth column is still marked and can no longer read as one branch
running down the page.

The branch also carries a fix for Host store id minting: the random suffix was
24 bits, so a burst of a few hundred rows in one second hit a birthday
collision (UNIQUE constraint failed: workspaces.id) — this is what failed
Rust Linux test / host-remote in the first CI run of this PR. The suffix is
now 60 bits.

Commits

  • feat(git-history): size each gutter to its own lanes, cap the window at ten
  • feat(git-history): draw the bundle's thread broken
  • fix(app-workspaces): mint ids with entropy a one-second burst cannot exhaust

Verification

Local, at the frozen head 272ca80 (pinned Rust 1.99.1, ulimit -n 8192):

  • cargo fmt --all -- --check — clean
  • cargo check -p future-host -p future-tui — clean
  • cargo clippy -p future-host -p future-tui --all-targets -- -D warnings — clean
  • cargo test -p future-host --lib — 2341 passed, 0 failed, 15 ignored
  • cargo test -p future-tui --lib — 1849 passed, 0 failed
  • the previously failing test run 25 times in a row — 25/25 passed
  • cargo test -p future-app-workspaces --lib — 23 passed
  • npx tsc --noEmit -p packages/git-graph/tsconfig.json — clean
  • npx vitest run packages/git-graph/src/index.test.ts — 25 passed
  • desktop: npm run typecheck clean; vitest run src/features/git-history 25 passed; eslint on the touched files clean
  • mobile: npm run typecheck clean (local jest cannot start because this checkout's node_modules lacks @react-native/js-polyfills/error-guard; CI runs the mobile suite)
  • make check-docs — 425 docs OK
  • python3 scripts/tests/test-screenshot-scenario-fragments.py — ok

User-visible changes

  • Git history graphs (TUI /git, desktop history panel, mobile git graph): the lane window grows from 6 to 10, and each row's gutter is now only as wide as that row's own lanes. Before: every row was padded to the widest row on the page, and work past six lanes folded into column six. After: a one-lane row's subject starts one lane in, the page is as wide as its busiest row, and work past ten lanes folds into column ten with the * (diamond on phone and desktop) marker. Revert: 9aa1d90.
  • Folded thread glyph: a bundle line past the window now draws a broken thread (┊ in the TUI; a dashed stroke on phone and desktop) instead of a solid line, so folded work is distinguishable from a real lane in that column. Revert: 9ed6a6e.
  • Host store ids: row ids minted in one second now carry 60 random bits instead of 24, so a bulk import or replay of a few hundred rows can no longer fail with UNIQUE constraint failed. Ids keep the same prefix and timestamp shape; only the suffix widens. Revert: 9cf3231.

Notes

  • Demo fixtures under desktop/shot/mock, mobile/shot/mock and the git-lane-window screenshot scenario were re-dumped from an eleven-branch repository, so the screenshots show real output rather than a hand-drawn grid.
  • The six-colour palette is unchanged; with ten columns it now repeats every six columns, which the palette.ts comment documents.

…at ten

The gutter used to be padded to the widest row in the page, so one commit
sitting alone on one lane still reserved the width of twelve lanes and the
subject started far to the right of the line it belongs to. Now a row's
drawing is only as wide as the lanes that row actually uses, so a one-lane
commit's refs start one lane in and the page pays for its busiest row rather
than for its busiest row in every row.

That budget is what makes a ten-lane window affordable where six used to be
the phone's limit: a line of work past the tenth still folds into the tenth
column and is marked `*` (a diamond on the phone and the desktop), so the
cap, the fold mark and the six-colour palette all behave as before — the
palette now repeats every six columns out of ten, which is the distance the
comment already relied on.

The columns (date-time, committer) are still a block read down the list, so
what fits is decided once per page against its widest gutter: a row cannot
drop the committer while its neighbour keeps it.

Three surfaces, one picture: host/src/git_history.rs (what the phone and the
desktop decode), tui/src/workbench/git_panel.rs and tui/src/workbench/screen.rs
(the `/git` panel), with the demo fixtures re-dumped from a real eleven-branch
repository so the screenshots are real output rather than a hand-drawn grid.
The window's last column is shared by every line past the tenth, so a `│`
there claimed a lane this row does not have: nothing distinguished "this
column's line" from "the work continues past the window", and that is how
several folded lines came to read as one branch running down the page.

On a row that has no commit of its own in that column the bundle now draws
`┊` — same column, same width, same colour — and only while a bundle exists:
inside the window the last column stays an ordinary lane with its solid `│`,
so a ten-lane history prints exactly what it printed before. A connector
(`┬`, `┐`, the fold's own `*`) keeps its shape; the change is about the
straight run.

The phone and the desktop decode `┊` as a dashed stroke rather than a new
kind of line: it is the same thread, seen through the window's edge.

Fixtures re-dumped from the real eleven-branch repository those screenshots
use, so the demo data is the host's current output and not a picture typed
out by hand.
@huichen huichen changed the title feat(git-history): size each gutter to its own lanes, cap the window at ten feat(git-history): ragged gutters, a ten-lane window and a broken fold thread Nov 22, 2026
@huichen
huichen enabled auto-merge (squash) November 22, 2026 16:30
…exhaust

The id is a prefix, the local time to the second, and a random suffix, so
every row created inside one second differs only in the suffix. That suffix
was three random bytes — 24 bits to separate a whole second's worth of rows —
and a burst of 210 rows in one second is a 1-in-768 birthday collision:

  UNIQUE constraint failed: workspaces.id

which is exactly how `Rust Linux test / host-remote` failed on PR #1673:
`the_handshake_confirmation_does_not_grow_with_the_catalogue` creates 10 + 200
conversations in ~80 ms, each through `create_thread` -> `create_id("ws")`, in
a HOME the fixture owns privately. Nothing races there — the loop is
single-threaded and each insert runs in its own BEGIN IMMEDIATE — so two rows
could only carry the same id by being *minted* with the same id, and the id
column has no default or trigger to supply one. Measured on the current
generator: 2 of 2 000 bursts of 210 ids contained a duplicate, and a burst of
100 000 produced 330 (99670 unique), matching C(n,2)/2^24.

These are primary keys on every row kind the Host store mints (`ws`, `thread`,
`event`, `artifact`, `approval`, `rsnap`, `review`, ...), so the exposure is
not a test's: a bulk import or an importer's replay of a few hundred
conversations in one second fails the same way on a user's machine.

Eight bytes of the v4 UUID (60 bits after its version nibble) put a burst of
n ids in one second at n^2/2^61 of a repeat, which no caller reaches.

Tests: the shape test states the new width, and a burst of 20 000 ids must
contain no repeat — it fails on the three-byte suffix about twelve times per
run and passes on eight.
@huichen huichen changed the title feat(git-history): ragged gutters, a ten-lane window and a broken fold thread feat(git-history): ragged gutters and a ten-lane window; fix(app-workspaces): id entropy Nov 22, 2026
@huichen
huichen merged commit 7621251 into main Nov 22, 2026
29 checks passed
@huichen
huichen deleted the pr/huichen branch November 22, 2026 17:17
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