[PR #8192] [MERGED] feat(client): fit the branch graph to its window #8178

Closed
opened 2026-10-25 04:04:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8192
Author: @ylli-selmani
Created: 10/23/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @ylli-selmani

Base: staging ← Head: feat/chat-branch-graph-fit


📝 Commits (3)

  • ebd921b feat(client): fit the branch graph to its window
  • 7b67d20 fix(client): measure the branch graph whenever its timeline is shown
  • 4b4219f refactor(client): decide once whether the branch graph is drawn

📊 Changes

4 files changed (+170 additions, -46 deletions)

View changed files

📝 docs/chats/branches.md (+1 -1)
📝 packages/client/src/components/chat/ChatBranchGraphWindow.tsx (+65 -20)
📝 packages/client/src/lib/chat-branch-graph-layout.ts (+76 -25)
📝 scripts/regressions/chat-branch-graph-layout.regression.ts (+28 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Part of #8157. Follow-up to #8160.

Why this change

  • The branch graph window can be moved and resized, but the graph kept its fixed size, so making the window bigger only added empty space around it.

What changed

  • layoutChatBranchGraph takes an optional fit (the timeline's room in pixels) and uses it:
    • A bigger window unfolds the shortest folded runs first, as many as fit at the normal dot spacing.
    • A graph that still has room left zooms in as a whole, up to 2×, then spreads its dots and lanes out, up to 48 drawing units each.
    • A window too narrow for the graph folds what it always did and scrolls. The graph is never zoomed out.
  • ChatBranchGraphWindow measures the timeline with a ResizeObserver and passes the room to the layout.
    • The SVG draws in drawing units through a viewBox, scaled to pixels.
    • Chat names grow with the zoom, but only up to 1.4×, so they keep fitting.
    • The scroll-to-tip waits for the first measurement.
  • The chat-branch-graph-layout regression covers a narrow window, a wide one, a very wide one and a small graph that zooms in.
  • docs/chats/branches.md gets one sentence on how the graph fills its window. The translation follow-up is added to #8163.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • pnpm check passed, with only the existing serverRun lint warning in HomeProfessorMariChat.
  • node scripts/run-regressions.mjs --filter chat-branch-graph passed.
  • Resized the graph window in the app, with a small group (4 chats) and a long one (a 160-message root with two branches):
    • The small graph zoomed in to fill the window.
    • The long graph unfolded runs as the window grew, and scrolled when it was narrow.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

  • None yet.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8192 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ylli-selmani](https://github.com/ylli-selmani) **Base:** `staging` ← **Head:** `feat/chat-branch-graph-fit` --- ### 📝 Commits (3) - [`ebd921b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ebd921b2633ef041869411664ad7f59cc718c455) feat(client): fit the branch graph to its window - [`7b67d20`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7b67d2006fdff02c9d5c4f735cba56d76d450308) fix(client): measure the branch graph whenever its timeline is shown - [`4b4219f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4b4219ffc3661f3c5fd7f4b81caaafad05c1aaf7) refactor(client): decide once whether the branch graph is drawn ### 📊 Changes **4 files changed** (+170 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `docs/chats/branches.md` (+1 -1) 📝 `packages/client/src/components/chat/ChatBranchGraphWindow.tsx` (+65 -20) 📝 `packages/client/src/lib/chat-branch-graph-layout.ts` (+76 -25) 📝 `scripts/regressions/chat-branch-graph-layout.regression.ts` (+28 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Part of #8157. Follow-up to #8160. ## Why this change - The branch graph window can be moved and resized, but the graph kept its fixed size, so making the window bigger only added empty space around it. ## What changed - `layoutChatBranchGraph` takes an optional `fit` (the timeline's room in pixels) and uses it: - A bigger window unfolds the shortest folded runs first, as many as fit at the normal dot spacing. - A graph that still has room left zooms in as a whole, up to 2×, then spreads its dots and lanes out, up to 48 drawing units each. - A window too narrow for the graph folds what it always did and scrolls. The graph is never zoomed out. - `ChatBranchGraphWindow` measures the timeline with a `ResizeObserver` and passes the room to the layout. - The SVG draws in drawing units through a `viewBox`, scaled to pixels. - Chat names grow with the zoom, but only up to 1.4×, so they keep fitting. - The scroll-to-tip waits for the first measurement. - The `chat-branch-graph-layout` regression covers a narrow window, a wide one, a very wide one and a small graph that zooms in. - `docs/chats/branches.md` gets one sentence on how the graph fills its window. The translation follow-up is added to #8163. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `pnpm check` passed, with only the existing `serverRun` lint warning in `HomeProfessorMariChat`. - `node scripts/run-regressions.mjs --filter chat-branch-graph` passed. - Resized the graph window in the app, with a small group (4 chats) and a long one (a 160-message root with two branches): - The small graph zoomed in to fill the window. - The long graph unfolded runs as the window grew, and scrolled when it was narrow. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) - None yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-25 04:04:29 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8178
No description provided.