From 393a3b7954eeeec5be48fbb494d09c31068a21b9 Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Thu, 5 Nov 2026 07:19:20 -0800 Subject: [PATCH 1/6] =?UTF-8?q?feat(core):=20#1662=20GIT-18/19=20Core=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=9B=BE=E6=8A=95=E5=BD=B1=20git.graphProjec?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 Core 命令 git.graphProjection:把 macOS 的 IntelliJ 提交图算法(permanent layout、head 排序、 定色、过滤后的虚线拓扑、隐藏祖先、missing parents、print element、推荐宽度)搬进 git::graph, 返回整数 lane、稳定的 color ID、路由和标签。删除没有调用方的旧 project_graph。 共享 fixture graph-projection-v1.json、IntelliJ 对拍 fixture 迁到 shared/fixtures/git/graph-idea, Rust 测试覆盖 fixture、真实历史对拍和 5000 提交规模。 Co-Authored-By: Claude Sonnet 5.5 --- Package.swift | 1 - .../LitheTests/Fixtures/GitGraph/README.md | 3 +- rust/lithe-core/src/git/graph.rs | 1480 ++++++++--- rust/lithe-core/src/git/graph_tests.rs | 971 ++++++++ rust/lithe-core/src/git/mod.rs | 4 +- .../lithe-core/src/project/file_name_order.rs | 30 +- rust/lithe-core/src/protocol/command.rs | 3 + rust/lithe-core/src/runtime/dispatcher.rs | 3 + shared/contracts/rust-core-api.md | 25 + .../fixtures/git/graph-idea}/NOTICE.txt | 0 .../elementGenerator/longEdges_in.txt | 0 .../elementGenerator/longEdges_out.txt | 0 .../elementGenerator/manyNodes_in.txt | 0 .../elementGenerator/manyNodes_out.txt | 0 .../elementGenerator/oneNode_in.txt | 0 .../elementGenerator/oneNode_out.txt | 0 .../elementGenerator/oneUpOneDown1_in.txt | 0 .../elementGenerator/oneUpOneDown1_out.txt | 0 .../elementGenerator/oneUpOneDown2_in.txt | 0 .../elementGenerator/oneUpOneDown2_out.txt | 0 .../layoutBuilder/manyNodes_in.txt | 0 .../layoutBuilder/manyNodes_out.txt | 0 .../layoutBuilder/notFullGraph_in.txt | 0 .../layoutBuilder/notFullGraph_out.txt | 0 .../layoutBuilder/oneNodeNotFullGraph_in.txt | 0 .../layoutBuilder/oneNodeNotFullGraph_out.txt | 0 .../graph-idea}/layoutBuilder/oneNode_in.txt | 0 .../graph-idea}/layoutBuilder/oneNode_out.txt | 0 shared/fixtures/git/graph-projection-v1.json | 2154 +++++++++++++++++ 29 files changed, 4306 insertions(+), 368 deletions(-) create mode 100644 rust/lithe-core/src/git/graph_tests.rs rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/NOTICE.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/longEdges_in.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/longEdges_out.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/manyNodes_in.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/manyNodes_out.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/oneNode_in.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/oneNode_out.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/oneUpOneDown1_in.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/oneUpOneDown1_out.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/oneUpOneDown2_in.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/elementGenerator/oneUpOneDown2_out.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/layoutBuilder/manyNodes_in.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/layoutBuilder/manyNodes_out.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/layoutBuilder/notFullGraph_in.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/layoutBuilder/notFullGraph_out.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/layoutBuilder/oneNodeNotFullGraph_in.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/layoutBuilder/oneNodeNotFullGraph_out.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/layoutBuilder/oneNode_in.txt (100%) rename {macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA => shared/fixtures/git/graph-idea}/layoutBuilder/oneNode_out.txt (100%) create mode 100644 shared/fixtures/git/graph-projection-v1.json diff --git a/Package.swift b/Package.swift index 2e8d847332..6d93d9c05b 100644 --- a/Package.swift +++ b/Package.swift @@ -198,7 +198,6 @@ let package = Package( name: "LitheGitModuleTests", dependencies: ["LitheGitTestSupport", "LitheGitModule", "LitheApplicationKernel", "LitheRustCore", .product(name: "Testing", package: "swift-testing")], path: "macos/Tests/LitheGitModuleTests", - resources: [.copy("Fixtures")], swiftSettings: [.swiftLanguageMode(.v6)] ), .target( diff --git a/macos/Tests/LitheTests/Fixtures/GitGraph/README.md b/macos/Tests/LitheTests/Fixtures/GitGraph/README.md index 64fed31be7..80334cf5d4 100644 --- a/macos/Tests/LitheTests/Fixtures/GitGraph/README.md +++ b/macos/Tests/LitheTests/Fixtures/GitGraph/README.md @@ -65,7 +65,8 @@ The test windows are closed at the end of each appearance check. These runtime-generated oracles supplement the nine original fixtures pinned to IntelliJ source commit `36415d346b3d18a6ded90d05afb8e0a0bface9d6` -under `LitheGitModuleTests/Fixtures/GitGraphIDEA`. See the repository's +under `shared/fixtures/git/graph-idea`; Rust Core replays them in +`rust/lithe-core/src/git/graph_tests.rs`. See the repository's `macos/Resources/GitGraph` for upstream license and attribution. The reference screenshot is reproduced from `2bedf381` through `887f49ea`, diff --git a/rust/lithe-core/src/git/graph.rs b/rust/lithe-core/src/git/graph.rs index 95286ad235..ba15a983c1 100644 --- a/rust/lithe-core/src/git/graph.rs +++ b/rust/lithe-core/src/git/graph.rs @@ -1,14 +1,104 @@ -//! Deterministic, coordinate-free Git graph projection and routing. +//! Deterministic, coordinate-free Git graph projection (`git.graphProjection`). //! -//! This module owns the shared intermediate representation used before either -//! native product turns graph lanes into pixels. It deliberately emits integer -//! lane coordinates and typed routes rather than renderer-specific paths. +//! This module owns the IntelliJ-compatible commit graph layout that both +//! native products used to implement separately: the permanent layout (head +//! ordering, depth-first layout indices and color IDs), the filtered visible +//! graph (dotted edges, hidden ancestors, missing parents), per-row element +//! ordering, lane positions, print elements, and the recommended graph width. +//! +//! The result contains only integer lane positions, stable signed color IDs, +//! routes, and typed labels. Hosts own pixels, curves, and the mapping from a +//! color ID to a theme color. +//! +//! Incremental loading: the projection is always recomputed for the whole +//! loaded window in one call. Lanes depend on every loaded edge and on the head +//! order, so carrying lane state across pages would make the first rows depend +//! on call history. A head fragment's color ID is a hash of its principal +//! reference name, so a named branch keeps its color across pages and refreshes. +//! +//! Adapted from JetBrains IntelliJ Community (`PermanentLinearGraphBuilder`, +//! `GraphColorManagerImpl`, `DottedFilterEdgesGenerator`, +//! `PrintElementGeneratorImpl`, `GraphElementComparatorByLayoutIndex`, +//! `NaturalComparator`), Apache-2.0, Copyright 2000-2024 JetBrains s.r.o. and +//! contributors. See `macos/Resources/GitGraph/NOTICE.txt`. -use crate::protocol::GitCommitResponse; -use serde::Serialize; -use std::collections::{BTreeSet, HashMap, HashSet}; +use crate::project::file_name_order::compare_reference_names; +use crate::protocol::{CoreError, ErrorCode}; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::cmp::Ordering; +use std::collections::{HashMap, HashSet}; const GRAPH_PROJECTION_VERSION: u32 = 1; +/// Largest commit list (scoped window or repository context) one request may carry. +const MAX_COMMITS: usize = 20_000; +/// IntelliJ samples at most this many rows when recommending a graph width. +const RECOMMENDED_WIDTH_SAMPLE_SIZE: usize = 20_000; +const RECOMMENDED_WIDTH_WEIGHT_RATIO: f64 = 0.1; + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +struct Request { + /// Scoped commits in Git's child-before-parent order. + commits: Vec, + /// Short names of the remotes, so a bare remote-tracking name is typed correctly. + #[serde(default)] + remote_names: Vec, + /// The complete repository history window that fixes the permanent layout. + #[serde(default)] + repository_commits: Vec, + /// Commits that match the active filter; `None` shows every commit. + #[serde(default)] + visible_hashes: Option>, + #[serde(default)] + display_mode: DisplayMode, + /// When present, the response lists the commits reachable from this local branch. + #[serde(default)] + current_branch: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +struct CommitInput { + hash: String, + #[serde(default)] + parent_hashes: Vec, + #[serde(default)] + decorations: String, +} + +#[derive(Debug, Default, Clone, Copy, Deserialize)] +#[serde(rename_all = "camelCase")] +enum DisplayMode { + #[default] + Compact, + Expanded, +} + +/// Long-edge limits taken from IntelliJ's `PrintElementGeneratorImpl`. +#[derive(Clone, Copy)] +struct DisplayOptions { + long_edge_size: usize, + visible_part_size: usize, + edge_with_arrow_size: usize, +} + +impl DisplayMode { + fn options(self) -> DisplayOptions { + match self { + Self::Compact => DisplayOptions { + long_edge_size: 30, + visible_part_size: 1, + edge_with_arrow_size: usize::MAX, + }, + Self::Expanded => DisplayOptions { + long_edge_size: 1_000, + visible_part_size: 250, + edge_with_arrow_size: 30, + }, + } + } +} #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] @@ -24,11 +114,22 @@ pub enum GraphLabelKind { Tag, } +impl GraphLabelKind { + fn name(self) -> &'static str { + match self { + Self::Head => "head", + Self::Branch => "branch", + Self::Remote => "remote", + Self::Tag => "tag", + } + } +} + #[derive(Debug, Clone, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] /// One renderer-independent label attached to a projected commit. pub struct GraphLabel { - /// Stable label identity within the projection. + /// Stable label identity, `:`. pub id: String, /// Text supplied by Git after removing transport prefixes. pub title: String, @@ -36,428 +137,1091 @@ pub struct GraphLabel { pub kind: GraphLabelKind, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] -/// A live vertical lane segment crossing one graph-row boundary. -pub struct GraphLaneSegment { - /// Stable horizontal grid column. - pub lane: usize, - /// Palette slot assigned when the lane first became live. - pub color_index: usize, +/// Which half of an edge a print element draws relative to the row center. +pub enum PrintDirection { + /// The half that reaches toward the previous (newer) row. + Up, + /// The half that reaches toward the next (older) row. + Down, } -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] -/// The topological meaning of a route leaving a commit node. -pub enum GraphRouteKind { - /// The first parent continues the mainline from this node. - FirstParent, - /// A later parent opens or converges a side lane. - MergeParent, - /// The parent lies outside the projected history window. - MissingParent, +/// One route from a commit node to a parent, in the next row's lane coordinates. +pub struct GraphParentEdge { + /// Edge identity shared with the print elements that draw it. + pub id: String, + /// Parent commit hash. + pub parent_hash: String, + /// Lane the route occupies in the next row, or `None` at the last row. + pub target_lane: Option<usize>, + /// Signed color ID of the route. + pub color_id: i32, + /// The parent is outside the loaded history. + pub is_missing: bool, + /// The parent is a visible ancestor reached through filtered-out commits. + pub is_dotted: bool, } #[derive(Debug, Clone, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] -/// An integer-grid route from one commit node to one parent target. -pub struct GraphRoute { - /// Deterministic identity derived from child hash, parent order, and parent hash. +/// A half-edge through a row center; both halves meet at the row boundary midpoint. +pub struct GraphPrintElement { + /// `<edge id>:<direction>`. pub id: String, - /// Parent commit hash supplied by Git. - pub parent_id: String, - /// Lane containing the source commit node. - pub source_lane: usize, - /// Parent lane, or `None` when history was truncated before the parent. - #[serde(skip_serializing_if = "Option::is_none")] - pub target_lane: Option<usize>, - /// Palette slot shared by all connected parts of this route. - pub color_index: usize, - /// Topological route meaning; hosts must not infer it from geometry. - pub kind: GraphRouteKind, + /// Lane of this half in the current row. + pub position: usize, + /// Lane of the matching half in the neighbouring row (own lane for a terminal). + pub adjacent_position: usize, + /// Direction of the half relative to the row center. + pub direction: PrintDirection, + /// Signed color ID of the edge. + pub color_id: i32, + /// Filtered topology drawn as a dotted line. + pub is_dotted: bool, + /// The edge ends at an unloaded parent. + pub is_missing: bool, + /// Long edges and unloaded parents end with a directional marker. + pub has_arrow: bool, + /// No matching half exists in the neighbouring row. + pub is_terminal: bool, + /// Loaded visible endpoint; missing history never invents a target. + pub target_hash: Option<String>, } #[derive(Debug, Clone, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] -/// One projected commit and only the routes crossing its lower boundary. -pub struct GraphProjectionRow { - /// Zero-based position in the supplied newest-first history order. - pub row_index: usize, - /// Full commit hash used as a stable row identity. - pub commit_id: String, - /// Lane containing the commit node. - pub node_lane: usize, - /// Sparse live lanes entering this row, ordered by lane index. - pub incoming_segments: Vec<GraphLaneSegment>, - /// Parent routes leaving this row in Git parent order. - pub routes: Vec<GraphRoute>, - /// Typed decoration labels in deterministic source order. +/// One visible commit with its lane, colors, routes, and labels. +pub struct GraphRow { + /// Hash of the commit this row draws. + pub commit_hash: String, + /// Lane of the commit node. + pub lane: usize, + /// Number of lanes occupied in this row. + pub lane_count: usize, + /// Signed color ID of the node. + pub color_id: i32, + /// Permanent layout index, independent of screen lanes. + pub layout_index: i64, + /// Color ID of every row-center element, by lane. + pub incoming_lane_colors: Vec<i32>, + /// Routes leaving this commit toward its parents. + pub parent_edges: Vec<GraphParentEdge>, + /// Typed decoration labels in source order. pub labels: Vec<GraphLabel>, + /// Explicit half-edges for this row. + pub print_elements: Vec<GraphPrintElement>, } #[derive(Debug, Clone, PartialEq, Eq, Serialize)] #[serde(rename_all = "camelCase")] -/// Versioned renderer-neutral graph projection for one bounded history window. +/// Versioned renderer-neutral graph projection for one loaded history window. pub struct GraphProjection { - /// Wire-format version for future host migrations. + /// Wire-format version for host migrations. pub version: u32, - /// Rows in the exact order of the supplied Git history page. - pub rows: Vec<GraphProjectionRow>, - /// Largest live lane width observed by any row. + /// Visible rows in display order. + pub rows: Vec<GraphRow>, + /// Widest row, in lanes. pub lane_count: usize, - /// Number of palette slots allocated while routing this page. - pub color_count: usize, - /// Whether one or more parent routes terminate outside the history page. + /// IntelliJ's weighted visible-edge width; a baseline rather than the widest row. + pub recommended_lane_count: usize, + /// One or more routes end at a parent outside the loaded history. pub has_missing_parents: bool, + /// Hashes reachable from `currentBranch`, sorted; empty when none was requested. + pub current_branch_hashes: Vec<String>, } -#[derive(Debug, Clone)] -struct Lane { - hash: String, - color_index: usize, +/// Handles `git.graphProjection`. +/// +/// Projects one loaded history window in a single call. The request carries the +/// scoped `commits`, optional `repositoryCommits` that fix the permanent layout, +/// optional `visibleHashes` for a filtered graph, `remoteNames`, `displayMode` +/// (`compact` or `expanded`), and an optional `currentBranch`. +pub(crate) fn command(payload: Value) -> Result<Value, CoreError> { + let request: Request = serde_json::from_value(payload).map_err(|error| { + CoreError::new(ErrorCode::InvalidRequest, "Invalid Git graph request") + .with_details(error.to_string()) + })?; + if request.commits.len() > MAX_COMMITS + || request.repository_commits.len() > MAX_COMMITS + || request + .visible_hashes + .as_ref() + .is_some_and(|hashes| hashes.len() > MAX_COMMITS) + { + return Err(CoreError::new( + ErrorCode::InvalidRequest, + "Too many commits to project", + )); + } + serde_json::to_value(project(&request, request.display_mode.options())).map_err(|error| { + CoreError::new(ErrorCode::ParseFailed, "Could not encode the Git graph") + .with_details(error.to_string()) + }) } -/// Projects a newest-first, topologically ordered Git history into stable lanes. -/// -/// The result has no view, pixel, curve, or platform dependency. Live lanes use -/// fixed slots until they end, which preserves continuity across incremental UI -/// rendering and prevents a merge from renumbering unrelated branches. -pub fn project_graph(commits: &[GitCommitResponse]) -> GraphProjection { - let known_hashes = commits - .iter() - .map(|commit| commit.hash.as_str()) - .collect::<HashSet<_>>(); - let mut slots: Vec<Option<Lane>> = Vec::new(); - let mut lanes_by_hash: HashMap<&str, usize> = HashMap::new(); - let mut free_slots = BTreeSet::new(); - let mut next_color_index = 0; - let mut lane_count = 0; - let mut has_missing_parents = false; - let mut rows = Vec::with_capacity(commits.len()); - - for (row_index, commit) in commits.iter().enumerate() { - let node_lane = if let Some(&lane) = lanes_by_hash.get(commit.hash.as_str()) { - lane - } else { - let lane = claim_slot(&mut slots, &mut free_slots); - slots[lane] = Some(Lane { - hash: commit.hash.clone(), - color_index: next_color_index, - }); - lanes_by_hash.insert(commit.hash.as_str(), lane); - next_color_index += 1; - lane - }; +// MARK: - labels and head ordering - let incoming_segments = slots - .iter() - .enumerate() - .filter_map(|(lane, entry)| { - entry.as_ref().map(|entry| GraphLaneSegment { - lane, - color_index: entry.color_index, - }) - }) - .collect::<Vec<_>>(); - let current_color_index = slots[node_lane] - .as_ref() - .map(|lane| lane.color_index) - .expect("the current commit always owns its lane"); +fn local_name(name: &str) -> &str { + name.strip_prefix("refs/heads/").unwrap_or(name) +} + +fn label(title: &str, kind: GraphLabelKind) -> GraphLabel { + GraphLabel { + id: format!("{}:{title}", kind.name()), + title: title.to_string(), + kind, + } +} - release_slot(node_lane, &mut slots, &mut lanes_by_hash, &mut free_slots); +fn parse_labels(decorations: &str, remote_names: &HashSet<&str>) -> Vec<GraphLabel> { + let mut labels = Vec::new(); + for value in decorations.split(',') { + let raw = value.trim(); + if raw.is_empty() { + continue; + } + if raw == "HEAD" { + labels.push(label("HEAD", GraphLabelKind::Head)); + } else if let Some(branch) = raw.strip_prefix("HEAD -> ") { + labels.push(label("HEAD", GraphLabelKind::Head)); + labels.push(label(local_name(branch), GraphLabelKind::Branch)); + } else if let Some(tag) = raw.strip_prefix("tag: ") { + labels.push(label(tag, GraphLabelKind::Tag)); + } else if let Some(tag) = raw.strip_prefix("refs/tags/") { + labels.push(label(tag, GraphLabelKind::Tag)); + } else if remote_names.contains(raw) + || raw.starts_with("origin/") + || raw.starts_with("refs/remotes/") + { + let title = raw.strip_prefix("refs/remotes/").unwrap_or(raw); + labels.push(label(title, GraphLabelKind::Remote)); + } else { + labels.push(label(local_name(raw), GraphLabelKind::Branch)); + } + } + labels +} - let mut routes = Vec::with_capacity(commit.parent_hashes.len()); - for (parent_index, parent_hash) in commit.parent_hashes.iter().enumerate() { - let kind = if parent_index == 0 { - GraphRouteKind::FirstParent +/// IntelliJ `GitRefManager` priority: main remotes, local main, other remotes and +/// branches, tags, then HEAD. +fn priority(label: &GraphLabel) -> u8 { + match label.kind { + GraphLabelKind::Remote => { + if matches!(label.title.as_str(), "origin/main" | "origin/master") { + 0 } else { - GraphRouteKind::MergeParent - }; - - if !known_hashes.contains(parent_hash.as_str()) { - has_missing_parents = true; - let color_index = if parent_index == 0 { - current_color_index - } else { - let color = next_color_index; - next_color_index += 1; - color - }; - routes.push(GraphRoute { - id: route_id(&commit.hash, parent_index, parent_hash), - parent_id: parent_hash.clone(), - source_lane: node_lane, - target_lane: None, - color_index, - kind: GraphRouteKind::MissingParent, - }); - continue; + 1 } + } + GraphLabelKind::Branch => { + if matches!(label.title.as_str(), "main" | "master") { + 2 + } else { + 3 + } + } + GraphLabelKind::Tag => 4, + GraphLabelKind::Head => 6, + } +} - let (target_lane, color_index) = - if let Some(&lane) = lanes_by_hash.get(parent_hash.as_str()) { - let color = slots[lane] - .as_ref() - .map(|entry| entry.color_index) - .expect("a tracked lane must remain allocated"); - (lane, color) - } else if parent_index == 0 { - occupy_slot( - node_lane, - parent_hash, - current_color_index, - &mut slots, - &mut lanes_by_hash, - &mut free_slots, - ); - (node_lane, current_color_index) - } else { - let lane = claim_slot(&mut slots, &mut free_slots); - let color = next_color_index; - next_color_index += 1; - occupy_slot( - lane, - parent_hash, - color, - &mut slots, - &mut lanes_by_hash, - &mut free_slots, - ); - (lane, color) - }; +fn compare_labels(left: &GraphLabel, right: &GraphLabel) -> Ordering { + priority(left).cmp(&priority(right)).then_with(|| { + let a = left.title.encode_utf16().collect::<Vec<_>>(); + let b = right.title.encode_utf16().collect::<Vec<_>>(); + compare_reference_names(&a, &b) + }) +} - routes.push(GraphRoute { - id: route_id(&commit.hash, parent_index, parent_hash), - parent_id: parent_hash.clone(), - source_lane: node_lane, - target_lane: Some(target_lane), - color_index, - kind, - }); +/// The principal reference of a head: the first minimal label. +fn best_reference(labels: &[GraphLabel]) -> Option<&GraphLabel> { + let mut best: Option<&GraphLabel> = None; + for candidate in labels { + if best.is_none_or(|current| compare_labels(candidate, current) == Ordering::Less) { + best = Some(candidate); } - - trim_empty_tail(&mut slots, &mut free_slots); - lane_count = lane_count.max( - slots.len().max( - incoming_segments - .last() - .map(|segment| segment.lane + 1) - .unwrap_or(0), - ), - ); - rows.push(GraphProjectionRow { - row_index, - commit_id: commit.hash.clone(), - node_lane, - incoming_segments, - routes, - labels: labels(&commit.decorations), - }); } + best +} - GraphProjection { - version: GRAPH_PROJECTION_VERSION, - rows, - lane_count, - color_count: next_color_index, - has_missing_parents, +/// Java `String.hashCode`, used by IDEA's `GraphColorManagerImpl` for the principal +/// fragment of a referenced head. Unreferenced heads use zero. +fn color_id(labels: &[GraphLabel]) -> i32 { + best_reference(labels).map_or(0, |reference| { + reference.title.encode_utf16().fold(0i32, |hash, unit| { + hash.wrapping_mul(31).wrapping_add(i32::from(unit)) + }) + }) +} + +/// Stable merge sort that tolerates a comparator that is not a strict total +/// order; the standard library sort may panic on one. +fn stable_sort<T: Copy>(items: &mut [T], less: impl Fn(T, T) -> bool) { + let count = items.len(); + let mut buffer = items.to_vec(); + let mut width = 1; + while width < count { + let mut start = 0; + while start < count { + let middle = (start + width).min(count); + let end = (start + 2 * width).min(count); + let (mut left, mut right, mut out) = (start, middle, start); + while left < middle && right < end { + if less(items[right], items[left]) { + buffer[out] = items[right]; + right += 1; + } else { + buffer[out] = items[left]; + left += 1; + } + out += 1; + } + while left < middle { + buffer[out] = items[left]; + left += 1; + out += 1; + } + while right < end { + buffer[out] = items[right]; + right += 1; + out += 1; + } + start += 2 * width; + } + items.copy_from_slice(&buffer); + width *= 2; } } -fn claim_slot(slots: &mut Vec<Option<Lane>>, free_slots: &mut BTreeSet<usize>) -> usize { - if let Some(&lane) = free_slots.first() { - free_slots.remove(&lane); - lane - } else { - slots.push(None); - slots.len() - 1 - } -} - -fn occupy_slot<'a>( - lane: usize, - hash: &'a str, - color_index: usize, - slots: &mut [Option<Lane>], - lanes_by_hash: &mut HashMap<&'a str, usize>, - free_slots: &mut BTreeSet<usize>, -) { - free_slots.remove(&lane); - slots[lane] = Some(Lane { - hash: hash.to_string(), - color_index, +fn sorted_heads(labels: &[Vec<GraphLabel>], children: &[Vec<usize>]) -> Vec<usize> { + let best = labels + .iter() + .map(|labels| best_reference(labels)) + .collect::<Vec<_>>(); + // A referenced branch may already have children. It still seeds the DFS + // before less important graph tips; tags alone do not create a head. + let mut heads = (0..labels.len()) + .filter(|&row| { + children[row].is_empty() || labels[row].iter().any(|l| l.kind != GraphLabelKind::Tag) + }) + .collect::<Vec<_>>(); + stable_sort(&mut heads, |left, right| match (best[left], best[right]) { + (Some(a), Some(b)) => { + if a == b { + left < right + } else { + compare_labels(a, b) == Ordering::Less + } + } + (Some(_), None) => true, + (None, Some(_)) => false, + (None, None) => left < right, }); - lanes_by_hash.insert(hash, lane); + heads } -fn release_slot<'a>( - lane: usize, - slots: &mut [Option<Lane>], - lanes_by_hash: &mut HashMap<&'a str, usize>, - free_slots: &mut BTreeSet<usize>, -) { - let previous = slots[lane] - .take() - .expect("only occupied lanes can be released"); - lanes_by_hash.remove(previous.hash.as_str()); - free_slots.insert(lane); +// MARK: - topology and permanent layout + +/// Parent and child rows over the first occurrence of each hash. +struct Topology<'a> { + by_hash: HashMap<&'a str, usize>, + parents: Vec<Vec<usize>>, + children: Vec<Vec<usize>>, } -fn trim_empty_tail(slots: &mut Vec<Option<Lane>>, free_slots: &mut BTreeSet<usize>) { - while slots.last().is_some_and(Option::is_none) { - let lane = slots.len() - 1; - slots.pop(); - free_slots.remove(&lane); +impl<'a> Topology<'a> { + fn new(commits: &'a [CommitInput]) -> Self { + // History normally has unique IDs. The first occurrence wins so + // overlapping pages cannot create a second row for one commit. + let mut by_hash = HashMap::with_capacity(commits.len()); + for (row, commit) in commits.iter().enumerate() { + by_hash.entry(commit.hash.as_str()).or_insert(row); + } + let mut parents = vec![Vec::new(); commits.len()]; + let mut children = vec![Vec::new(); commits.len()]; + for (row, commit) in commits.iter().enumerate() { + let mut seen = HashSet::new(); + for hash in &commit.parent_hashes { + if let Some(&parent) = by_hash.get(hash.as_str()) { + if parent > row && seen.insert(parent) { + parents[row].push(parent); + children[parent].push(row); + } + } + } + } + Self { + by_hash, + parents, + children, + } } } -fn route_id(commit_hash: &str, parent_index: usize, parent_hash: &str) -> String { - format!("{commit_hash}:{parent_index}:{parent_hash}") +/// Layout indices and color IDs, independent of compact screen columns. +struct Permanent { + indices: Vec<i64>, + colors: Vec<i32>, } -fn labels(decorations: &str) -> Vec<GraphLabel> { - decorations - .split(',') - .filter_map(|value| { - let value = value.trim(); - (!value.is_empty()).then_some(value) - }) - .flat_map(|value| { - if value == "HEAD" { - return vec![label("HEAD", GraphLabelKind::Head)]; +fn permanent_layout(labels: &[Vec<GraphLabel>], topology: &Topology) -> Permanent { + let count = topology.parents.len(); + let mut indices = vec![0i64; count]; + let mut colors = vec![0i32; count]; + let mut next_parent = vec![0usize; count]; + let mut layout_index = 1i64; + for head in sorted_heads(labels, &topology.children) { + if indices[head] != 0 { + continue; + } + let mut stack = vec![head]; + let head_index = layout_index; + let head_color = color_id(&labels[head]); + while let Some(&node) = stack.last() { + let first_visit = indices[node] == 0; + if first_visit { + indices[node] = layout_index; + // GraphColorGetterByHead + GraphColorManagerImpl: the head + // fragment uses its reference name; side fragments use their index. + colors[node] = if layout_index == head_index { + head_color + } else { + layout_index as i32 + }; } - if let Some(branch) = value.strip_prefix("HEAD -> ") { - return vec![ - label("HEAD", GraphLabelKind::Head), - label(branch, GraphLabelKind::Branch), - ]; + let parents = &topology.parents[node]; + while next_parent[node] < parents.len() && indices[parents[next_parent[node]]] != 0 { + next_parent[node] += 1; + } + if next_parent[node] < parents.len() { + stack.push(parents[next_parent[node]]); + } else { + if first_visit { + layout_index += 1; + } + stack.pop(); } - if let Some(tag) = value.strip_prefix("tag: ") { - return vec![label(tag, GraphLabelKind::Tag)]; + } + } + Permanent { indices, colors } +} + +// MARK: - visible edges + +#[derive(Debug)] +struct Edge { + up: usize, + down: Option<usize>, + parent_hash: String, + dotted: bool, +} + +impl Edge { + fn id(&self) -> String { + let target = self + .down + .map_or_else(|| self.parent_hash.clone(), |down| down.to_string()); + format!("{}:{target}:{}", self.up, self.dotted) + } +} + +/// Collects the visible edges in visible-row coordinates. +struct EdgeBuilder<'a> { + commits: &'a [CommitInput], + visible_rows: &'a [Option<usize>], + edges: Vec<Edge>, + pairs: HashSet<(usize, usize)>, +} + +impl EdgeBuilder<'_> { + fn add(&mut self, up: usize, down: usize, dotted: bool) { + let (Some(u), Some(d)) = (self.visible_rows[up], self.visible_rows[down]) else { + return; + }; + if u < d && self.pairs.insert((u, d)) { + self.edges.push(Edge { + up: u, + down: Some(d), + parent_hash: self.commits[down].hash.clone(), + dotted, + }); + } + } +} + +/// IntelliJ `DottedFilterEdgesGenerator`'s two directional number walks. +/// Nearest-visible propagation avoids an exponential ancestor path search. +fn dotted_edges(topology: &Topology, visible: &[bool], builder: &mut EdgeBuilder) { + let count = topology.parents.len(); + let mut numbers = vec![i64::MIN; count]; + for node in 0..count { + if visible[node] { + let (mut nearest, mut adjacent) = (i64::MIN, i64::MIN); + for &child in &topology.children[node] { + if visible[child] { + adjacent = adjacent.max(numbers[child]); + } else { + nearest = nearest.max(numbers[child]); + } } - if let Some(tag) = value.strip_prefix("refs/tags/") { - return vec![label(tag, GraphLabelKind::Tag)]; + if nearest == adjacent || nearest == i64::MIN { + numbers[node] = adjacent; + } else { + builder.add(nearest as usize, node, true); + numbers[node] = nearest; } - if let Some(remote) = value.strip_prefix("refs/remotes/") { - return vec![label(remote, GraphLabelKind::Remote)]; + } else { + numbers[node] = topology.children[node] + .iter() + .fold(i64::MIN, |best, &child| { + best.max(if visible[child] { + child as i64 + } else { + numbers[child] + }) + }); + } + } + numbers = vec![i64::MAX; count]; + for node in (0..count).rev() { + if visible[node] { + let (mut nearest, mut adjacent) = (i64::MAX, i64::MAX); + for &parent in &topology.parents[node] { + if visible[parent] { + adjacent = adjacent.min(numbers[parent]); + } else { + nearest = nearest.min(numbers[parent]); + } } - if value.starts_with("origin/") { - return vec![label(value, GraphLabelKind::Remote)]; + if nearest == adjacent || nearest == i64::MAX { + numbers[node] = adjacent; + } else { + builder.add(node, nearest as usize, true); + numbers[node] = nearest; } - vec![label(value, GraphLabelKind::Branch)] - }) - .collect() + } else { + numbers[node] = topology.parents[node] + .iter() + .fold(i64::MAX, |best, &parent| { + best.min(if visible[parent] { + parent as i64 + } else { + numbers[parent] + }) + }); + } + } } -fn label(title: &str, kind: GraphLabelKind) -> GraphLabel { - GraphLabel { - id: format!("{:?}:{title}", kind).to_lowercase(), - title: title.to_string(), - kind, +/// Boundary DAG node for unloaded ancestors behind hidden commits: the local +/// unloaded hashes and the links to older groups. +#[derive(Hash, PartialEq, Eq)] +struct MissingGroup { + hashes: Vec<String>, + parents: Vec<usize>, +} + +/// Projects unloaded ancestors through hidden commits without storing a full +/// reachable-hash set at every hidden node. Returns `(visible row, hash)` pairs. +fn missing_parents( + commits: &[CommitInput], + topology: &Topology, + visible: &[usize], + visible_flags: &[bool], +) -> Vec<(usize, String)> { + let mut found = Vec::new(); + if visible.is_empty() { + return found; } + let mut group_for_row: Vec<Option<usize>> = vec![None; commits.len()]; + let mut groups: Vec<MissingGroup> = Vec::new(); + let mut group_ids: HashMap<(Vec<String>, Vec<usize>), usize> = HashMap::new(); + for row in (0..commits.len()).rev() { + // A visible ancestor owns its own continuation. Duplicate page entries + // and unrelated hidden roots cannot introduce fake edges. + if visible_flags[row] || topology.by_hash.get(commits[row].hash.as_str()) != Some(&row) { + continue; + } + let mut hashes = commits[row] + .parent_hashes + .iter() + .filter(|hash| !topology.by_hash.contains_key(hash.as_str())) + .cloned() + .collect::<Vec<_>>(); + hashes.sort(); + hashes.dedup(); + let mut inherited = topology.parents[row] + .iter() + .filter_map(|&parent| group_for_row[parent]) + .collect::<Vec<_>>(); + inherited.sort_unstable(); + inherited.dedup(); + if hashes.is_empty() && inherited.len() <= 1 { + group_for_row[row] = inherited.first().copied(); + } else { + let key = (hashes, inherited); + let id = *group_ids.entry(key.clone()).or_insert_with(|| { + groups.push(MissingGroup { + hashes: key.0, + parents: key.1, + }); + groups.len() - 1 + }); + group_for_row[row] = Some(id); + } + } + if groups.is_empty() { + return found; + } + // A traversal stamp avoids clearing a visited array for each visible commit. + let mut visited = vec![usize::MAX; groups.len()]; + for &row in visible { + let mut pending = topology.parents[row] + .iter() + .filter_map(|&parent| group_for_row[parent]) + .collect::<Vec<_>>(); + let mut missing = HashSet::new(); + while let Some(id) = pending.pop() { + if visited[id] == row { + continue; + } + visited[id] = row; + missing.extend(groups[id].hashes.iter().map(String::as_str)); + pending.extend(groups[id].parents.iter().copied()); + } + let direct = commits[row] + .parent_hashes + .iter() + .map(String::as_str) + .collect::<HashSet<_>>(); + let mut sorted = missing.into_iter().collect::<Vec<_>>(); + sorted.sort_unstable(); + for hash in sorted { + if !direct.contains(hash) { + found.push((row, hash.to_string())); + } + } + } + found } -#[cfg(test)] -mod tests { - use super::*; - - fn commit(hash: &str, parents: &[&str], decorations: &str) -> GitCommitResponse { - GitCommitResponse { - hash: hash.to_string(), - short_hash: hash.to_string(), - parent_hashes: parents.iter().map(|parent| (*parent).to_string()).collect(), - author_name: "Lithe Test".to_string(), - author_email: "test@example.com".to_string(), - date: "2026-09-04".to_string(), - date_utc_offset_minutes: None, - date_unix_seconds: None, - subject: hash.to_string(), - decorations: decorations.to_string(), - } - } - - #[test] - fn projects_a_linear_history_in_one_continuous_lane() { - let projection = project_graph(&[ - commit("C", &["B"], "HEAD -> main"), - commit("B", &["A"], ""), - commit("A", &[], ""), - ]); - - assert_eq!(projection.version, 1); - assert_eq!(projection.lane_count, 1); - assert_eq!( - projection - .rows +// MARK: - layout + +#[derive(Clone, Copy)] +enum Element { + Node, + Edge(usize), +} + +/// Everything the element comparator and edge colors need. +struct Layout<'a> { + commits: &'a [CommitInput], + visible: &'a [usize], + indices: &'a [i64], + colors: &'a [i32], + edges: &'a [Edge], +} + +impl Layout<'_> { + fn layout_index(&self, visible_row: usize) -> i64 { + self.indices[self.visible[visible_row]] + } + + fn edge_color(&self, edge: &Edge) -> i32 { + let up = self.visible[edge.up]; + let Some(down) = edge.down.map(|down| self.visible[down]) else { + return self.colors[up]; + }; + self.colors[if self.indices[up] > self.indices[down] { + up + } else { + down + }] + } + + fn compare_edge_node(&self, edge: &Edge, node: usize) -> i64 { + let node_index = self.layout_index(node); + let Some(down) = edge.down else { + return self.layout_index(edge.up) - node_index; + }; + let edge_index = self.layout_index(edge.up).max(self.layout_index(down)); + if edge_index != node_index { + edge_index - node_index + } else { + edge.up as i64 - node as i64 + } + } + + /// Direct translation of `GraphElementComparatorByLayoutIndex`. These rules + /// also order crossing edges without keeping unrelated empty lane slots. + fn compare(&self, row: usize, left: Element, right: Element) -> i64 { + match (left, right) { + (Element::Node, Element::Node) => 0, + (Element::Edge(e), Element::Node) => self.compare_edge_node(&self.edges[e], row), + (Element::Node, Element::Edge(e)) => -self.compare_edge_node(&self.edges[e], row), + (Element::Edge(a), Element::Edge(b)) => { + let (first, second) = (&self.edges[a], &self.edges[b]); + let Some(first_down) = first.down else { + return -self.compare_edge_node(second, first.up); + }; + let Some(second_down) = second.down else { + return self.compare_edge_node(first, second.up); + }; + if first.up == second.up { + if first_down < second_down { + -self.compare_edge_node(second, first_down) + } else { + self.compare_edge_node(first, second_down) + } + } else if first.up < second.up { + self.compare_edge_node(first, second.up) + } else { + -self.compare_edge_node(second, first.up) + } + } + } + } +} + +fn element_key(element: Element) -> i64 { + match element { + Element::Node => -1, + Element::Edge(id) => id as i64, + } +} + +fn recommended_width(visible_count: usize, edges: &[Edge], options: DisplayOptions) -> usize { + let count = RECOMMENDED_WIDTH_SAMPLE_SIZE.min(visible_count); + if count <= 1 { + return count; + } + let mut changes = vec![0i64; visible_count + 1]; + let mut missing = vec![0i64; visible_count]; + let mut add = |lower: usize, upper: usize| { + changes[lower] += 1; + changes[upper] -= 1; + }; + for edge in edges { + let Some(down) = edge.down else { + missing[edge.up] += 1; + continue; + }; + if down - edge.up < options.long_edge_size { + add(edge.up, down); + } else { + add(edge.up, edge.up + options.visible_part_size + 1); + add(down - options.visible_part_size, down); + } + } + let (mut current, mut previous) = (0i64, 0i64); + let (mut sum, mut squares) = (0.0f64, 0.0f64); + for row in 0..count { + current += changes[row]; + let width = previous.max(current + missing[row]) as f64; + let weight = 2.0 / (count as f64 * (RECOMMENDED_WIDTH_WEIGHT_RATIO + 1.0)) + * (1.0 + (RECOMMENDED_WIDTH_WEIGHT_RATIO - 1.0) * row as f64 / (count - 1) as f64); + sum += width * weight; + squares += width * width * weight; + previous = current; + } + (sum + (squares - sum * sum).max(0.0).sqrt()).round() as usize +} + +fn empty_projection() -> GraphProjection { + GraphProjection { + version: GRAPH_PROJECTION_VERSION, + rows: Vec::new(), + lane_count: 0, + recommended_lane_count: 0, + has_missing_parents: false, + current_branch_hashes: Vec::new(), + } +} + +fn project(request: &Request, options: DisplayOptions) -> GraphProjection { + let remote_names = request + .remote_names + .iter() + .map(String::as_str) + .collect::<HashSet<_>>(); + let label_rows = |commits: &[CommitInput]| { + commits + .iter() + .map(|commit| parse_labels(&commit.decorations, &remote_names)) + .collect::<Vec<_>>() + }; + + // IDEA builds the permanent graph before applying the branch scope. + // Otherwise an older release ref can steal the main branch's layout when + // main's tip is outside the selected branch's first history page. Use only + // a complete, unique context; bounded-history misses fall back to the + // scoped graph instead of dropping commits or mixing indices. + let context = &request.repository_commits; + let context_hashes = context + .iter() + .map(|commit| commit.hash.as_str()) + .collect::<HashSet<_>>(); + let uses_context = !context.is_empty() + && context_hashes.len() == context.len() + && request + .commits + .iter() + .all(|commit| context_hashes.contains(commit.hash.as_str())); + let ordered_storage; + let (commits, permanent_context) = if uses_context { + let scoped = request + .commits + .iter() + .rev() + .map(|commit| (commit.hash.as_str(), commit)) + .collect::<HashMap<_, _>>(); + ordered_storage = context + .iter() + .filter_map(|commit| scoped.get(commit.hash.as_str()).copied()) + .cloned() + .collect::<Vec<_>>(); + let topology = Topology::new(context); + let permanent = permanent_layout(&label_rows(context), &topology); + let rows = context + .iter() + .enumerate() + .map(|(row, commit)| (commit.hash.as_str(), row)) + .collect::<HashMap<_, _>>(); + (&ordered_storage[..], Some((permanent, rows))) + } else { + (&request.commits[..], None) + }; + + let mut projection = project_commits( + request, + commits, + &label_rows(commits), + permanent_context, + options, + ); + if let Some(branch) = &request.current_branch { + projection.current_branch_hashes = current_branch_hashes(request, branch); + } + projection +} + +fn project_commits( + request: &Request, + commits: &[CommitInput], + labels: &[Vec<GraphLabel>], + context: Option<(Permanent, HashMap<&str, usize>)>, + options: DisplayOptions, +) -> GraphProjection { + let topology = Topology::new(commits); + let (indices, colors) = match context { + Some((permanent, rows)) => ( + commits .iter() - .map(|row| row.node_lane) + .map(|commit| permanent.indices[rows[commit.hash.as_str()]]) .collect::<Vec<_>>(), - [0, 0, 0] - ); - assert_eq!(projection.rows[0].routes[0].target_lane, Some(0)); - assert_eq!(projection.rows[0].labels[1].kind, GraphLabelKind::Branch); - } - - #[test] - fn routes_merge_parents_without_renumbering_live_lanes() { - let projection = project_graph(&[ - commit("M", &["D", "C"], ""), - commit("D", &["B"], ""), - commit("C", &["B"], ""), - commit("B", &[], ""), - ]); - - assert_eq!(projection.lane_count, 2); - assert_eq!( - projection.rows[0] - .routes + commits .iter() - .map(|route| route.target_lane) + .map(|commit| permanent.colors[rows[commit.hash.as_str()]]) .collect::<Vec<_>>(), - [Some(0), Some(1)] - ); - assert_eq!(projection.rows[1].node_lane, 0); - assert_eq!(projection.rows[2].node_lane, 1); - assert_eq!(projection.rows[2].routes[0].target_lane, Some(0)); - assert_eq!( - projection.rows[2].routes[0].kind, - GraphRouteKind::FirstParent - ); + ), + None => { + let permanent = permanent_layout(labels, &topology); + (permanent.indices, permanent.colors) + } + }; + let filter = request + .visible_hashes + .as_ref() + .map(|hashes| hashes.iter().map(String::as_str).collect::<HashSet<_>>()); + let visible = (0..commits.len()) + .filter(|&row| { + topology.by_hash.get(commits[row].hash.as_str()) == Some(&row) + && filter + .as_ref() + .is_none_or(|hashes| hashes.contains(commits[row].hash.as_str())) + }) + .collect::<Vec<_>>(); + if visible.is_empty() { + return empty_projection(); } + let mut visible_rows = vec![None; commits.len()]; + let mut visible_flags = vec![false; commits.len()]; + for (index, &row) in visible.iter().enumerate() { + visible_rows[row] = Some(index); + visible_flags[row] = true; + } + + let mut builder = EdgeBuilder { + commits, + visible_rows: &visible_rows, + edges: Vec::new(), + pairs: HashSet::new(), + }; + for &row in &visible { + for &parent in &topology.parents[row] { + if visible_rows[parent].is_some() { + builder.add(row, parent, false); + } + } + let mut seen = HashSet::new(); + for hash in &commits[row].parent_hashes { + if !topology.by_hash.contains_key(hash.as_str()) && seen.insert(hash.as_str()) { + builder.edges.push(Edge { + up: visible_rows[row].expect("visible rows are indexed"), + down: None, + parent_hash: hash.clone(), + dotted: false, + }); + } + } + } + if filter.is_some() { + dotted_edges(&topology, &visible_flags, &mut builder); + for (row, hash) in missing_parents(commits, &topology, &visible, &visible_flags) { + builder.edges.push(Edge { + up: visible_rows[row].expect("visible rows are indexed"), + down: None, + parent_hash: hash, + dotted: true, + }); + } + } + let mut edges = builder.edges; + edges.sort_by(|left, right| { + left.up + .cmp(&right.up) + .then_with(|| { + left.down + .unwrap_or(usize::MAX) + .cmp(&right.down.unwrap_or(usize::MAX)) + }) + .then_with(|| left.parent_hash.cmp(&right.parent_hash)) + }); - #[test] - fn marks_truncated_parents_as_terminal_routes() { - let projection = project_graph(&[commit("HEAD", &["OLDER"], "")]); + let layout = Layout { + commits, + visible: &visible, + indices: &indices, + colors: &colors, + edges: &edges, + }; + build_rows(&layout, labels, options) +} - assert!(projection.has_missing_parents); - assert_eq!(projection.rows[0].routes[0].target_lane, None); - assert_eq!( - projection.rows[0].routes[0].kind, - GraphRouteKind::MissingParent - ); +fn build_rows( + layout: &Layout, + labels: &[Vec<GraphLabel>], + options: DisplayOptions, +) -> GraphProjection { + let edges = layout.edges; + let row_count = layout.visible.len(); + let edge_ids = edges.iter().map(Edge::id).collect::<Vec<_>>(); + let mut elements = vec![vec![Element::Node]; row_count]; + let mut adjacent = vec![Vec::<usize>::new(); row_count]; + for (id, edge) in edges.iter().enumerate() { + adjacent[edge.up].push(id); + if let Some(down) = edge.down { + adjacent[down].push(id); + if down <= edge.up + 1 { + continue; + } + let crossed = if down - edge.up < options.long_edge_size { + [(edge.up + 1)..down, 0..0] + } else { + [ + (edge.up + 1)..(edge.up + options.visible_part_size + 1), + (down - options.visible_part_size)..down, + ] + }; + for range in crossed { + for crossing in &mut elements[range] { + crossing.push(Element::Edge(id)); + } + } + } else if edge.up + 1 < row_count { + elements[edge.up + 1].push(Element::Edge(id)); + } } - #[test] - fn projection_is_deterministic_for_identical_input() { - let commits = vec![ - commit("M", &["D", "C"], "HEAD -> main, origin/main, tag: v1"), - commit("D", &["B"], ""), - commit("C", &["B"], ""), - commit("B", &[], ""), - ]; + let mut positions = vec![HashMap::<usize, usize>::new(); row_count]; + let mut node_positions = vec![0usize; row_count]; + for row in 0..row_count { + stable_sort(&mut elements[row], |left, right| { + let order = layout.compare(row, left, right); + if order == 0 { + element_key(left) < element_key(right) + } else { + order < 0 + } + }); + for (position, element) in elements[row].iter().enumerate() { + match element { + Element::Node => { + node_positions[row] = position; + for &edge in &adjacent[row] { + positions[row].insert(edge, position); + } + } + Element::Edge(edge) => { + positions[row].insert(*edge, position); + } + } + } + } - assert_eq!(project_graph(&commits), project_graph(&commits)); + let mut rows = Vec::with_capacity(row_count); + for row in 0..row_count { + let mut prints = Vec::new(); + for (position, element) in elements[row].iter().enumerate() { + let own = [match element { + Element::Edge(id) => *id, + Element::Node => usize::MAX, + }]; + let ids: &[usize] = match element { + Element::Edge(_) => &own, + Element::Node => &adjacent[row], + }; + for &id in ids { + let edge = &edges[id]; + for direction in [PrintDirection::Up, PrintDirection::Down] { + let next = match direction { + PrintDirection::Up => row.checked_sub(1), + PrintDirection::Down => Some(row + 1), + }; + let next_position = next + .and_then(|next| positions.get(next)) + .and_then(|map| map.get(&id).copied()); + let has_arrow = match edge.down { + Some(down) => { + let span = down - edge.up; + let offset = if direction == PrintDirection::Down { + row.wrapping_sub(edge.up) + } else { + down.wrapping_sub(row) + }; + (span >= options.long_edge_size && offset == options.visible_part_size) + || (span >= options.edge_with_arrow_size && offset == 1) + } + // IDEA places unloaded-parent arrows on the next row, + // never stacked on the last visible node. + None => direction == PrintDirection::Down && row == edge.up + 1, + }; + if next_position.is_none() && !has_arrow { + continue; + } + prints.push(GraphPrintElement { + id: format!( + "{}:{}", + edge_ids[id], + if direction == PrintDirection::Down { + "down" + } else { + "up" + } + ), + position, + adjacent_position: next_position.unwrap_or(position), + direction, + color_id: layout.edge_color(edge), + is_dotted: edge.dotted, + is_missing: edge.down.is_none(), + has_arrow, + is_terminal: next_position.is_none(), + target_hash: edge.down.map(|down| { + let target = if direction == PrintDirection::Down { + down + } else { + edge.up + }; + layout.commits[layout.visible[target]].hash.clone() + }), + }); + } + } + } + let node = layout.visible[row]; + rows.push(GraphRow { + commit_hash: layout.commits[node].hash.clone(), + lane: node_positions[row], + lane_count: elements[row].len(), + color_id: layout.colors[node], + layout_index: layout.indices[node], + incoming_lane_colors: elements[row] + .iter() + .map(|element| match element { + Element::Edge(id) => layout.edge_color(&edges[*id]), + Element::Node => layout.colors[node], + }) + .collect(), + parent_edges: adjacent[row] + .iter() + .filter(|&&id| edges[id].up == row) + .map(|&id| { + let edge = &edges[id]; + GraphParentEdge { + id: edge_ids[id].clone(), + parent_hash: edge.parent_hash.clone(), + target_lane: positions.get(row + 1).and_then(|map| map.get(&id).copied()), + color_id: layout.edge_color(edge), + is_missing: edge.down.is_none(), + is_dotted: edge.dotted, + } + }) + .collect(), + labels: labels[node].clone(), + print_elements: prints, + }); + } + GraphProjection { + version: GRAPH_PROJECTION_VERSION, + lane_count: elements.iter().map(Vec::len).max().unwrap_or(0), + recommended_lane_count: recommended_width(row_count, edges, options), + has_missing_parents: edges.iter().any(|edge| edge.down.is_none()), + rows, + current_branch_hashes: Vec::new(), } +} - #[test] - fn serializes_the_versioned_renderer_neutral_contract() { - let projection = project_graph(&[commit("C", &["P"], "HEAD -> main")]); - let value = serde_json::to_value(projection).expect("projection should serialize"); +// MARK: - current branch - assert_eq!(value["version"], 1); - assert_eq!(value["rows"][0]["nodeLane"], 0); - assert_eq!(value["rows"][0]["routes"][0]["sourceLane"], 0); - assert!(value["rows"][0]["routes"][0].get("targetLane").is_none()); - assert_eq!(value["rows"][0]["routes"][0]["kind"], "missingParent"); +/// IntelliJ's `CurrentBranchHighlighter` colors ancestry, including every merge +/// parent. Only the loaded graph can prove membership; a missing parent ends the walk. +fn current_branch_hashes(request: &Request, branch: &str) -> Vec<String> { + let all = request + .commits + .iter() + .chain(request.repository_commits.iter()) + .collect::<Vec<_>>(); + let no_remotes = HashSet::new(); + let Some(head) = all.iter().find(|commit| { + parse_labels(&commit.decorations, &no_remotes) + .iter() + .any(|l| l.kind == GraphLabelKind::Branch && l.title == branch) + }) else { + return Vec::new(); + }; + let mut by_hash: HashMap<&str, &CommitInput> = HashMap::with_capacity(all.len()); + for commit in &all { + by_hash.entry(commit.hash.as_str()).or_insert(commit); + } + let mut pending = vec![head.hash.as_str()]; + let mut reached = HashSet::new(); + while let Some(hash) = pending.pop() { + if !reached.insert(hash) { + continue; + } + if let Some(commit) = by_hash.get(hash) { + pending.extend(commit.parent_hashes.iter().map(String::as_str)); + } } + let mut hashes = reached.into_iter().map(str::to_string).collect::<Vec<_>>(); + hashes.sort(); + hashes } + +#[cfg(test)] +#[path = "graph_tests.rs"] +mod tests; diff --git a/rust/lithe-core/src/git/graph_tests.rs b/rust/lithe-core/src/git/graph_tests.rs new file mode 100644 index 0000000000..1cf2bafb7e --- /dev/null +++ b/rust/lithe-core/src/git/graph_tests.rs @@ -0,0 +1,971 @@ +//! Regressions for `git.graphProjection`: the shared fixture, pinned IntelliJ oracles, +//! and deterministic scale checks. + +use super::*; +use serde_json::{json, Value}; +use std::collections::BTreeSet; +use std::fs; +use std::path::PathBuf; + +const COMPACT: DisplayOptions = DisplayOptions { + long_edge_size: 30, + visible_part_size: 1, + edge_with_arrow_size: usize::MAX, +}; +const EXPANDED: DisplayOptions = DisplayOptions { + long_edge_size: 1_000, + visible_part_size: 250, + edge_with_arrow_size: 30, +}; + +fn commit(hash: &str, parents: &[&str], decorations: &str) -> CommitInput { + CommitInput { + hash: hash.to_string(), + parent_hashes: parents.iter().map(|parent| (*parent).to_string()).collect(), + decorations: decorations.to_string(), + } +} + +fn new_request(commits: Vec<CommitInput>) -> Request { + Request { + commits, + remote_names: Vec::new(), + repository_commits: Vec::new(), + visible_hashes: None, + display_mode: DisplayMode::Compact, + current_branch: None, + } +} + +fn layout(commits: Vec<CommitInput>) -> GraphProjection { + project(&new_request(commits), COMPACT) +} + +fn filtered(commits: Vec<CommitInput>, visible: &[&str]) -> GraphProjection { + let mut request = new_request(commits); + request.visible_hashes = Some(visible.iter().map(|hash| (*hash).to_string()).collect()); + project(&request, COMPACT) +} + +fn call(payload: Value) -> Value { + serde_json::from_str(&crate::execute_json( + &json!({"id":"graph", "command":"git.graphProjection", "payload":payload}).to_string(), + )) + .unwrap() +} + +fn root_path(relative: &str) -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("../..") + .join(relative) +} + +fn read_fixture(relative: &str) -> String { + fs::read_to_string(root_path(relative)).unwrap_or_else(|error| panic!("{relative}: {error}")) +} + +fn shared_fixture() -> Value { + serde_json::from_str(include_str!( + "../../../../shared/fixtures/git/graph-projection-v1.json" + )) + .unwrap() +} + +/// Every non-terminal half-edge must meet the matching half in the neighbouring row +/// with its identity, positions, color, and style intact. +fn assert_continuity(projection: &GraphProjection) { + for (row, value) in projection.rows.iter().enumerate() { + for element in value.print_elements.iter().filter(|e| !e.is_terminal) { + let next = if element.direction == PrintDirection::Down { + row + 1 + } else { + row.wrapping_sub(1) + }; + let other = projection + .rows + .get(next) + .unwrap_or_else(|| panic!("row {row}: continuing edge needs row {next}")); + let edge = element.id.rsplit_once(':').unwrap().0; + assert!( + other.print_elements.iter().any(|candidate| { + candidate.id.rsplit_once(':').unwrap().0 == edge + && candidate.direction != element.direction + && !candidate.is_terminal + && candidate.position == element.adjacent_position + && candidate.adjacent_position == element.position + && candidate.color_id == element.color_id + && candidate.is_dotted == element.is_dotted + }), + "row {row}: {} has no matching half in row {next}", + element.id + ); + } + } +} + +fn hashes(projection: &GraphProjection) -> Vec<&str> { + projection + .rows + .iter() + .map(|row| row.commit_hash.as_str()) + .collect() +} + +fn parent_hashes(row: &GraphRow) -> Vec<&str> { + row.parent_edges + .iter() + .map(|edge| edge.parent_hash.as_str()) + .collect() +} + +// MARK: - shared fixture + +#[test] +fn shared_fixture_projects_the_exact_response() { + let fixture = shared_fixture(); + let cases = fixture["cases"].as_array().unwrap(); + assert!(cases.len() >= 20, "the fixture must keep its scenarios"); + for case in cases { + let response = call(case["request"].clone()); + assert_eq!(response["ok"], true, "{}: {response}", case["name"]); + assert_eq!(response["data"], case["response"], "{}", case["name"]); + } +} + +#[test] +fn shared_fixture_keeps_a_named_branch_color_across_pages() { + let fixture = shared_fixture(); + let cases = fixture["cases"].as_array().unwrap(); + for sequence in fixture["stability"].as_array().unwrap() { + let expected = &sequence["expectedColorId"]; + assert!(!expected.is_null()); + for step in sequence["steps"].as_array().unwrap() { + let case = cases + .iter() + .find(|case| case["name"] == step["case"]) + .unwrap(); + let response = call(case["request"].clone()); + let row = response["data"]["rows"] + .as_array() + .unwrap() + .iter() + .find(|row| row["commitHash"] == step["hash"]) + .unwrap(); + assert_eq!( + &row["colorId"], expected, + "{} / {}", + sequence["name"], step["case"] + ); + } + } +} + +#[test] +fn shared_fixture_rejects_invalid_requests() { + for case in shared_fixture()["invalid"].as_array().unwrap() { + let response = call(case["request"].clone()); + assert_eq!(response["ok"], false, "{}", case["name"]); + assert_eq!( + response["error"]["code"], "invalid_request", + "{}", + case["name"] + ); + } + let too_many = (0..=MAX_COMMITS) + .map(|row| json!({"hash": row.to_string()})) + .collect::<Vec<_>>(); + assert_eq!(call(json!({"commits": too_many}))["ok"], false); +} + +// MARK: - IntelliJ oracles + +fn split_graph_line(line: &str) -> (String, Vec<String>) { + let (hash, parents) = line.split_once("|-").unwrap(); + ( + hash.to_string(), + parents.split_whitespace().map(str::to_string).collect(), + ) +} + +#[test] +fn permanent_layout_matches_pinned_intellij_indices() { + for name in [ + "manyNodes", + "oneNode", + "notFullGraph", + "oneNodeNotFullGraph", + ] { + let read = |suffix: &str| { + read_fixture(&format!( + "shared/fixtures/git/graph-idea/layoutBuilder/{name}_{suffix}.txt" + )) + }; + let commits = read("in") + .lines() + .filter(|line| !line.is_empty()) + .map(|line| { + let (hash, parents) = split_graph_line(line); + CommitInput { + hash, + parent_hashes: parents, + decorations: String::new(), + } + }) + .collect::<Vec<_>>(); + let expected = read("out") + .lines() + .filter(|line| !line.is_empty()) + .map(|line| line.split("|-").next().unwrap().parse::<i64>().unwrap()) + .collect::<Vec<_>>(); + let actual = layout(commits) + .rows + .iter() + .map(|row| row.layout_index) + .collect::<Vec<_>>(); + assert_eq!(actual, expected, "{name}"); + } +} + +#[test] +fn compact_positions_and_half_edges_match_pinned_intellij_printing() { + for name in [ + "oneNode", + "manyNodes", + "longEdges", + "oneUpOneDown1", + "oneUpOneDown2", + ] { + let read = |suffix: &str| { + read_fixture(&format!( + "shared/fixtures/git/graph-idea/elementGenerator/{name}_{suffix}.txt" + )) + }; + let mut commits = Vec::new(); + let mut visible = Vec::new(); + for line in read("in").lines().filter(|line| !line.is_empty()) { + let (head, rest) = line.split_once("|-").unwrap(); + let id = head.split('_').next().unwrap().to_string(); + visible.push(id.clone()); + let mut hidden = Vec::new(); + let parents = rest + .split_whitespace() + .map(|token| { + let mut fields = token.split('_'); + let target = fields.next().unwrap().to_string(); + // Git commits only carry direct edges. A hidden intermediate + // commit recreates the upstream fixture's DOTTED edge naturally. + if fields.next() == Some("D") { + let hash = format!("hidden-{id}-{target}"); + hidden.push(commit(&hash, &[target.as_str()], "")); + hash + } else { + target + } + }) + .collect::<Vec<_>>(); + commits.push(CommitInput { + hash: id, + parent_hashes: parents, + decorations: String::new(), + }); + commits.extend(hidden); + } + let options = DisplayOptions { + long_edge_size: if name == "oneUpOneDown2" { 10 } else { 7 }, + visible_part_size: if name.starts_with("oneUpOneDown") { + 1 + } else { + 2 + }, + edge_with_arrow_size: 10, + }; + let mut request = new_request(commits); + request.visible_hashes = Some(visible); + let projection = project(&request, options); + // The color callback in JetBrains's fixture uses row numbers. Compare its + // verbatim geometry, style, and arrow oracle, excluding color. + let mut expected = read("out") + .lines() + .filter(|line| !line.trim().is_empty()) + .map(|line| { + let mut parts = line.trim().split("|-"); + format!("{}|{}", parts.next().unwrap(), parts.next().unwrap()) + }) + .collect::<Vec<_>>(); + let mut actual = Vec::new(); + for (row, value) in projection.rows.iter().enumerate() { + actual.push(format!("Node|{row}:{}", value.lane)); + for element in &value.print_elements { + let direction = if element.direction == PrintDirection::Down { + "DOWN" + } else { + "UP" + }; + actual.push(format!( + "Edge:{direction}{}:{}|{row}:{}:{}", + if element.has_arrow { "_ARROW" } else { "" }, + if element.is_dotted { "DASHED" } else { "SOLID" }, + element.position, + element.adjacent_position + )); + } + } + expected.sort(); + actual.sort(); + assert_eq!(actual, expected, "{name}"); + assert_continuity(&projection); + } +} + +fn read_tsv(name: &str) -> Vec<CommitInput> { + read_fixture(&format!( + "macos/Tests/LitheTests/Fixtures/GitGraph/{name}.tsv" + )) + .lines() + .filter(|line| !line.is_empty()) + .map(|line| { + let columns = line.split('\t').collect::<Vec<_>>(); + assert_eq!(columns.len(), 4, "{line}"); + CommitInput { + hash: columns[0].to_string(), + parent_hashes: columns[1].split_whitespace().map(str::to_string).collect(), + decorations: columns[2] + .trim_matches(|c| c == ' ' || c == '(' || c == ')') + .to_string(), + } + }) + .collect() +} + +#[test] +fn real_history_matches_intellij_for_page_context_and_date_order() { + for (history, context, oracle) in [ + ("issue410-history", None, "issue410-idea"), + ( + "issue410-history", + Some("issue410-context"), + "issue410-context-idea", + ), + ( + "issue410-date-history", + Some("issue410-date-context"), + "issue410-date-idea", + ), + ] { + let mut request = new_request(read_tsv(history)); + if let Some(context) = context { + request.repository_commits = read_tsv(context); + } + let projection = project(&request, COMPACT); + let mut actual = vec![format!("Width|{}", projection.recommended_lane_count)]; + for (row, value) in projection.rows.iter().enumerate() { + actual.push(format!( + "Node|{row}:{}:{}:{}", + value.lane, value.layout_index, value.color_id + )); + for element in &value.print_elements { + actual.push(format!( + "Edge|{row}:{}:{}:{}:{}:{}:{}:{}", + element.position, + element.adjacent_position, + if element.direction == PrintDirection::Up { + "UP" + } else { + "DOWN" + }, + element.has_arrow, + element.is_terminal, + if element.is_dotted { "DASHED" } else { "SOLID" }, + element.color_id + )); + } + } + let mut expected = read_fixture(&format!( + "macos/Tests/LitheTests/Fixtures/GitGraph/{oracle}.txt" + )) + .lines() + .filter(|line| !line.is_empty()) + .map(str::to_string) + .collect::<Vec<_>>(); + actual.sort(); + expected.sort(); + let missing = expected + .iter() + .filter(|line| !actual.contains(line)) + .take(5) + .collect::<Vec<_>>(); + assert!( + actual == expected, + "{oracle}: {} lines vs {} expected, first missing {missing:?}", + actual.len(), + expected.len() + ); + } +} + +// MARK: - topology and routing + +#[test] +fn long_edges_compact_at_thirty_rows_and_keep_both_destinations() { + let chain = |span: usize| { + (0..=span) + .map(|row| { + let parents = if row == span { + Vec::new() + } else if row == 0 { + vec!["1".to_string(), span.to_string()] + } else { + vec![(row + 1).to_string()] + }; + CommitInput { + hash: row.to_string(), + parent_hashes: parents, + decorations: String::new(), + } + }) + .collect::<Vec<_>>() + }; + for span in [29usize, 30, 31] { + let projection = layout(chain(span)); + let arrows = projection + .rows + .iter() + .flat_map(|row| &row.print_elements) + .filter(|element| element.has_arrow) + .collect::<Vec<_>>(); + assert_eq!(projection.rows.len(), span + 1); + if span < 30 { + assert!(arrows.is_empty(), "span {span}"); + } else { + assert_eq!(arrows.len(), 2, "span {span}"); + let targets = arrows + .iter() + .filter_map(|element| element.target_hash.clone()) + .collect::<BTreeSet<_>>(); + assert_eq!( + targets, + BTreeSet::from(["0".to_string(), span.to_string()]), + "span {span}" + ); + assert_eq!(projection.rows[span / 2].lane_count, 1, "span {span}"); + } + assert_continuity(&projection); + } + for span in [999usize, 1_000] { + let mut request = new_request(chain(span)); + request.display_mode = DisplayMode::Expanded; + let projection = project(&request, request.display_mode.options()); + assert_eq!( + projection.rows[span / 2].lane_count, + if span < 1_000 { 2 } else { 1 }, + "span {span}" + ); + let arrows = projection + .rows + .iter() + .flat_map(|row| &row.print_elements) + .filter(|element| element.has_arrow) + .count(); + assert_eq!(arrows, if span < 1_000 { 2 } else { 4 }, "span {span}"); + assert_continuity(&projection); + } + let compact = layout(chain(100)); + let mut expanded_request = new_request(chain(100)); + expanded_request.display_mode = DisplayMode::Expanded; + let expanded = project(&expanded_request, EXPANDED); + assert_eq!(compact.recommended_lane_count, 1); + assert_eq!(expanded.recommended_lane_count, 2); +} + +#[test] +fn filtering_bridges_hidden_ancestors_without_inventing_unloaded_parents() { + let commits = vec![ + commit("a", &["b"], ""), + commit("b", &["c"], ""), + commit("c", &["d"], ""), + commit("d", &[], ""), + ]; + let projection = filtered(commits, &["a", "d"]); + assert_eq!(hashes(&projection), ["a", "d"]); + assert_eq!(projection.lane_count, 1); + assert!(!projection.has_missing_parents); + assert!(projection + .rows + .iter() + .flat_map(|row| &row.print_elements) + .all(|element| element.is_dotted)); + assert_eq!(parent_hashes(&projection.rows[0]), ["d"]); + assert_continuity(&projection); +} + +#[test] +fn filtered_unloaded_boundary_resolves_after_paging() { + let page = vec![ + commit("a", &["b"], ""), + commit("b", &["c"], ""), + commit("unrelated", &[], ""), + ]; + let last_row = filtered(page.clone(), &["a"]); + assert!(last_row.has_missing_parents); + assert_eq!(parent_hashes(&last_row.rows[0]), ["c"]); + assert!(last_row.rows[0].parent_edges.iter().all(|e| e.is_missing)); + assert!(last_row.rows[0].print_elements.is_empty()); + + let both = filtered(page.clone(), &["a", "unrelated"]); + assert!(both.has_missing_parents); + let prints = both + .rows + .iter() + .flat_map(|row| &row.print_elements) + .collect::<Vec<_>>(); + assert!(!prints.is_empty()); + assert!(prints + .iter() + .all(|e| e.is_dotted && e.target_hash.is_none())); + assert!(prints.iter().any(|e| e.has_arrow && e.is_terminal)); + assert_continuity(&both); + + let mut loaded = page; + loaded.push(commit("c", &[], "")); + let hidden_root = filtered(loaded.clone(), &["a", "unrelated"]); + assert!(!hidden_root.has_missing_parents); + assert!(hidden_root.rows[0].parent_edges.is_empty()); + let visible_root = filtered(loaded, &["a", "c"]); + assert!(!visible_root.has_missing_parents); + assert_eq!(parent_hashes(&visible_root.rows[0]), ["c"]); + assert!(visible_root + .rows + .iter() + .flat_map(|row| &row.print_elements) + .all(|element| element.is_dotted)); + assert_continuity(&visible_root); +} + +#[test] +fn hidden_merge_paths_deduplicate_and_stop_at_visible_ancestors() { + let projection = filtered( + vec![ + commit("a", &["left", "right", "missing"], ""), + commit("peer", &["left"], ""), + commit("left", &["missing", "missing"], ""), + commit("right", &["missing", "other"], ""), + commit("unrelated", &["unrelated-missing"], ""), + ], + &["a", "peer"], + ); + assert!(projection.has_missing_parents); + assert_eq!(parent_hashes(&projection.rows[0]), ["missing", "other"]); + assert_eq!(parent_hashes(&projection.rows[1]), ["missing"]); + let direct = projection.rows[0] + .parent_edges + .iter() + .find(|edge| edge.parent_hash == "missing") + .unwrap(); + assert!(!direct.is_dotted); + assert!(projection.rows[0] + .print_elements + .iter() + .filter(|element| element.id.starts_with(&direct.id)) + .all(|element| !element.is_dotted)); + + let stopped = filtered( + vec![ + commit("a", &["b"], ""), + commit("b", &["c"], ""), + commit("c", &["missing"], ""), + ], + &["a", "b"], + ); + assert_eq!(parent_hashes(&stopped.rows[0]), ["b"]); + assert!(stopped.rows[0].parent_edges.iter().all(|e| !e.is_missing)); + assert_eq!(parent_hashes(&stopped.rows[1]), ["missing"]); + let unrelated = filtered( + vec![commit("a", &[], ""), commit("hidden", &["missing"], "")], + &["a"], + ); + assert!(!unrelated.has_missing_parents); +} + +#[test] +fn an_ended_branch_gives_its_column_back() { + let projection = layout(vec![ + commit("a", &["b", "c"], ""), + commit("b", &[], ""), + commit("c", &["d"], ""), + commit("d", &[], ""), + ]); + assert_eq!(projection.rows[1].lane_count, 2); + assert_eq!(projection.rows[2].lane_count, 1); + assert_eq!(projection.rows[2].lane, 0); + assert_continuity(&projection); +} + +#[test] +fn pagination_resolves_missing_parents_with_the_same_node_color() { + let head = commit("a", &["b", "b"], ""); + let page = layout(vec![head.clone()]); + assert!(page.has_missing_parents); + assert_eq!(page.rows[0].parent_edges.len(), 1); + assert!(page.rows[0].print_elements.is_empty()); + let full = layout(vec![head, commit("b", &[], "")]); + assert!(!full.has_missing_parents); + assert_eq!(full.rows[0].color_id, page.rows[0].color_id); + assert_continuity(&full); +} + +#[test] +fn empty_inputs_and_filters_produce_no_graph() { + assert!(layout(Vec::new()).rows.is_empty()); + let projection = filtered(vec![commit("a", &["b"], "")], &[]); + assert!(projection.rows.is_empty()); + assert_eq!(projection.lane_count, 0); + assert!(!projection.has_missing_parents); +} + +#[test] +fn reference_priority_seeds_main_before_feature_tips_and_inner_heads() { + let indices = |commits: Vec<CommitInput>| { + layout(commits) + .rows + .iter() + .map(|row| row.layout_index) + .collect::<Vec<_>>() + }; + assert_eq!( + indices(vec![ + commit("feature", &["main"], "HEAD -> feature"), + commit("main", &["root"], "refs/heads/main"), + commit("root", &[], ""), + ]), + [2, 1, 1] + ); + // A tag alone does not make a decorated inner commit a head. + assert_eq!( + indices(vec![ + commit("tip", &["tag"], ""), + commit("tag", &["root"], "tag: v1"), + commit("root", &[], ""), + ]), + [1, 1, 1] + ); + assert_eq!( + indices(vec![ + commit("other", &["root"], "refs/remotes/upstream/work"), + commit("preferred", &["root"], "origin/main"), + commit("root", &[], ""), + ]), + [2, 1, 1] + ); + let mut with_remote = new_request(vec![ + commit("local", &["root"], "main"), + commit("remote", &["root"], "upstream/work"), + commit("root", &[], ""), + ]); + with_remote.remote_names = vec!["upstream/work".to_string()]; + let projection = project(&with_remote, COMPACT); + assert_eq!( + projection + .rows + .iter() + .map(|row| row.layout_index) + .collect::<Vec<_>>(), + [2, 1, 1] + ); + assert_eq!(projection.rows[1].labels[0].kind, GraphLabelKind::Remote); +} + +#[test] +fn natural_reference_names_keep_numeric_zero_and_case_tie_breaks() { + let mut names = vec![ + "feature10", + "feature02", + "feature2", + "Feature2", + "feature1", + "feature002", + "feature2x", + ]; + names.sort_by(|a, b| { + compare_reference_names( + &a.encode_utf16().collect::<Vec<_>>(), + &b.encode_utf16().collect::<Vec<_>>(), + ) + }); + assert_eq!( + names, + [ + "feature1", + "Feature2", + "feature2", + "feature2x", + "feature02", + "feature002", + "feature10" + ] + ); +} + +#[test] +fn color_ids_are_java_string_hash_codes_of_the_principal_reference() { + let id = |decorations: &str| color_id(&parse_labels(decorations, &HashSet::new())); + assert_eq!(id("main"), 3_343_801); + assert_eq!(id("master"), -1_081_267_614); + assert_eq!(id("café"), 3_045_921); + // A wrapped 32-bit product, non-BMP code units, and a name needing sign wrap. + assert_eq!(id("feature/very-long-branch-name-for-overflow"), 71_049_904); + assert_eq!(id("dev/日本語"), 1_583_896_733); + assert_eq!(id("a😀"), 1_866_116); + // The most significant reference names the fragment, whatever the source order. + assert_eq!(id("tag: v1, release, origin/main"), id("origin/main")); + assert_eq!(id("HEAD -> work, tag: v1"), id("work")); + // Unreferenced heads share a deterministic zero. + assert_eq!(id(""), 0); +} + +#[test] +fn branch_scope_keeps_repository_priority_and_base_order() { + let main = commit("main-tip", &["root"], "origin/main"); + let side = commit("side", &["root"], "HEAD -> feature"); + let root = commit("root", &[], ""); + let repository = vec![main.clone(), side.clone(), root.clone()]; + let full = layout(repository.iter().map(CommitInput::clone).collect()); + let mut scoped = new_request(vec![side.clone(), root.clone()]); + scoped.repository_commits = repository.iter().map(CommitInput::clone).collect(); + let scoped_projection = project(&scoped, COMPACT); + assert_eq!( + scoped_projection + .rows + .iter() + .map(|row| row.layout_index) + .collect::<Vec<_>>(), + [2, 1] + ); + assert_eq!( + scoped_projection + .rows + .iter() + .map(|row| row.color_id) + .collect::<Vec<_>>(), + full.rows + .iter() + .skip(1) + .map(|row| row.color_id) + .collect::<Vec<_>>() + ); + let mut reordered = new_request(vec![side, main, root]); + reordered.repository_commits = repository; + let projection = project(&reordered, COMPACT); + assert_eq!(hashes(&projection), ["main-tip", "side", "root"]); + assert_continuity(&projection); +} + +#[test] +fn incomplete_or_duplicate_repository_context_falls_back_without_dropping_commits() { + let values = || vec![commit("tip", &["root"], ""), commit("root", &[], "")]; + let expected = layout(values()); + for context in [ + vec![commit("root", &[], "")], + vec![ + commit("tip", &["root"], ""), + commit("tip", &["root"], ""), + commit("root", &[], ""), + ], + ] { + let mut request = new_request(values()); + request.repository_commits = context; + assert_eq!(project(&request, COMPACT), expected); + } +} + +#[test] +fn recommended_width_follows_weighted_edge_counts() { + let projection = layout(vec![ + commit("a", &["c"], ""), + commit("b", &["c"], ""), + commit("c", &[], ""), + ]); + assert_eq!(projection.recommended_lane_count, 2); + assert_eq!( + layout(vec![commit("only", &[], "")]).recommended_lane_count, + 1 + ); +} + +#[test] +fn current_branch_ancestry_follows_every_merge_parent_and_never_guesses() { + let commits = || { + vec![ + commit("head", &["left", "merged"], "HEAD -> main"), + commit("other", &["base"], "other"), + commit("left", &["base"], ""), + ] + }; + let context = || { + vec![ + commit("merged", &["base"], ""), + commit("base", &["missing"], ""), + ] + }; + let mut request = new_request(commits()); + request.repository_commits = context(); + request.current_branch = Some("main".to_string()); + assert_eq!( + project(&request, COMPACT).current_branch_hashes, + ["base", "head", "left", "merged", "missing"] + ); + request.current_branch = Some("absent".to_string()); + assert!(project(&request, COMPACT).current_branch_hashes.is_empty()); + request.current_branch = None; + assert!(project(&request, COMPACT).current_branch_hashes.is_empty()); + let mut detached = new_request(vec![commit("detached", &[], "HEAD")]); + detached.current_branch = Some("main".to_string()); + assert!(project(&detached, COMPACT).current_branch_hashes.is_empty()); +} + +// MARK: - scale + +#[test] +fn hidden_merge_boundaries_keep_only_the_visible_result() { + // Each merge adds a distinct unloaded parent. Copying every suffix's full + // set once retained ~12.5 million members for a one-row result. + let count = 5_000; + let history = (0..count) + .map(|row| { + let mut parents = vec![format!("missing-{row}")]; + if row + 1 < count { + parents.insert(0, (row + 1).to_string()); + } + CommitInput { + hash: row.to_string(), + parent_hashes: parents, + decorations: String::new(), + } + }) + .collect::<Vec<_>>(); + let mut request = new_request(history); + request.visible_hashes = Some(vec![]); + let empty = project(&request, COMPACT); + assert!(empty.rows.is_empty() && !empty.has_missing_parents); + request.visible_hashes = Some(vec!["0".to_string()]); + let projection = project(&request, COMPACT); + assert_eq!(projection.rows.len(), 1); + let found = parent_hashes(&projection.rows[0]) + .into_iter() + .map(str::to_string) + .collect::<BTreeSet<_>>(); + assert_eq!( + found, + (0..count).map(|row| format!("missing-{row}")).collect() + ); + assert!(projection.rows[0].parent_edges.iter().all(|e| e.is_missing)); + assert!(projection.has_missing_parents); +} + +#[test] +fn many_visible_children_share_one_hidden_chain_boundary() { + let count = 2_500; + let mut commits = (0..count) + .map(|row| commit(&format!("head-{row}"), &["hidden-0"], "")) + .collect::<Vec<_>>(); + for row in 0..count { + let parent = if row + 1 < count { + format!("hidden-{}", row + 1) + } else { + "missing".to_string() + }; + commits.push(commit(&format!("hidden-{row}"), &[parent.as_str()], "")); + } + let visible = (0..count) + .map(|row| format!("head-{row}")) + .collect::<Vec<_>>(); + let mut request = new_request(commits); + request.visible_hashes = Some(visible); + let projection = project(&request, COMPACT); + assert_eq!(projection.rows.len(), count); + assert!(projection.has_missing_parents); + assert!(projection + .rows + .iter() + .all(|row| parent_hashes(row) == ["missing"])); + assert_continuity(&projection); +} + +/// A deterministic 5,000-commit history with merges, side branches, and named heads. +fn generated_history(count: usize) -> Vec<CommitInput> { + let mut state = 0x2545_f491_4f6c_dd1du64; + let mut next = move || { + state ^= state << 13; + state ^= state >> 7; + state ^= state << 17; + state + }; + (0..count) + .map(|row| { + let mut parents = Vec::new(); + if row + 1 < count { + parents.push((row + 1).to_string()); + } + if row % 7 == 3 && row + 2 < count { + let second = row + 2 + (next() % 40) as usize; + if second < count { + parents.push(second.to_string()); + } + } + let decorations = match row { + 0 => "HEAD -> main, origin/main".to_string(), + _ if row % 97 == 0 => format!("feature/branch-{row}"), + _ if row % 389 == 0 => format!("tag: v{row}"), + _ => String::new(), + }; + CommitInput { + hash: row.to_string(), + parent_hashes: parents, + decorations, + } + }) + .collect() +} + +#[test] +fn projects_five_thousand_commits_deterministically() { + let count = 5_000; + let history = generated_history(count); + let projection = layout(history.iter().map(CommitInput::clone).collect()); + assert_eq!(projection.rows.len(), count); + assert!(!projection.has_missing_parents); + assert!(projection.lane_count >= 2); + assert_eq!(projection.rows[0].layout_index, 1); + assert_eq!( + projection.rows[0].color_id, + color_id(&parse_labels("origin/main", &HashSet::new())) + ); + for (row, value) in projection.rows.iter().enumerate() { + assert_eq!(value.commit_hash, row.to_string()); + assert!(value.lane < value.lane_count && value.lane_count <= projection.lane_count); + let distinct = history[row] + .parent_hashes + .iter() + .collect::<BTreeSet<_>>() + .len(); + assert_eq!(value.parent_edges.len(), distinct, "row {row}"); + assert!(value + .parent_edges + .iter() + .all(|e| e.target_lane.is_some() == (row + 1 < count))); + } + assert_continuity(&projection); + // The same window always projects to the same lanes and colors. + let again = layout(history); + assert_eq!(projection, again); + // The filtered projection over the same window stays internally consistent. + let mut filtered_request = new_request(generated_history(count)); + filtered_request.visible_hashes = Some( + (0..count) + .filter(|row| row % 5 == 0) + .map(|row| row.to_string()) + .collect(), + ); + let sparse = project(&filtered_request, COMPACT); + assert_eq!(sparse.rows.len(), count / 5); + assert_continuity(&sparse); +} diff --git a/rust/lithe-core/src/git/mod.rs b/rust/lithe-core/src/git/mod.rs index 1d79d3880a..710e6081b6 100644 --- a/rust/lithe-core/src/git/mod.rs +++ b/rust/lithe-core/src/git/mod.rs @@ -24,8 +24,7 @@ mod fetch; mod fetch_execution; pub(crate) mod file_context; mod github_checkout; -#[allow(dead_code)] -pub(crate) mod graph; +mod graph; mod history; mod history_query; mod history_window; @@ -74,6 +73,7 @@ pub use github_checkout::{ checkout as checkout_pull_request, preview as checkout_pull_request_preview, PullRequestCheckoutPreviewRequest, PullRequestCheckoutRequest, }; +pub(crate) use graph::command as graph_projection_command; pub use history::{ close_history_cursor, history, history_locate, history_page, references, GitHistoryCursorCloseRequest, GitHistoryLocateRequest, GitHistoryPageRequest, diff --git a/rust/lithe-core/src/project/file_name_order.rs b/rust/lithe-core/src/project/file_name_order.rs index 2bf634fa84..86e7116c62 100644 --- a/rust/lithe-core/src/project/file_name_order.rs +++ b/rust/lithe-core/src/project/file_name_order.rs @@ -130,10 +130,21 @@ pub(crate) fn compare_file_names(left: &str, right: &str) -> Ordering { } fn compare_utf16(left: &[u16], right: &[u16]) -> Ordering { - natural_compare(left, right, true) + natural_compare(left, right, true, true) } -fn natural_compare(left: &[u16], right: &[u16], ignore_case: bool) -> Ordering { +/// Compares two Git reference names with IDEA's `NaturalComparator` (`ignoreCase`, not +/// `likeFileNames`), so `-` keeps its own code unit rank. Inputs are UTF-16 code units. +pub(crate) fn compare_reference_names(left: &[u16], right: &[u16]) -> Ordering { + natural_compare(left, right, true, false) +} + +fn natural_compare( + left: &[u16], + right: &[u16], + ignore_case: bool, + like_file_names: bool, +) -> Ordering { let (mut i, mut j) = (0, 0); while i < left.len() && j < right.len() { let (first, second) = (left[i], right[j]); @@ -166,7 +177,7 @@ fn natural_compare(left: &[u16], right: &[u16], ignore_case: bool) -> Ordering { i = end_left - 1; j = end_right - 1; } else if first != second { - let order = compare_name_units(first, second, ignore_case); + let order = compare_name_units(first, second, ignore_case, like_file_names); if order != Ordering::Equal { return order; } @@ -186,7 +197,7 @@ fn natural_compare(left: &[u16], right: &[u16], ignore_case: bool) -> Ordering { } // Names that tie while ignoring case are ordered by one case-sensitive pass. if ignore_case { - natural_compare(left, right, false) + natural_compare(left, right, false, like_file_names) } else { Ordering::Equal } @@ -194,8 +205,15 @@ fn natural_compare(left: &[u16], right: &[u16], ignore_case: bool) -> Ordering { /// The "likeFileNames" character comparison: a `-` ranks like `_` unless the other /// character already is `_`, so `foo-bar` and `foo_bar` stay together (IDEA-80435). -fn compare_name_units(first: u16, second: u16, ignore_case: bool) -> Ordering { - if first == DASH && second != UNDERSCORE { +fn compare_name_units( + first: u16, + second: u16, + ignore_case: bool, + like_file_names: bool, +) -> Ordering { + if !like_file_names { + compare_units(first, second, ignore_case) + } else if first == DASH && second != UNDERSCORE { compare_units(UNDERSCORE, second, ignore_case) } else if second == DASH && first != UNDERSCORE { compare_units(first, UNDERSCORE, ignore_case) diff --git a/rust/lithe-core/src/protocol/command.rs b/rust/lithe-core/src/protocol/command.rs index d30248e0c8..d53fa0a943 100644 --- a/rust/lithe-core/src/protocol/command.rs +++ b/rust/lithe-core/src/protocol/command.rs @@ -754,6 +754,8 @@ pub enum CoreCommand { GitUpdatePlan, /// Plans history refresh windows, page merges, and selection retention (`git.historyWindow`). GitHistoryWindow, + /// Projects the commit graph's lanes, colors, routes, and labels (`git.graphProjection`). + GitGraphProjection, /// Drops targets already covered by a selected untracked summary (`git.normalizeChangeTargets`). GitNormalizeChangeTargets, /// Validates an interactive rebase draft and derives its messages (`git.rebasePlanPreview`). @@ -1197,6 +1199,7 @@ impl CoreCommand { "git.repositoryColorAssignments" => Some(Self::GitRepositoryColorAssignments), "git.updatePlan" => Some(Self::GitUpdatePlan), "git.historyWindow" => Some(Self::GitHistoryWindow), + "git.graphProjection" => Some(Self::GitGraphProjection), "git.normalizeChangeTargets" => Some(Self::GitNormalizeChangeTargets), "git.rebasePlanPreview" => Some(Self::GitRebasePlanPreview), "git.referenceTree" => Some(Self::GitReferenceTree), diff --git a/rust/lithe-core/src/runtime/dispatcher.rs b/rust/lithe-core/src/runtime/dispatcher.rs index d870837a65..e7f1ece858 100644 --- a/rust/lithe-core/src/runtime/dispatcher.rs +++ b/rust/lithe-core/src/runtime/dispatcher.rs @@ -3422,6 +3422,9 @@ fn execute_parsed(mut parsed: CoreRequest) -> CoreResponse { CoreCommand::GitHistoryWindow => { plugin_response(id, parsed.payload, crate::git::history_window_command) } + CoreCommand::GitGraphProjection => { + plugin_response(id, parsed.payload, crate::git::graph_projection_command) + } CoreCommand::GitNormalizeChangeTargets => plugin_response( id, parsed.payload, diff --git a/shared/contracts/rust-core-api.md b/shared/contracts/rust-core-api.md index b51b172459..bfbfa3ec41 100644 --- a/shared/contracts/rust-core-api.md +++ b/shared/contracts/rust-core-api.md @@ -1500,6 +1500,7 @@ package manager owns the download and Lithe does not infer bytes from logs. | `git.pullPreflight` | Report the configured upstream, ahead/behind counts, divergence, tracked local changes, and the strategy Git is configured for, without fetching | | `git.updatePlan` | Route a branch Update and gate a Pull from facts the host collected: blockers, strategy default, whether to ask, and the expected checkout | | `git.historyWindow` | Plan a history refresh window, page merge, and selection retention over commit identities | +| `git.graphProjection` | Project a loaded history window into commit-graph lanes, color IDs, routes, print elements, and labels, optionally filtered | | `git.integrationPreflight` | Return local paths that block a merge, rebase, cherry-pick, or revert | | `git.conflictMarkers` | Return staged text files that still contain conflict markers | | `git.operationState` | Report an interrupted merge, rebase, cherry-pick, or revert and its conflicted paths | @@ -2457,6 +2458,30 @@ commits. `reconcileSelection` returns the retained `selected` identities in window order plus `focused` and `anchor`, falling back to the first loaded commit. `shared/fixtures/git/history-window-v1.json` defines the rules. +`git.graphProjection` is a pure projection of one loaded history window; it never +starts Git. The request is `{ "commits": [{ "hash", "parentHashes", "decorations" }], +"remoteNames"?, "repositoryCommits"?, "visibleHashes"?, "displayMode"?, +"currentBranch"? }`: `commits` are in Git's child-before-parent order, `remoteNames` +are the remote short names that type a bare remote-tracking decoration, +`repositoryCommits` is the complete repository window that fixes the permanent layout +(ignored unless it is unique and covers every scoped commit), `visibleHashes` applies +a filter (omit it to show every commit), `displayMode` is `compact` (default) or +`expanded`, and `currentBranch` asks for the ancestry of that local branch. Hosts call +it once per loaded window, never per commit, and recompute the whole window when a page +is appended or the history refreshes; lanes depend on every loaded edge, and a head +fragment's color ID is the Java `String.hashCode` of its principal reference name, so a +named branch keeps its color across pages. The response is `{ "version", "rows", +"laneCount", "recommendedLaneCount", "hasMissingParents", "currentBranchHashes" }`. +Each visible row carries `commitHash`, integer `lane` and `laneCount`, a signed +`colorId`, `layoutIndex`, `incomingLaneColors`, `parentEdges` (`id`, `parentHash`, +`targetLane`, `colorId`, `isMissing`, `isDotted`), typed `labels`, and +`printElements` (the up and down half-edges with `position`, `adjacentPosition`, +`colorId`, `isDotted`, `isMissing`, `hasArrow`, `isTerminal`, `targetHash`). Hosts own +pixels, curves, and the mapping from a color ID to a theme color; `colorId` `0` means +an unreferenced fragment. Requests over 20,000 commits fail with `invalid_request`. +`shared/fixtures/git/graph-projection-v1.json` defines the rules and +`shared/fixtures/git/graph-idea/` holds the pinned IntelliJ oracles. + `git.integrationPreflight` accepts either `reference` or `gitReference` with `root` and `operation`, where `operation` is `merge`, `rebase`, `cherryPick`, or `revert`. It returns sorted, de-duplicated `blockingPaths` and diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/NOTICE.txt b/shared/fixtures/git/graph-idea/NOTICE.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/NOTICE.txt rename to shared/fixtures/git/graph-idea/NOTICE.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/longEdges_in.txt b/shared/fixtures/git/graph-idea/elementGenerator/longEdges_in.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/longEdges_in.txt rename to shared/fixtures/git/graph-idea/elementGenerator/longEdges_in.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/longEdges_out.txt b/shared/fixtures/git/graph-idea/elementGenerator/longEdges_out.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/longEdges_out.txt rename to shared/fixtures/git/graph-idea/elementGenerator/longEdges_out.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/manyNodes_in.txt b/shared/fixtures/git/graph-idea/elementGenerator/manyNodes_in.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/manyNodes_in.txt rename to shared/fixtures/git/graph-idea/elementGenerator/manyNodes_in.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/manyNodes_out.txt b/shared/fixtures/git/graph-idea/elementGenerator/manyNodes_out.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/manyNodes_out.txt rename to shared/fixtures/git/graph-idea/elementGenerator/manyNodes_out.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneNode_in.txt b/shared/fixtures/git/graph-idea/elementGenerator/oneNode_in.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneNode_in.txt rename to shared/fixtures/git/graph-idea/elementGenerator/oneNode_in.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneNode_out.txt b/shared/fixtures/git/graph-idea/elementGenerator/oneNode_out.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneNode_out.txt rename to shared/fixtures/git/graph-idea/elementGenerator/oneNode_out.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneUpOneDown1_in.txt b/shared/fixtures/git/graph-idea/elementGenerator/oneUpOneDown1_in.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneUpOneDown1_in.txt rename to shared/fixtures/git/graph-idea/elementGenerator/oneUpOneDown1_in.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneUpOneDown1_out.txt b/shared/fixtures/git/graph-idea/elementGenerator/oneUpOneDown1_out.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneUpOneDown1_out.txt rename to shared/fixtures/git/graph-idea/elementGenerator/oneUpOneDown1_out.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneUpOneDown2_in.txt b/shared/fixtures/git/graph-idea/elementGenerator/oneUpOneDown2_in.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneUpOneDown2_in.txt rename to shared/fixtures/git/graph-idea/elementGenerator/oneUpOneDown2_in.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneUpOneDown2_out.txt b/shared/fixtures/git/graph-idea/elementGenerator/oneUpOneDown2_out.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/oneUpOneDown2_out.txt rename to shared/fixtures/git/graph-idea/elementGenerator/oneUpOneDown2_out.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/manyNodes_in.txt b/shared/fixtures/git/graph-idea/layoutBuilder/manyNodes_in.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/manyNodes_in.txt rename to shared/fixtures/git/graph-idea/layoutBuilder/manyNodes_in.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/manyNodes_out.txt b/shared/fixtures/git/graph-idea/layoutBuilder/manyNodes_out.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/manyNodes_out.txt rename to shared/fixtures/git/graph-idea/layoutBuilder/manyNodes_out.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/notFullGraph_in.txt b/shared/fixtures/git/graph-idea/layoutBuilder/notFullGraph_in.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/notFullGraph_in.txt rename to shared/fixtures/git/graph-idea/layoutBuilder/notFullGraph_in.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/notFullGraph_out.txt b/shared/fixtures/git/graph-idea/layoutBuilder/notFullGraph_out.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/notFullGraph_out.txt rename to shared/fixtures/git/graph-idea/layoutBuilder/notFullGraph_out.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/oneNodeNotFullGraph_in.txt b/shared/fixtures/git/graph-idea/layoutBuilder/oneNodeNotFullGraph_in.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/oneNodeNotFullGraph_in.txt rename to shared/fixtures/git/graph-idea/layoutBuilder/oneNodeNotFullGraph_in.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/oneNodeNotFullGraph_out.txt b/shared/fixtures/git/graph-idea/layoutBuilder/oneNodeNotFullGraph_out.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/oneNodeNotFullGraph_out.txt rename to shared/fixtures/git/graph-idea/layoutBuilder/oneNodeNotFullGraph_out.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/oneNode_in.txt b/shared/fixtures/git/graph-idea/layoutBuilder/oneNode_in.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/oneNode_in.txt rename to shared/fixtures/git/graph-idea/layoutBuilder/oneNode_in.txt diff --git a/macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/oneNode_out.txt b/shared/fixtures/git/graph-idea/layoutBuilder/oneNode_out.txt similarity index 100% rename from macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/layoutBuilder/oneNode_out.txt rename to shared/fixtures/git/graph-idea/layoutBuilder/oneNode_out.txt diff --git a/shared/fixtures/git/graph-projection-v1.json b/shared/fixtures/git/graph-projection-v1.json new file mode 100644 index 0000000000..54d4895812 --- /dev/null +++ b/shared/fixtures/git/graph-projection-v1.json @@ -0,0 +1,2154 @@ +{ + "version": 1, + "cases": [ + { + "name": "linearHistory", + "description": "One lane, one color; HEAD and branch labels split from the checkout decoration.", + "request": {"commits":[{"hash":"C","parentHashes":["B"],"decorations":"HEAD -> main"},{"hash":"B","parentHashes":["A"]},{"hash":"A"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "C", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"0:1:false","parentHash":"B","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"B"}] + }, + { + "commitHash": "B", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"1:2:false","parentHash":"A","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"C"}, + {"id":"1:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"A"} + ] + }, + { + "commitHash": "A", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"1:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"B"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "forkAndMerge", + "description": "A merge opens a second lane for its later parent and the branch converges into the first-parent lane.", + "request": {"commits":[{"hash":"M","parentHashes":["D","C"]},{"hash":"D","parentHashes":["B"]},{"hash":"C","parentHashes":["B"]},{"hash":"B"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "M", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:1:false","parentHash":"D","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false},{"id":"0:2:false","parentHash":"C","targetLane":1,"colorId":2,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"D"}, + {"id":"0:2:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"C"} + ] + }, + { + "commitHash": "D", + "lane": 0, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,2], + "parentEdges": [{"id":"1:3:false","parentHash":"B","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"M"}, + {"id":"1:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"B"}, + {"id":"0:2:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"M"}, + {"id":"0:2:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"C"} + ] + }, + { + "commitHash": "C", + "lane": 1, + "laneCount": 2, + "colorId": 2, + "layoutIndex": 2, + "incomingLaneColors": [0,2], + "parentEdges": [{"id":"2:3:false","parentHash":"B","targetLane":0,"colorId":2,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"1:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"D"}, + {"id":"1:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"B"}, + {"id":"0:2:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"M"}, + {"id":"2:3:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"B"} + ] + }, + { + "commitHash": "B", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"1:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"D"}, + {"id":"2:3:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"C"} + ] + } + ], + "laneCount": 2, + "recommendedLaneCount": 2, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "octopusMerge", + "description": "Three merge parents fan out to three lanes and converge on the root.", + "request": {"commits":[{"hash":"O","parentHashes":["P1","P2","P3"]},{"hash":"P1","parentHashes":["R"]},{"hash":"P2","parentHashes":["R"]},{"hash":"P3","parentHashes":["R"]},{"hash":"R"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "O", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [ + {"id":"0:1:false","parentHash":"P1","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}, + {"id":"0:2:false","parentHash":"P2","targetLane":1,"colorId":2,"isMissing":false,"isDotted":false}, + {"id":"0:3:false","parentHash":"P3","targetLane":2,"colorId":3,"isMissing":false,"isDotted":false} + ], + "labels": [], + "printElements": [ + {"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P1"}, + {"id":"0:2:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P2"}, + {"id":"0:3:false:down","position":0,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P3"} + ] + }, + { + "commitHash": "P1", + "lane": 0, + "laneCount": 3, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,2,3], + "parentEdges": [{"id":"1:4:false","parentHash":"R","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"O"}, + {"id":"1:4:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"R"}, + {"id":"0:2:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"O"}, + {"id":"0:2:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P2"}, + {"id":"0:3:false:up","position":2,"adjacentPosition":0,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"O"}, + {"id":"0:3:false:down","position":2,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P3"} + ] + }, + { + "commitHash": "P2", + "lane": 1, + "laneCount": 3, + "colorId": 2, + "layoutIndex": 2, + "incomingLaneColors": [0,2,3], + "parentEdges": [{"id":"2:4:false","parentHash":"R","targetLane":1,"colorId":2,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"1:4:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P1"}, + {"id":"1:4:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"R"}, + {"id":"0:2:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"O"}, + {"id":"2:4:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"R"}, + {"id":"0:3:false:up","position":2,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"O"}, + {"id":"0:3:false:down","position":2,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P3"} + ] + }, + { + "commitHash": "P3", + "lane": 2, + "laneCount": 3, + "colorId": 3, + "layoutIndex": 3, + "incomingLaneColors": [0,2,3], + "parentEdges": [{"id":"3:4:false","parentHash":"R","targetLane":0,"colorId":3,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"1:4:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P1"}, + {"id":"1:4:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"R"}, + {"id":"2:4:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P2"}, + {"id":"2:4:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"R"}, + {"id":"0:3:false:up","position":2,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"O"}, + {"id":"3:4:false:down","position":2,"adjacentPosition":0,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"R"} + ] + }, + { + "commitHash": "R", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"1:4:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P1"}, + {"id":"2:4:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P2"}, + {"id":"3:4:false:up","position":0,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"P3"} + ] + } + ], + "laneCount": 3, + "recommendedLaneCount": 3, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "headOrdering", + "description": "origin/main seeds the layout before local main, other branches, tags, and unreferenced tips.", + "request": { + "commits": [ + {"hash":"untagged","parentHashes":["root"]}, + {"hash":"feature-b","parentHashes":["root"],"decorations":"feature/b"}, + {"hash":"tag-tip","parentHashes":["root"],"decorations":"tag: v1"}, + {"hash":"main-tip","parentHashes":["root"],"decorations":"main, origin/main"}, + {"hash":"feature-a","parentHashes":["root"],"decorations":"HEAD -> feature/a"}, + {"hash":"root"} + ] + }, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "untagged", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 5, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:5:false","parentHash":"root","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [{"id":"0:5:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}] + }, + { + "commitHash": "feature-b", + "lane": 0, + "laneCount": 2, + "colorId": -420504695, + "layoutIndex": 3, + "incomingLaneColors": [-420504695,0], + "parentEdges": [{"id":"1:5:false","parentHash":"root","targetLane":0,"colorId":-420504695,"isMissing":false,"isDotted":false}], + "labels": [{"id":"branch:feature/b","title":"feature/b","kind":"branch"}], + "printElements": [ + {"id":"1:5:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":-420504695,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"0:5:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"untagged"}, + {"id":"0:5:false:down","position":1,"adjacentPosition":2,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"} + ] + }, + { + "commitHash": "tag-tip", + "lane": 1, + "laneCount": 3, + "colorId": 3707, + "layoutIndex": 4, + "incomingLaneColors": [-420504695,3707,0], + "parentEdges": [{"id":"2:5:false","parentHash":"root","targetLane":2,"colorId":3707,"isMissing":false,"isDotted":false}], + "labels": [{"id":"tag:v1","title":"v1","kind":"tag"}], + "printElements": [ + {"id":"1:5:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":-420504695,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"feature-b"}, + {"id":"1:5:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":-420504695,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"2:5:false:down","position":1,"adjacentPosition":2,"direction":"down","colorId":3707,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"0:5:false:up","position":2,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"untagged"}, + {"id":"0:5:false:down","position":2,"adjacentPosition":3,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"} + ] + }, + { + "commitHash": "main-tip", + "lane": 0, + "laneCount": 4, + "colorId": 1685401346, + "layoutIndex": 1, + "incomingLaneColors": [1685401346,-420504695,3707,0], + "parentEdges": [{"id":"3:5:false","parentHash":"root","targetLane":0,"colorId":1685401346,"isMissing":false,"isDotted":false}], + "labels": [{"id":"branch:main","title":"main","kind":"branch"},{"id":"remote:origin/main","title":"origin/main","kind":"remote"}], + "printElements": [ + {"id":"3:5:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":1685401346,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"1:5:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":-420504695,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"feature-b"}, + {"id":"1:5:false:down","position":1,"adjacentPosition":2,"direction":"down","colorId":-420504695,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"2:5:false:up","position":2,"adjacentPosition":1,"direction":"up","colorId":3707,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"tag-tip"}, + {"id":"2:5:false:down","position":2,"adjacentPosition":3,"direction":"down","colorId":3707,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"0:5:false:up","position":3,"adjacentPosition":2,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"untagged"}, + {"id":"0:5:false:down","position":3,"adjacentPosition":4,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"} + ] + }, + { + "commitHash": "feature-a", + "lane": 1, + "laneCount": 5, + "colorId": -420504696, + "layoutIndex": 2, + "incomingLaneColors": [1685401346,-420504696,-420504695,3707,0], + "parentEdges": [{"id":"4:5:false","parentHash":"root","targetLane":0,"colorId":-420504696,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:feature/a","title":"feature/a","kind":"branch"}], + "printElements": [ + {"id":"3:5:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":1685401346,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"main-tip"}, + {"id":"3:5:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":1685401346,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"4:5:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":-420504696,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"1:5:false:up","position":2,"adjacentPosition":1,"direction":"up","colorId":-420504695,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"feature-b"}, + {"id":"1:5:false:down","position":2,"adjacentPosition":0,"direction":"down","colorId":-420504695,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"2:5:false:up","position":3,"adjacentPosition":2,"direction":"up","colorId":3707,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"tag-tip"}, + {"id":"2:5:false:down","position":3,"adjacentPosition":0,"direction":"down","colorId":3707,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"0:5:false:up","position":4,"adjacentPosition":3,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"untagged"}, + {"id":"0:5:false:down","position":4,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"} + ] + }, + { + "commitHash": "root", + "lane": 0, + "laneCount": 1, + "colorId": 1685401346, + "layoutIndex": 1, + "incomingLaneColors": [1685401346], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"0:5:false:up","position":0,"adjacentPosition":4,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"untagged"}, + {"id":"1:5:false:up","position":0,"adjacentPosition":2,"direction":"up","colorId":-420504695,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"feature-b"}, + {"id":"2:5:false:up","position":0,"adjacentPosition":3,"direction":"up","colorId":3707,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"tag-tip"}, + {"id":"3:5:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":1685401346,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"main-tip"}, + {"id":"4:5:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":-420504696,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"feature-a"} + ] + } + ], + "laneCount": 5, + "recommendedLaneCount": 4, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "naturalHeadOrder", + "description": "Equal-priority branches order by natural name, so release/2 precedes release/10.", + "request": {"commits":[{"hash":"r10","parentHashes":["root"],"decorations":"release/10"},{"hash":"r2","parentHashes":["root"],"decorations":"release/2"},{"hash":"root"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "r10", + "lane": 0, + "laneCount": 1, + "colorId": -1517175513, + "layoutIndex": 2, + "incomingLaneColors": [-1517175513], + "parentEdges": [{"id":"0:2:false","parentHash":"root","targetLane":1,"colorId":-1517175513,"isMissing":false,"isDotted":false}], + "labels": [{"id":"branch:release/10","title":"release/10","kind":"branch"}], + "printElements": [{"id":"0:2:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":-1517175513,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}] + }, + { + "commitHash": "r2", + "lane": 0, + "laneCount": 2, + "colorId": 89606186, + "layoutIndex": 1, + "incomingLaneColors": [89606186,-1517175513], + "parentEdges": [{"id":"1:2:false","parentHash":"root","targetLane":0,"colorId":89606186,"isMissing":false,"isDotted":false}], + "labels": [{"id":"branch:release/2","title":"release/2","kind":"branch"}], + "printElements": [ + {"id":"1:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":89606186,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"0:2:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":-1517175513,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"r10"}, + {"id":"0:2:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":-1517175513,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"} + ] + }, + { + "commitHash": "root", + "lane": 0, + "laneCount": 1, + "colorId": 89606186, + "layoutIndex": 1, + "incomingLaneColors": [89606186], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"0:2:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":-1517175513,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"r10"}, + {"id":"1:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":89606186,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"r2"} + ] + } + ], + "laneCount": 2, + "recommendedLaneCount": 2, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "remoteNames", + "description": "A bare remote-tracking name is typed as remote only when the host supplies the remote short names.", + "request": {"commits":[{"hash":"local","parentHashes":["root"],"decorations":"main"},{"hash":"remote","parentHashes":["root"],"decorations":"upstream/work"},{"hash":"root"}],"remoteNames":["upstream/work"]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "local", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 2, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"0:2:false","parentHash":"root","targetLane":1,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [{"id":"0:2:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}] + }, + { + "commitHash": "remote", + "lane": 0, + "laneCount": 2, + "colorId": -1107768635, + "layoutIndex": 1, + "incomingLaneColors": [-1107768635,3343801], + "parentEdges": [{"id":"1:2:false","parentHash":"root","targetLane":0,"colorId":-1107768635,"isMissing":false,"isDotted":false}], + "labels": [{"id":"remote:upstream/work","title":"upstream/work","kind":"remote"}], + "printElements": [ + {"id":"1:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":-1107768635,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"0:2:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"local"}, + {"id":"0:2:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"} + ] + }, + { + "commitHash": "root", + "lane": 0, + "laneCount": 1, + "colorId": -1107768635, + "layoutIndex": 1, + "incomingLaneColors": [-1107768635], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"0:2:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"local"}, + {"id":"1:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":-1107768635,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"remote"} + ] + } + ], + "laneCount": 2, + "recommendedLaneCount": 2, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "pageOne", + "description": "The first history page ends with a parent outside the loaded window.", + "request": {"commits":[{"hash":"m3","parentHashes":["m2"],"decorations":"HEAD -> main"},{"hash":"m2","parentHashes":["m1"]},{"hash":"m1","parentHashes":["m0"]}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "m3", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"0:1:false","parentHash":"m2","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m2"}] + }, + { + "commitHash": "m2", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"1:2:false","parentHash":"m1","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m3"}, + {"id":"1:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m1"} + ] + }, + { + "commitHash": "m1", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"2:m0:false","parentHash":"m0","targetLane":null,"colorId":3343801,"isMissing":true,"isDotted":false}], + "labels": [], + "printElements": [{"id":"1:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m2"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": true, + "currentBranchHashes": [] + } + }, + { + "name": "pageTwo", + "description": "The cumulative window after loading the next page resolves the missing parent.", + "request": {"commits":[{"hash":"m3","parentHashes":["m2"],"decorations":"HEAD -> main"},{"hash":"m2","parentHashes":["m1"]},{"hash":"m1","parentHashes":["m0"]},{"hash":"m0","parentHashes":["m-1"]},{"hash":"m-1"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "m3", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"0:1:false","parentHash":"m2","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m2"}] + }, + { + "commitHash": "m2", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"1:2:false","parentHash":"m1","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m3"}, + {"id":"1:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m1"} + ] + }, + { + "commitHash": "m1", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"2:3:false","parentHash":"m0","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"1:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m2"}, + {"id":"2:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m0"} + ] + }, + { + "commitHash": "m0", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"3:4:false","parentHash":"m-1","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"2:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m1"}, + {"id":"3:4:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m-1"} + ] + }, + { + "commitHash": "m-1", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"3:4:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m0"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "windowAfterRefresh", + "description": "A refresh adds a newer commit; main keeps its color because the head fragment is keyed by name.", + "request": {"commits":[{"hash":"m4","parentHashes":["m3"],"decorations":"HEAD -> main"},{"hash":"m3","parentHashes":["m2"]},{"hash":"m2","parentHashes":["m1"]},{"hash":"m1","parentHashes":["m0"]},{"hash":"m0"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "m4", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"0:1:false","parentHash":"m3","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m3"}] + }, + { + "commitHash": "m3", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"1:2:false","parentHash":"m2","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m4"}, + {"id":"1:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m2"} + ] + }, + { + "commitHash": "m2", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"2:3:false","parentHash":"m1","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"1:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m3"}, + {"id":"2:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m1"} + ] + }, + { + "commitHash": "m1", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"3:4:false","parentHash":"m0","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"2:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m2"}, + {"id":"3:4:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m0"} + ] + }, + { + "commitHash": "m0", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"3:4:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m1"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "branchScopeWithRepositoryContext", + "description": "A branch scope keeps the repository graph's layout indices, colors, and base order.", + "request": { + "commits": [{"hash":"side","parentHashes":["root"],"decorations":"HEAD -> feature"},{"hash":"root"}], + "repositoryCommits": [{"hash":"main-tip","parentHashes":["root"],"decorations":"origin/main"},{"hash":"side","parentHashes":["root"],"decorations":"HEAD -> feature"},{"hash":"root"}] + }, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "side", + "lane": 0, + "laneCount": 1, + "colorId": -979207434, + "layoutIndex": 2, + "incomingLaneColors": [-979207434], + "parentEdges": [{"id":"0:1:false","parentHash":"root","targetLane":0,"colorId":-979207434,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:feature","title":"feature","kind":"branch"}], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":-979207434,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}] + }, + { + "commitHash": "root", + "lane": 0, + "laneCount": 1, + "colorId": 1685401346, + "layoutIndex": 1, + "incomingLaneColors": [1685401346], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":-979207434,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"side"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "incompleteRepositoryContext", + "description": "A context that does not cover every scoped commit is ignored, never dropping commits.", + "request": {"commits":[{"hash":"tip","parentHashes":["root"]},{"hash":"root"}],"repositoryCommits":[{"hash":"root"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "tip", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:1:false","parentHash":"root","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}] + }, + { + "commitHash": "root", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"tip"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "duplicateCommits", + "description": "A repeated hash keeps only its first row, so overlapping pages cannot draw a commit twice.", + "request": {"commits":[{"hash":"b","parentHashes":["a"]},{"hash":"a"},{"hash":"b","parentHashes":["a"]}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "b", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:1:false","parentHash":"a","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"a"}] + }, + { + "commitHash": "a", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"b"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "filteredDottedAncestor", + "description": "Hidden linear ancestors collapse into one dotted edge between the visible endpoints.", + "request": {"commits":[{"hash":"a","parentHashes":["b"]},{"hash":"b","parentHashes":["c"]},{"hash":"c","parentHashes":["d"]},{"hash":"d"}],"visibleHashes":["a","d"]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "a", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:1:true","parentHash":"d","targetLane":0,"colorId":0,"isMissing":false,"isDotted":true}], + "labels": [], + "printElements": [{"id":"0:1:true:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":true,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"d"}] + }, + { + "commitHash": "d", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"0:1:true:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":true,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"a"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "filteredHiddenDiamond", + "description": "Direct merge parents stay solid; a visible ancestor reached only through hidden commits is dotted.", + "request": {"commits":[{"hash":"m","parentHashes":["x","y"]},{"hash":"x","parentHashes":["base"]},{"hash":"y","parentHashes":["base"]},{"hash":"base","parentHashes":["root"]},{"hash":"root"}],"visibleHashes":["m","x","root"]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "m", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:1:false","parentHash":"x","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"x"}] + }, + { + "commitHash": "x", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"1:2:true","parentHash":"root","targetLane":0,"colorId":0,"isMissing":false,"isDotted":true}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"m"}, + {"id":"1:2:true:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":true,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"} + ] + }, + { + "commitHash": "root", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"1:2:true:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":true,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"x"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "filteredDirectEdgeWins", + "description": "A direct parent wins over a second path through hidden commits to the same visible ancestor.", + "request": {"commits":[{"hash":"top","parentHashes":["mid","low"]},{"hash":"mid","parentHashes":["low"]},{"hash":"low"}],"visibleHashes":["top","low"]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "top", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:1:false","parentHash":"low","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"low"}] + }, + { + "commitHash": "low", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"top"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "filteredMissingParents", + "description": "Hidden commits project their unloaded parents onto the visible descendants; unrelated hidden roots add nothing.", + "request": { + "commits": [ + {"hash":"a","parentHashes":["left","right","missing"]}, + {"hash":"peer","parentHashes":["left"]}, + {"hash":"left","parentHashes":["missing","missing"]}, + {"hash":"right","parentHashes":["missing","other"]}, + {"hash":"unrelated","parentHashes":["unrelated-missing"]} + ], + "visibleHashes": ["a","peer"] + }, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "a", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:missing:false","parentHash":"missing","targetLane":0,"colorId":0,"isMissing":true,"isDotted":false},{"id":"0:other:true","parentHash":"other","targetLane":1,"colorId":0,"isMissing":true,"isDotted":true}], + "labels": [], + "printElements": [ + {"id":"0:missing:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null}, + {"id":"0:other:true:down","position":0,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":true,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null} + ] + }, + { + "commitHash": "peer", + "lane": 2, + "laneCount": 3, + "colorId": 0, + "layoutIndex": 3, + "incomingLaneColors": [0,0,0], + "parentEdges": [{"id":"1:missing:true","parentHash":"missing","targetLane":null,"colorId":0,"isMissing":true,"isDotted":true}], + "labels": [], + "printElements": [ + {"id":"0:missing:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null}, + {"id":"0:missing:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":true,"hasArrow":true,"isTerminal":true,"targetHash":null}, + {"id":"0:other:true:up","position":1,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":true,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null}, + {"id":"0:other:true:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":true,"isMissing":true,"hasArrow":true,"isTerminal":true,"targetHash":null} + ] + } + ], + "laneCount": 3, + "recommendedLaneCount": 2, + "hasMissingParents": true, + "currentBranchHashes": [] + } + }, + { + "name": "filteredBoundaryStopsAtVisible", + "description": "Unloaded-parent propagation stops at a visible ancestor, which owns its own continuation.", + "request": {"commits":[{"hash":"a","parentHashes":["b"]},{"hash":"b","parentHashes":["c"]},{"hash":"c","parentHashes":["missing"]}],"visibleHashes":["a","b"]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "a", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:1:false","parentHash":"b","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"b"}] + }, + { + "commitHash": "b", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"1:missing:true","parentHash":"missing","targetLane":null,"colorId":0,"isMissing":true,"isDotted":true}], + "labels": [], + "printElements": [{"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"a"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": true, + "currentBranchHashes": [] + } + }, + { + "name": "filteredEmpty", + "description": "A filter that matches nothing produces no rows and no missing-history notice.", + "request": {"commits":[{"hash":"a","parentHashes":["b"]}],"visibleHashes":[]}, + "response": {"version":1,"rows":[],"laneCount":0,"recommendedLaneCount":0,"hasMissingParents":false,"currentBranchHashes":[]} + }, + { + "name": "missingParentLastRow", + "description": "An unloaded parent draws a terminal arrow on the next row, never a fabricated target.", + "request": {"commits":[{"hash":"a","parentHashes":["b","b"]}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "a", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:b:false","parentHash":"b","targetLane":null,"colorId":0,"isMissing":true,"isDotted":false}], + "labels": [], + "printElements": [] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": true, + "currentBranchHashes": [] + } + }, + { + "name": "compactLongEdge", + "description": "A 31-row edge reaches the 30-row compact limit, so only its two ends are drawn with arrows.", + "request": { + "commits": [ + {"hash":"0","parentHashes":["1","31"]}, + {"hash":"1","parentHashes":["2"]}, + {"hash":"2","parentHashes":["3"]}, + {"hash":"3","parentHashes":["4"]}, + {"hash":"4","parentHashes":["5"]}, + {"hash":"5","parentHashes":["6"]}, + {"hash":"6","parentHashes":["7"]}, + {"hash":"7","parentHashes":["8"]}, + {"hash":"8","parentHashes":["9"]}, + {"hash":"9","parentHashes":["10"]}, + {"hash":"10","parentHashes":["11"]}, + {"hash":"11","parentHashes":["12"]}, + {"hash":"12","parentHashes":["13"]}, + {"hash":"13","parentHashes":["14"]}, + {"hash":"14","parentHashes":["15"]}, + {"hash":"15","parentHashes":["16"]}, + {"hash":"16","parentHashes":["17"]}, + {"hash":"17","parentHashes":["18"]}, + {"hash":"18","parentHashes":["19"]}, + {"hash":"19","parentHashes":["20"]}, + {"hash":"20","parentHashes":["21"]}, + {"hash":"21","parentHashes":["22"]}, + {"hash":"22","parentHashes":["23"]}, + {"hash":"23","parentHashes":["24"]}, + {"hash":"24","parentHashes":["25"]}, + {"hash":"25","parentHashes":["26"]}, + {"hash":"26","parentHashes":["27"]}, + {"hash":"27","parentHashes":["28"]}, + {"hash":"28","parentHashes":["29"]}, + {"hash":"29","parentHashes":["30"]}, + {"hash":"30","parentHashes":["31"]}, + {"hash":"31"} + ] + }, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "0", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:1:false","parentHash":"1","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false},{"id":"0:31:false","parentHash":"31","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} + ] + }, + { + "commitHash": "1", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"1:2:false","parentHash":"2","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":true,"targetHash":"31"}, + {"id":"0:1:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"1:2:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"} + ] + }, + { + "commitHash": "2", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"2:3:false","parentHash":"3","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"1:2:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, + {"id":"2:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"} + ] + }, + { + "commitHash": "3", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"3:4:false","parentHash":"4","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"2:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"}, + {"id":"3:4:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"} + ] + }, + { + "commitHash": "4", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"4:5:false","parentHash":"5","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"3:4:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"}, + {"id":"4:5:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"} + ] + }, + { + "commitHash": "5", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"5:6:false","parentHash":"6","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"4:5:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"}, + {"id":"5:6:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"6"} + ] + }, + { + "commitHash": "6", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"6:7:false","parentHash":"7","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"5:6:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"}, + {"id":"6:7:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"7"} + ] + }, + { + "commitHash": "7", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"7:8:false","parentHash":"8","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"6:7:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"6"}, + {"id":"7:8:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"8"} + ] + }, + { + "commitHash": "8", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"8:9:false","parentHash":"9","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"7:8:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"7"}, + {"id":"8:9:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"9"} + ] + }, + { + "commitHash": "9", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"9:10:false","parentHash":"10","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"8:9:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"8"}, + {"id":"9:10:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"10"} + ] + }, + { + "commitHash": "10", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"10:11:false","parentHash":"11","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"9:10:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"9"}, + {"id":"10:11:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"11"} + ] + }, + { + "commitHash": "11", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"11:12:false","parentHash":"12","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"10:11:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"10"}, + {"id":"11:12:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"12"} + ] + }, + { + "commitHash": "12", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"12:13:false","parentHash":"13","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"11:12:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"11"}, + {"id":"12:13:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"13"} + ] + }, + { + "commitHash": "13", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"13:14:false","parentHash":"14","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"12:13:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"12"}, + {"id":"13:14:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"14"} + ] + }, + { + "commitHash": "14", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"14:15:false","parentHash":"15","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"13:14:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"13"}, + {"id":"14:15:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"15"} + ] + }, + { + "commitHash": "15", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"15:16:false","parentHash":"16","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"14:15:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"14"}, + {"id":"15:16:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"16"} + ] + }, + { + "commitHash": "16", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"16:17:false","parentHash":"17","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"15:16:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"15"}, + {"id":"16:17:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"17"} + ] + }, + { + "commitHash": "17", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"17:18:false","parentHash":"18","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"16:17:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"16"}, + {"id":"17:18:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"18"} + ] + }, + { + "commitHash": "18", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"18:19:false","parentHash":"19","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"17:18:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"17"}, + {"id":"18:19:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"19"} + ] + }, + { + "commitHash": "19", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"19:20:false","parentHash":"20","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"18:19:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"18"}, + {"id":"19:20:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"20"} + ] + }, + { + "commitHash": "20", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"20:21:false","parentHash":"21","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"19:20:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"19"}, + {"id":"20:21:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"21"} + ] + }, + { + "commitHash": "21", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"21:22:false","parentHash":"22","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"20:21:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"20"}, + {"id":"21:22:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"22"} + ] + }, + { + "commitHash": "22", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"22:23:false","parentHash":"23","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"21:22:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"21"}, + {"id":"22:23:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"23"} + ] + }, + { + "commitHash": "23", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"23:24:false","parentHash":"24","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"22:23:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"22"}, + {"id":"23:24:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"24"} + ] + }, + { + "commitHash": "24", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"24:25:false","parentHash":"25","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"23:24:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"23"}, + {"id":"24:25:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"25"} + ] + }, + { + "commitHash": "25", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"25:26:false","parentHash":"26","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"24:25:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"24"}, + {"id":"25:26:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"26"} + ] + }, + { + "commitHash": "26", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"26:27:false","parentHash":"27","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"25:26:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"25"}, + {"id":"26:27:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"27"} + ] + }, + { + "commitHash": "27", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"27:28:false","parentHash":"28","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"26:27:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"26"}, + {"id":"27:28:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"28"} + ] + }, + { + "commitHash": "28", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"28:29:false","parentHash":"29","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"27:28:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"27"}, + {"id":"28:29:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"} + ] + }, + { + "commitHash": "29", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"29:30:false","parentHash":"30","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"28:29:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"28"}, + {"id":"29:30:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} + ] + }, + { + "commitHash": "30", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"30:31:false","parentHash":"31","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":true,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"29:30:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"}, + {"id":"30:31:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} + ] + }, + { + "commitHash": "31", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"30:31:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} + ] + } + ], + "laneCount": 2, + "recommendedLaneCount": 2, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "currentBranchAncestry", + "description": "currentBranch lists every ancestor, following all merge parents through the repository context.", + "request": { + "commits": [{"hash":"head","parentHashes":["left","merged"],"decorations":"HEAD -> main"},{"hash":"other","parentHashes":["base"],"decorations":"other"},{"hash":"left","parentHashes":["base"]}], + "repositoryCommits": [{"hash":"merged","parentHashes":["base"]},{"hash":"base","parentHashes":["missing"]}], + "currentBranch": "main" + }, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "head", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [ + {"id":"0:2:false","parentHash":"left","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}, + {"id":"0:merged:false","parentHash":"merged","targetLane":1,"colorId":3343801,"isMissing":true,"isDotted":false} + ], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [ + {"id":"0:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"left"}, + {"id":"0:merged:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null} + ] + }, + { + "commitHash": "other", + "lane": 2, + "laneCount": 3, + "colorId": 106069776, + "layoutIndex": 2, + "incomingLaneColors": [3343801,3343801,106069776], + "parentEdges": [{"id":"1:base:false","parentHash":"base","targetLane":1,"colorId":106069776,"isMissing":true,"isDotted":false}], + "labels": [{"id":"branch:other","title":"other","kind":"branch"}], + "printElements": [ + {"id":"0:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"head"}, + {"id":"0:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"left"}, + {"id":"0:merged:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null}, + {"id":"0:merged:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":true,"hasArrow":true,"isTerminal":true,"targetHash":null}, + {"id":"1:base:false:down","position":2,"adjacentPosition":1,"direction":"down","colorId":106069776,"isDotted":false,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null} + ] + }, + { + "commitHash": "left", + "lane": 0, + "laneCount": 2, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801,106069776], + "parentEdges": [{"id":"2:base:false","parentHash":"base","targetLane":null,"colorId":3343801,"isMissing":true,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"head"}, + {"id":"1:base:false:up","position":1,"adjacentPosition":2,"direction":"up","colorId":106069776,"isDotted":false,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null}, + {"id":"1:base:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":106069776,"isDotted":false,"isMissing":true,"hasArrow":true,"isTerminal":true,"targetHash":null} + ] + } + ], + "laneCount": 3, + "recommendedLaneCount": 2, + "hasMissingParents": true, + "currentBranchHashes": ["base","head","left","merged","missing"] + } + }, + { + "name": "expandedMode", + "description": "Expanded mode keeps a 31-row edge as a full lane with no compaction.", + "request": { + "commits": [ + {"hash":"0","parentHashes":["1","31"]}, + {"hash":"1","parentHashes":["2"]}, + {"hash":"2","parentHashes":["3"]}, + {"hash":"3","parentHashes":["4"]}, + {"hash":"4","parentHashes":["5"]}, + {"hash":"5","parentHashes":["6"]}, + {"hash":"6","parentHashes":["7"]}, + {"hash":"7","parentHashes":["8"]}, + {"hash":"8","parentHashes":["9"]}, + {"hash":"9","parentHashes":["10"]}, + {"hash":"10","parentHashes":["11"]}, + {"hash":"11","parentHashes":["12"]}, + {"hash":"12","parentHashes":["13"]}, + {"hash":"13","parentHashes":["14"]}, + {"hash":"14","parentHashes":["15"]}, + {"hash":"15","parentHashes":["16"]}, + {"hash":"16","parentHashes":["17"]}, + {"hash":"17","parentHashes":["18"]}, + {"hash":"18","parentHashes":["19"]}, + {"hash":"19","parentHashes":["20"]}, + {"hash":"20","parentHashes":["21"]}, + {"hash":"21","parentHashes":["22"]}, + {"hash":"22","parentHashes":["23"]}, + {"hash":"23","parentHashes":["24"]}, + {"hash":"24","parentHashes":["25"]}, + {"hash":"25","parentHashes":["26"]}, + {"hash":"26","parentHashes":["27"]}, + {"hash":"27","parentHashes":["28"]}, + {"hash":"28","parentHashes":["29"]}, + {"hash":"29","parentHashes":["30"]}, + {"hash":"30","parentHashes":["31"]}, + {"hash":"31"} + ], + "displayMode": "expanded" + }, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "0", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:1:false","parentHash":"1","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false},{"id":"0:31:false","parentHash":"31","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} + ] + }, + { + "commitHash": "1", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"1:2:false","parentHash":"2","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":false,"targetHash":"31"}, + {"id":"0:1:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"1:2:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"} + ] + }, + { + "commitHash": "2", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"2:3:false","parentHash":"3","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"1:2:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, + {"id":"2:3:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"} + ] + }, + { + "commitHash": "3", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"3:4:false","parentHash":"4","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"2:3:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"}, + {"id":"3:4:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"} + ] + }, + { + "commitHash": "4", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"4:5:false","parentHash":"5","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"3:4:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"}, + {"id":"4:5:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"} + ] + }, + { + "commitHash": "5", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"5:6:false","parentHash":"6","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"4:5:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"}, + {"id":"5:6:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"6"} + ] + }, + { + "commitHash": "6", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"6:7:false","parentHash":"7","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"5:6:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"}, + {"id":"6:7:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"7"} + ] + }, + { + "commitHash": "7", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"7:8:false","parentHash":"8","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"6:7:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"6"}, + {"id":"7:8:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"8"} + ] + }, + { + "commitHash": "8", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"8:9:false","parentHash":"9","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"7:8:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"7"}, + {"id":"8:9:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"9"} + ] + }, + { + "commitHash": "9", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"9:10:false","parentHash":"10","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"8:9:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"8"}, + {"id":"9:10:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"10"} + ] + }, + { + "commitHash": "10", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"10:11:false","parentHash":"11","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"9:10:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"9"}, + {"id":"10:11:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"11"} + ] + }, + { + "commitHash": "11", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"11:12:false","parentHash":"12","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"10:11:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"10"}, + {"id":"11:12:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"12"} + ] + }, + { + "commitHash": "12", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"12:13:false","parentHash":"13","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"11:12:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"11"}, + {"id":"12:13:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"13"} + ] + }, + { + "commitHash": "13", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"13:14:false","parentHash":"14","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"12:13:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"12"}, + {"id":"13:14:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"14"} + ] + }, + { + "commitHash": "14", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"14:15:false","parentHash":"15","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"13:14:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"13"}, + {"id":"14:15:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"15"} + ] + }, + { + "commitHash": "15", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"15:16:false","parentHash":"16","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"14:15:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"14"}, + {"id":"15:16:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"16"} + ] + }, + { + "commitHash": "16", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"16:17:false","parentHash":"17","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"15:16:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"15"}, + {"id":"16:17:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"17"} + ] + }, + { + "commitHash": "17", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"17:18:false","parentHash":"18","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"16:17:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"16"}, + {"id":"17:18:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"18"} + ] + }, + { + "commitHash": "18", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"18:19:false","parentHash":"19","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"17:18:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"17"}, + {"id":"18:19:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"19"} + ] + }, + { + "commitHash": "19", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"19:20:false","parentHash":"20","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"18:19:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"18"}, + {"id":"19:20:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"20"} + ] + }, + { + "commitHash": "20", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"20:21:false","parentHash":"21","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"19:20:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"19"}, + {"id":"20:21:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"21"} + ] + }, + { + "commitHash": "21", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"21:22:false","parentHash":"22","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"20:21:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"20"}, + {"id":"21:22:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"22"} + ] + }, + { + "commitHash": "22", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"22:23:false","parentHash":"23","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"21:22:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"21"}, + {"id":"22:23:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"23"} + ] + }, + { + "commitHash": "23", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"23:24:false","parentHash":"24","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"22:23:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"22"}, + {"id":"23:24:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"24"} + ] + }, + { + "commitHash": "24", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"24:25:false","parentHash":"25","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"23:24:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"23"}, + {"id":"24:25:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"25"} + ] + }, + { + "commitHash": "25", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"25:26:false","parentHash":"26","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"24:25:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"24"}, + {"id":"25:26:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"26"} + ] + }, + { + "commitHash": "26", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"26:27:false","parentHash":"27","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"25:26:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"25"}, + {"id":"26:27:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"27"} + ] + }, + { + "commitHash": "27", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"27:28:false","parentHash":"28","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"26:27:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"26"}, + {"id":"27:28:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"28"} + ] + }, + { + "commitHash": "28", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"28:29:false","parentHash":"29","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"27:28:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"27"}, + {"id":"28:29:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"} + ] + }, + { + "commitHash": "29", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"29:30:false","parentHash":"30","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"28:29:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"28"}, + {"id":"29:30:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} + ] + }, + { + "commitHash": "30", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"30:31:false","parentHash":"31","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":false,"targetHash":"0"}, + {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"29:30:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"}, + {"id":"30:31:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} + ] + }, + { + "commitHash": "31", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"30:31:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} + ] + } + ], + "laneCount": 2, + "recommendedLaneCount": 2, + "hasMissingParents": false, + "currentBranchHashes": [] + } + } + ], + "stability": [{"name":"namedBranchKeepsColorAcrossPagesAndRefresh","branch":"main","expectedColorId":3343801,"steps":[{"case":"pageOne","hash":"m3"},{"case":"pageTwo","hash":"m3"},{"case":"windowAfterRefresh","hash":"m4"}]}], + "invalid": [ + {"name":"missingCommits","request":{}}, + {"name":"unknownField","request":{"commits":[],"extra":true}}, + {"name":"commitWithoutHash","request":{"commits":[{"parentHashes":[]}]}}, + {"name":"badDisplayMode","request":{"commits":[],"displayMode":"wide"}} + ] +} From 2a1eb15c690b438a00b80c74ef3059f286dead7e Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Thu, 5 Nov 2026 07:28:55 -0800 Subject: [PATCH 2/6] =?UTF-8?q?feat(windows):=20#1662=20GIT-18/19=20Window?= =?UTF-8?q?s=20=E6=8F=90=E4=BA=A4=E5=9B=BE=E6=94=B9=E8=B5=B0=20Core=20git.?= =?UTF-8?q?graphProjection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提交图布局、定色、过滤后的虚线拓扑和 missing parents 改为整窗口一次调用 git.graphProjection, 删除 TS 的 DFS/permanent layout/head 排序/按名称哈希定色和 git-graph-filter-projection。 当前分支祖先高亮改用 Core 返回的 currentBranchHashes。颜色 ID 到具体颜色的映射留在 git-graph-colors。 测试替身新增 git-graph-projection-stub(回放共享 fixture),布局/行/主题/表格测试改为断言 fixture 的具体结果。 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --- rust/lithe-core/src/git/graph_tests.rs | 21 + shared/fixtures/git/graph-projection-v1.json | 1871 ++++++++++++++++- .../git/api/git-graph-projection-api.test.ts | 108 + .../git/api/git-graph-projection-api.ts | 168 ++ .../git-commit-table-keyboard-menu.test.tsx | 7 +- .../log/git-commit-table-tag.test.tsx | 7 +- .../log/git-commit-table.filter.test.tsx | 5 + .../log/git-commit-table.navigation.test.tsx | 8 + .../git-commit-table.presentation.test.tsx | 5 + .../log/git-commit-table.toolbar.test.tsx | 5 + .../git/components/log/git-commit-table.tsx | 40 +- .../git/components/log/git-graph-row.test.ts | 84 +- .../log/git-graph-row.theme.test.tsx | 23 +- .../git/components/log/git-graph-row.tsx | 12 +- .../log/git-log-branch-actions.test.tsx | 7 +- .../git/hooks/use-git-graph-layout.test.tsx | 99 + .../git/hooks/use-git-graph-layout.ts | 53 + .../git/hooks/use-git-graph-paint.test.tsx | 14 +- .../git/utils/git-graph-colors.test.ts | 5 +- .../features/git/utils/git-graph-colors.ts | 18 - .../git/utils/git-graph-filter-projection.ts | 130 -- .../git/utils/git-graph-highlights.test.ts | 45 +- .../git/utils/git-graph-highlights.ts | 36 +- .../git/utils/git-graph-layout.test.ts | 624 ------ .../features/git/utils/git-graph-layout.ts | 647 ------ .../utils/git-graph-reference-group.test.ts | 7 +- .../git/utils/git-graph-reference-group.ts | 3 +- .../git/utils/git-log-branch-filter.ts | 2 +- .../git/utils/git-reference-name-compare.ts | 71 + .../git-graph-projection-stub.test.ts | 60 + .../test-utils/git-graph-projection-stub.ts | 252 +++ 31 files changed, 2719 insertions(+), 1718 deletions(-) create mode 100644 windows/tauri/src/features/git/api/git-graph-projection-api.test.ts create mode 100644 windows/tauri/src/features/git/api/git-graph-projection-api.ts create mode 100644 windows/tauri/src/features/git/hooks/use-git-graph-layout.test.tsx create mode 100644 windows/tauri/src/features/git/hooks/use-git-graph-layout.ts delete mode 100644 windows/tauri/src/features/git/utils/git-graph-filter-projection.ts delete mode 100644 windows/tauri/src/features/git/utils/git-graph-layout.test.ts delete mode 100644 windows/tauri/src/features/git/utils/git-graph-layout.ts create mode 100644 windows/tauri/src/features/git/utils/git-reference-name-compare.ts create mode 100644 windows/tauri/src/test-utils/git-graph-projection-stub.test.ts create mode 100644 windows/tauri/src/test-utils/git-graph-projection-stub.ts diff --git a/rust/lithe-core/src/git/graph_tests.rs b/rust/lithe-core/src/git/graph_tests.rs index 1cf2bafb7e..4a10889b5c 100644 --- a/rust/lithe-core/src/git/graph_tests.rs +++ b/rust/lithe-core/src/git/graph_tests.rs @@ -822,6 +822,27 @@ fn current_branch_ancestry_follows_every_merge_parent_and_never_guesses() { assert!(project(&detached, COMPACT).current_branch_hashes.is_empty()); } +#[test] +fn current_branch_ancestry_is_bounded_and_prefers_the_scoped_commit() { + // A cycle in malformed input is walked once. + let mut cyclic = new_request(vec![commit("a", &["b"], "main"), commit("b", &["a"], "")]); + cyclic.current_branch = Some("main".to_string()); + assert_eq!(project(&cyclic, COMPACT).current_branch_hashes, ["a", "b"]); + // The scoped commit wins over a stale duplicate in the repository context, and + // ancestry extends through context-only commits. + let mut scoped = new_request(vec![commit("main", &["new"], "main")]); + scoped.repository_commits = vec![ + commit("main", &["stale"], "main"), + commit("new", &["root"], ""), + commit("root", &[], ""), + ]; + scoped.current_branch = Some("main".to_string()); + assert_eq!( + project(&scoped, COMPACT).current_branch_hashes, + ["main", "new", "root"] + ); +} + // MARK: - scale #[test] diff --git a/shared/fixtures/git/graph-projection-v1.json b/shared/fixtures/git/graph-projection-v1.json index 54d4895812..e288808271 100644 --- a/shared/fixtures/git/graph-projection-v1.json +++ b/shared/fixtures/git/graph-projection-v1.json @@ -1019,10 +1019,10 @@ }, { "name": "compactLongEdge", - "description": "A 31-row edge reaches the 30-row compact limit, so only its two ends are drawn with arrows.", + "description": "A 39-row edge exceeds the 30-row compact limit, so only its two ends are drawn, each with a navigation arrow.", "request": { "commits": [ - {"hash":"0","parentHashes":["1","31"]}, + {"hash":"0","parentHashes":["1","39"]}, {"hash":"1","parentHashes":["2"]}, {"hash":"2","parentHashes":["3"]}, {"hash":"3","parentHashes":["4"]}, @@ -1053,7 +1053,15 @@ {"hash":"28","parentHashes":["29"]}, {"hash":"29","parentHashes":["30"]}, {"hash":"30","parentHashes":["31"]}, - {"hash":"31"} + {"hash":"31","parentHashes":["32"]}, + {"hash":"32","parentHashes":["33"]}, + {"hash":"33","parentHashes":["34"]}, + {"hash":"34","parentHashes":["35"]}, + {"hash":"35","parentHashes":["36"]}, + {"hash":"36","parentHashes":["37"]}, + {"hash":"37","parentHashes":["38"]}, + {"hash":"38","parentHashes":["39"]}, + {"hash":"39"} ] }, "response": { @@ -1066,11 +1074,11 @@ "colorId": 0, "layoutIndex": 1, "incomingLaneColors": [0], - "parentEdges": [{"id":"0:1:false","parentHash":"1","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false},{"id":"0:31:false","parentHash":"31","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "parentEdges": [{"id":"0:1:false","parentHash":"1","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false},{"id":"0:39:false","parentHash":"39","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ {"id":"0:1:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"} ] }, { @@ -1083,8 +1091,8 @@ "parentEdges": [{"id":"1:2:false","parentHash":"2","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":true,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":true,"targetHash":"39"}, {"id":"0:1:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, {"id":"1:2:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"} ] @@ -1474,31 +1482,143 @@ "colorId": 0, "layoutIndex": 1, "incomingLaneColors": [0], - "parentEdges": [{"id":"29:30:false","parentHash":"30","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "parentEdges": [{"id":"29:30:false","parentHash":"30","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ {"id":"28:29:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"28"}, - {"id":"29:30:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} + {"id":"29:30:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} ] }, { "commitHash": "30", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"30:31:false","parentHash":"31","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"29:30:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"}, + {"id":"30:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} + ] + }, + { + "commitHash": "31", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"31:32:false","parentHash":"32","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"30:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"31:32:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"} + ] + }, + { + "commitHash": "32", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"32:33:false","parentHash":"33","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"31:32:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"32:33:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"} + ] + }, + { + "commitHash": "33", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"33:34:false","parentHash":"34","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"32:33:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"33:34:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"} + ] + }, + { + "commitHash": "34", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"34:35:false","parentHash":"35","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"33:34:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"34:35:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"} + ] + }, + { + "commitHash": "35", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"35:36:false","parentHash":"36","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"34:35:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"35:36:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"} + ] + }, + { + "commitHash": "36", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"36:37:false","parentHash":"37","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"35:36:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"36:37:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"} + ] + }, + { + "commitHash": "37", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"37:38:false","parentHash":"38","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"36:37:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"37:38:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "38", "lane": 1, "laneCount": 2, "colorId": 0, "layoutIndex": 1, "incomingLaneColors": [0,0], - "parentEdges": [{"id":"30:31:false","parentHash":"31","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "parentEdges": [{"id":"38:39:false","parentHash":"39","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":true,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, - {"id":"29:30:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"}, - {"id":"30:31:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":true,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"37:38:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"38:39:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"} ] }, { - "commitHash": "31", + "commitHash": "39", "lane": 0, "laneCount": 1, "colorId": 0, @@ -1507,13 +1627,13 @@ "parentEdges": [], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"30:31:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"38:39:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} ] } ], "laneCount": 2, - "recommendedLaneCount": 2, + "recommendedLaneCount": 1, "hasMissingParents": false, "currentBranchHashes": [] } @@ -1587,10 +1707,10 @@ }, { "name": "expandedMode", - "description": "Expanded mode keeps a 31-row edge as a full lane with no compaction.", + "description": "Expanded mode keeps a 39-row edge as a full lane with no compaction.", "request": { "commits": [ - {"hash":"0","parentHashes":["1","31"]}, + {"hash":"0","parentHashes":["1","39"]}, {"hash":"1","parentHashes":["2"]}, {"hash":"2","parentHashes":["3"]}, {"hash":"3","parentHashes":["4"]}, @@ -1621,7 +1741,15 @@ {"hash":"28","parentHashes":["29"]}, {"hash":"29","parentHashes":["30"]}, {"hash":"30","parentHashes":["31"]}, - {"hash":"31"} + {"hash":"31","parentHashes":["32"]}, + {"hash":"32","parentHashes":["33"]}, + {"hash":"33","parentHashes":["34"]}, + {"hash":"34","parentHashes":["35"]}, + {"hash":"35","parentHashes":["36"]}, + {"hash":"36","parentHashes":["37"]}, + {"hash":"37","parentHashes":["38"]}, + {"hash":"38","parentHashes":["39"]}, + {"hash":"39"} ], "displayMode": "expanded" }, @@ -1635,11 +1763,11 @@ "colorId": 0, "layoutIndex": 1, "incomingLaneColors": [0], - "parentEdges": [{"id":"0:1:false","parentHash":"1","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false},{"id":"0:31:false","parentHash":"31","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "parentEdges": [{"id":"0:1:false","parentHash":"1","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false},{"id":"0:39:false","parentHash":"39","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ {"id":"0:1:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"} ] }, { @@ -1652,8 +1780,8 @@ "parentEdges": [{"id":"1:2:false","parentHash":"2","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":false,"targetHash":"39"}, {"id":"0:1:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, {"id":"1:2:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"} ] @@ -1668,8 +1796,8 @@ "parentEdges": [{"id":"2:3:false","parentHash":"3","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"1:2:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, {"id":"2:3:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"} ] @@ -1684,8 +1812,8 @@ "parentEdges": [{"id":"3:4:false","parentHash":"4","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"2:3:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"}, {"id":"3:4:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"} ] @@ -1700,8 +1828,8 @@ "parentEdges": [{"id":"4:5:false","parentHash":"5","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"3:4:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"}, {"id":"4:5:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"} ] @@ -1716,8 +1844,8 @@ "parentEdges": [{"id":"5:6:false","parentHash":"6","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"4:5:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"}, {"id":"5:6:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"6"} ] @@ -1732,8 +1860,8 @@ "parentEdges": [{"id":"6:7:false","parentHash":"7","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"5:6:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"}, {"id":"6:7:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"7"} ] @@ -1748,8 +1876,8 @@ "parentEdges": [{"id":"7:8:false","parentHash":"8","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"6:7:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"6"}, {"id":"7:8:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"8"} ] @@ -1764,8 +1892,8 @@ "parentEdges": [{"id":"8:9:false","parentHash":"9","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"7:8:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"7"}, {"id":"8:9:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"9"} ] @@ -1780,8 +1908,8 @@ "parentEdges": [{"id":"9:10:false","parentHash":"10","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"8:9:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"8"}, {"id":"9:10:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"10"} ] @@ -1796,8 +1924,8 @@ "parentEdges": [{"id":"10:11:false","parentHash":"11","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"9:10:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"9"}, {"id":"10:11:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"11"} ] @@ -1812,8 +1940,8 @@ "parentEdges": [{"id":"11:12:false","parentHash":"12","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"10:11:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"10"}, {"id":"11:12:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"12"} ] @@ -1828,8 +1956,8 @@ "parentEdges": [{"id":"12:13:false","parentHash":"13","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"11:12:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"11"}, {"id":"12:13:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"13"} ] @@ -1844,8 +1972,8 @@ "parentEdges": [{"id":"13:14:false","parentHash":"14","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"12:13:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"12"}, {"id":"13:14:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"14"} ] @@ -1860,8 +1988,8 @@ "parentEdges": [{"id":"14:15:false","parentHash":"15","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"13:14:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"13"}, {"id":"14:15:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"15"} ] @@ -1876,8 +2004,8 @@ "parentEdges": [{"id":"15:16:false","parentHash":"16","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"14:15:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"14"}, {"id":"15:16:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"16"} ] @@ -1892,8 +2020,8 @@ "parentEdges": [{"id":"16:17:false","parentHash":"17","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"15:16:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"15"}, {"id":"16:17:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"17"} ] @@ -1908,8 +2036,8 @@ "parentEdges": [{"id":"17:18:false","parentHash":"18","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"16:17:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"16"}, {"id":"17:18:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"18"} ] @@ -1924,8 +2052,8 @@ "parentEdges": [{"id":"18:19:false","parentHash":"19","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"17:18:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"17"}, {"id":"18:19:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"19"} ] @@ -1940,8 +2068,8 @@ "parentEdges": [{"id":"19:20:false","parentHash":"20","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"18:19:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"18"}, {"id":"19:20:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"20"} ] @@ -1956,8 +2084,8 @@ "parentEdges": [{"id":"20:21:false","parentHash":"21","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"19:20:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"19"}, {"id":"20:21:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"21"} ] @@ -1972,8 +2100,8 @@ "parentEdges": [{"id":"21:22:false","parentHash":"22","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"20:21:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"20"}, {"id":"21:22:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"22"} ] @@ -1988,8 +2116,8 @@ "parentEdges": [{"id":"22:23:false","parentHash":"23","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"21:22:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"21"}, {"id":"22:23:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"23"} ] @@ -2004,8 +2132,8 @@ "parentEdges": [{"id":"23:24:false","parentHash":"24","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"22:23:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"22"}, {"id":"23:24:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"24"} ] @@ -2020,8 +2148,8 @@ "parentEdges": [{"id":"24:25:false","parentHash":"25","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"23:24:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"23"}, {"id":"24:25:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"25"} ] @@ -2036,8 +2164,8 @@ "parentEdges": [{"id":"25:26:false","parentHash":"26","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"24:25:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"24"}, {"id":"25:26:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"26"} ] @@ -2052,8 +2180,8 @@ "parentEdges": [{"id":"26:27:false","parentHash":"27","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"25:26:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"25"}, {"id":"26:27:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"27"} ] @@ -2068,8 +2196,8 @@ "parentEdges": [{"id":"27:28:false","parentHash":"28","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"26:27:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"26"}, {"id":"27:28:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"28"} ] @@ -2084,8 +2212,8 @@ "parentEdges": [{"id":"28:29:false","parentHash":"29","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"27:28:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"27"}, {"id":"28:29:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"} ] @@ -2100,8 +2228,8 @@ "parentEdges": [{"id":"29:30:false","parentHash":"30","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"28:29:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"28"}, {"id":"29:30:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} ] @@ -2113,17 +2241,145 @@ "colorId": 0, "layoutIndex": 1, "incomingLaneColors": [0,0], - "parentEdges": [{"id":"30:31:false","parentHash":"31","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "parentEdges": [{"id":"30:31:false","parentHash":"31","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":false,"targetHash":"0"}, - {"id":"0:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, {"id":"29:30:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"}, - {"id":"30:31:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} + {"id":"30:31:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"} ] }, { "commitHash": "31", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"31:32:false","parentHash":"32","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:31:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"31:32:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"} + ] + }, + { + "commitHash": "32", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"32:33:false","parentHash":"33","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"31:32:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"32:33:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"} + ] + }, + { + "commitHash": "33", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"33:34:false","parentHash":"34","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"32:33:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"33:34:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"} + ] + }, + { + "commitHash": "34", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"34:35:false","parentHash":"35","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"33:34:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"34:35:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"} + ] + }, + { + "commitHash": "35", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"35:36:false","parentHash":"36","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"34:35:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"35:36:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"} + ] + }, + { + "commitHash": "36", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"36:37:false","parentHash":"37","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"35:36:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"36:37:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"} + ] + }, + { + "commitHash": "37", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"37:38:false","parentHash":"38","targetLane":1,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"36:37:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"37:38:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "38", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0,0], + "parentEdges": [{"id":"38:39:false","parentHash":"39","targetLane":0,"colorId":0,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":true,"isTerminal":false,"targetHash":"0"}, + {"id":"0:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"37:38:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"38:39:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"} + ] + }, + { + "commitHash": "39", "lane": 0, "laneCount": 1, "colorId": 0, @@ -2132,8 +2388,8 @@ "parentEdges": [], "labels": [], "printElements": [ - {"id":"0:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, - {"id":"30:31:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} + {"id":"0:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"38:39:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":0,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} ] } ], @@ -2142,6 +2398,1447 @@ "hasMissingParents": false, "currentBranchHashes": [] } + }, + { + "name": "shiftedForks", + "description": "Forks shift columns between rows while every half-edge keeps its identity and color.", + "request": { + "commits": [ + {"hash":"0","parentHashes":["1"],"decorations":"HEAD -> main"}, + {"hash":"1","parentHashes":["3","2"],"decorations":"feature"}, + {"hash":"2","parentHashes":["3","5"]}, + {"hash":"3","parentHashes":["5","4"]}, + {"hash":"4","parentHashes":["5"]}, + {"hash":"5"} + ] + }, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "0", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"0:1:false","parentHash":"1","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}] + }, + { + "commitHash": "1", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"1:2:false","parentHash":"2","targetLane":1,"colorId":3,"isMissing":false,"isDotted":false},{"id":"1:3:false","parentHash":"3","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [{"id":"branch:feature","title":"feature","kind":"branch"}], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"1:2:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"}, + {"id":"1:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"} + ] + }, + { + "commitHash": "2", + "lane": 1, + "laneCount": 2, + "colorId": 3, + "layoutIndex": 3, + "incomingLaneColors": [3343801,3], + "parentEdges": [{"id":"2:3:false","parentHash":"3","targetLane":0,"colorId":3,"isMissing":false,"isDotted":false},{"id":"2:5:false","parentHash":"5","targetLane":1,"colorId":3,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"1:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, + {"id":"1:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"}, + {"id":"1:2:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, + {"id":"2:3:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"}, + {"id":"2:5:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"} + ] + }, + { + "commitHash": "3", + "lane": 0, + "laneCount": 2, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801,3], + "parentEdges": [{"id":"3:4:false","parentHash":"4","targetLane":1,"colorId":2,"isMissing":false,"isDotted":false},{"id":"3:5:false","parentHash":"5","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"1:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, + {"id":"2:3:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"}, + {"id":"3:4:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"}, + {"id":"3:5:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"}, + {"id":"2:5:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"}, + {"id":"2:5:false:down","position":1,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"} + ] + }, + { + "commitHash": "4", + "lane": 1, + "laneCount": 3, + "colorId": 2, + "layoutIndex": 2, + "incomingLaneColors": [3343801,2,3], + "parentEdges": [{"id":"4:5:false","parentHash":"5","targetLane":0,"colorId":2,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"3:5:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"}, + {"id":"3:5:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"}, + {"id":"3:4:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"}, + {"id":"4:5:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"}, + {"id":"2:5:false:up","position":2,"adjacentPosition":1,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"}, + {"id":"2:5:false:down","position":2,"adjacentPosition":0,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"} + ] + }, + { + "commitHash": "5", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"2:5:false:up","position":0,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"}, + {"id":"3:5:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"}, + {"id":"4:5:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"} + ] + } + ], + "laneCount": 3, + "recommendedLaneCount": 3, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "missingParentBesideRoot", + "description": "An unloaded parent has no navigation target and does not connect to an unrelated commit.", + "request": {"commits":[{"hash":"tip","parentHashes":["missing"]},{"hash":"other"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "tip", + "lane": 0, + "laneCount": 1, + "colorId": 0, + "layoutIndex": 1, + "incomingLaneColors": [0], + "parentEdges": [{"id":"0:missing:false","parentHash":"missing","targetLane":0,"colorId":0,"isMissing":true,"isDotted":false}], + "labels": [], + "printElements": [{"id":"0:missing:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null}] + }, + { + "commitHash": "other", + "lane": 1, + "laneCount": 2, + "colorId": 0, + "layoutIndex": 2, + "incomingLaneColors": [0,0], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"0:missing:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":0,"isDotted":false,"isMissing":true,"hasArrow":false,"isTerminal":false,"targetHash":null}, + {"id":"0:missing:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":0,"isDotted":false,"isMissing":true,"hasArrow":true,"isTerminal":true,"targetHash":null} + ] + } + ], + "laneCount": 2, + "recommendedLaneCount": 1, + "hasMissingParents": true, + "currentBranchHashes": [] + } + }, + { + "name": "decoratedChain", + "description": "A linear history whose commits carry unrelated decorations stays in one lane.", + "request": {"commits":[{"hash":"a","parentHashes":["b"],"decorations":"keep-a"},{"hash":"b","parentHashes":["c"]},{"hash":"c","decorations":"keep-c"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "a", + "lane": 0, + "laneCount": 1, + "colorId": -1135254503, + "layoutIndex": 1, + "incomingLaneColors": [-1135254503], + "parentEdges": [{"id":"0:1:false","parentHash":"b","targetLane":0,"colorId":-1135254503,"isMissing":false,"isDotted":false}], + "labels": [{"id":"branch:keep-a","title":"keep-a","kind":"branch"}], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":-1135254503,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"b"}] + }, + { + "commitHash": "b", + "lane": 0, + "laneCount": 1, + "colorId": -1135254503, + "layoutIndex": 1, + "incomingLaneColors": [-1135254503], + "parentEdges": [{"id":"1:2:false","parentHash":"c","targetLane":0,"colorId":-1135254503,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":-1135254503,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"a"}, + {"id":"1:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":-1135254503,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"c"} + ] + }, + { + "commitHash": "c", + "lane": 0, + "laneCount": 1, + "colorId": -1135254503, + "layoutIndex": 1, + "incomingLaneColors": [-1135254503], + "parentEdges": [], + "labels": [{"id":"branch:keep-c","title":"keep-c","kind":"branch"}], + "printElements": [{"id":"1:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":-1135254503,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"b"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "filteredDecoratedChain", + "description": "Filtering out the middle commit of a chain leaves one dotted edge between the matches.", + "request": {"commits":[{"hash":"a","parentHashes":["b"],"decorations":"keep-a"},{"hash":"b","parentHashes":["c"]},{"hash":"c","decorations":"keep-c"}],"visibleHashes":["a","c"]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "a", + "lane": 0, + "laneCount": 1, + "colorId": -1135254503, + "layoutIndex": 1, + "incomingLaneColors": [-1135254503], + "parentEdges": [{"id":"0:1:true","parentHash":"c","targetLane":0,"colorId":-1135254503,"isMissing":false,"isDotted":true}], + "labels": [{"id":"branch:keep-a","title":"keep-a","kind":"branch"}], + "printElements": [{"id":"0:1:true:down","position":0,"adjacentPosition":0,"direction":"down","colorId":-1135254503,"isDotted":true,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"c"}] + }, + { + "commitHash": "c", + "lane": 0, + "laneCount": 1, + "colorId": -1135254503, + "layoutIndex": 1, + "incomingLaneColors": [-1135254503], + "parentEdges": [], + "labels": [{"id":"branch:keep-c","title":"keep-c","kind":"branch"}], + "printElements": [{"id":"0:1:true:up","position":0,"adjacentPosition":0,"direction":"up","colorId":-1135254503,"isDotted":true,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"a"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "singleCommit", + "description": "A lone commit is one node in one lane with no routes.", + "request": {"commits":[{"hash":"tip"}]}, + "response": { + "version": 1, + "rows": [{"commitHash":"tip","lane":0,"laneCount":1,"colorId":0,"layoutIndex":1,"incomingLaneColors":[0],"parentEdges":[],"labels":[],"printElements":[]}], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "headAndRoot", + "description": "The checked-out commit and its root share one lane and one color.", + "request": {"commits":[{"hash":"head","parentHashes":["root"],"decorations":"HEAD -> main"},{"hash":"root"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "head", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"0:1:false","parentHash":"root","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}] + }, + { + "commitHash": "root", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"head"}] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "decoratedTip", + "description": "HEAD, local, remote, and tag decorations on one commit become four typed labels.", + "request": {"commits":[{"hash":"tip","decorations":"HEAD -> master, origin/master, tag: v1.0.0"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "tip", + "lane": 0, + "laneCount": 1, + "colorId": 468329835, + "layoutIndex": 1, + "incomingLaneColors": [468329835], + "parentEdges": [], + "labels": [ + {"id":"head:HEAD","title":"HEAD","kind":"head"}, + {"id":"branch:master","title":"master","kind":"branch"}, + {"id":"remote:origin/master","title":"origin/master","kind":"remote"}, + {"id":"tag:v1.0.0","title":"v1.0.0","kind":"tag"} + ], + "printElements": [] + } + ], + "laneCount": 1, + "recommendedLaneCount": 1, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "namedMergeEndpoint", + "description": "Two named lanes meet at the merge base and keep separate colors up to the node.", + "request": {"commits":[{"hash":"merge","parentHashes":["main","side"],"decorations":"HEAD -> main"},{"hash":"main","parentHashes":["root"]},{"hash":"side","parentHashes":["root"],"decorations":"feature"},{"hash":"root"}]}, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "merge", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"0:1:false","parentHash":"main","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false},{"id":"0:2:false","parentHash":"side","targetLane":1,"colorId":2,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [ + {"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"main"}, + {"id":"0:2:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"side"} + ] + }, + { + "commitHash": "main", + "lane": 0, + "laneCount": 2, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801,2], + "parentEdges": [{"id":"1:3:false","parentHash":"root","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"merge"}, + {"id":"1:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"0:2:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"merge"}, + {"id":"0:2:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"side"} + ] + }, + { + "commitHash": "side", + "lane": 1, + "laneCount": 2, + "colorId": 2, + "layoutIndex": 2, + "incomingLaneColors": [3343801,2], + "parentEdges": [{"id":"2:3:false","parentHash":"root","targetLane":0,"colorId":2,"isMissing":false,"isDotted":false}], + "labels": [{"id":"branch:feature","title":"feature","kind":"branch"}], + "printElements": [ + {"id":"1:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"main"}, + {"id":"1:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"}, + {"id":"0:2:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"merge"}, + {"id":"2:3:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"root"} + ] + }, + { + "commitHash": "root", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [], + "labels": [], + "printElements": [ + {"id":"1:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"main"}, + {"id":"2:3:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"side"} + ] + } + ], + "laneCount": 2, + "recommendedLaneCount": 2, + "hasMissingParents": false, + "currentBranchHashes": [] + } + }, + { + "name": "wideMerge", + "description": "An eight-parent merge widens its own rows while rows outside the cluster stay narrow.", + "request": { + "commits": [ + {"hash":"0","parentHashes":["1"],"decorations":"HEAD -> main"}, + {"hash":"1","parentHashes":["2"]}, + {"hash":"2","parentHashes":["3"]}, + {"hash":"3","parentHashes":["4"]}, + {"hash":"4","parentHashes":["5"]}, + {"hash":"5","parentHashes":["6"]}, + {"hash":"6","parentHashes":["7"]}, + {"hash":"7","parentHashes":["8"]}, + {"hash":"8","parentHashes":["9"]}, + {"hash":"9","parentHashes":["10"]}, + {"hash":"10","parentHashes":["11"]}, + {"hash":"11","parentHashes":["12"]}, + {"hash":"12","parentHashes":["13"]}, + {"hash":"13","parentHashes":["14"]}, + {"hash":"14","parentHashes":["15"]}, + {"hash":"15","parentHashes":["16"]}, + {"hash":"16","parentHashes":["17"]}, + {"hash":"17","parentHashes":["18"]}, + {"hash":"18","parentHashes":["19"]}, + {"hash":"19","parentHashes":["20"]}, + {"hash":"20","parentHashes":["21"]}, + {"hash":"21","parentHashes":["22"]}, + {"hash":"22","parentHashes":["23"]}, + {"hash":"23","parentHashes":["24"]}, + {"hash":"24","parentHashes":["25"]}, + {"hash":"25","parentHashes":["26"]}, + {"hash":"26","parentHashes":["27"]}, + {"hash":"27","parentHashes":["28"]}, + {"hash":"28","parentHashes":["29"]}, + {"hash":"29","parentHashes":["30"]}, + {"hash":"30","parentHashes":["31","32","33","34","35","36","37","38"]}, + {"hash":"31","parentHashes":["39"]}, + {"hash":"32","parentHashes":["39"]}, + {"hash":"33","parentHashes":["39"]}, + {"hash":"34","parentHashes":["39"]}, + {"hash":"35","parentHashes":["39"]}, + {"hash":"36","parentHashes":["39"]}, + {"hash":"37","parentHashes":["39"]}, + {"hash":"38","parentHashes":["39"]}, + {"hash":"39","parentHashes":["40"]}, + {"hash":"40","parentHashes":["41"]}, + {"hash":"41","parentHashes":["42"]}, + {"hash":"42","parentHashes":["43"]}, + {"hash":"43","parentHashes":["44"]}, + {"hash":"44","parentHashes":["45"]}, + {"hash":"45","parentHashes":["46"]}, + {"hash":"46","parentHashes":["47"]}, + {"hash":"47","parentHashes":["48"]}, + {"hash":"48","parentHashes":["49"]}, + {"hash":"49","parentHashes":["50"]}, + {"hash":"50","parentHashes":["51"]}, + {"hash":"51","parentHashes":["52"]}, + {"hash":"52","parentHashes":["53"]}, + {"hash":"53","parentHashes":["54"]}, + {"hash":"54","parentHashes":["55"]}, + {"hash":"55","parentHashes":["56"]}, + {"hash":"56","parentHashes":["57"]}, + {"hash":"57","parentHashes":["58"]}, + {"hash":"58","parentHashes":["59"]}, + {"hash":"59"} + ] + }, + "response": { + "version": 1, + "rows": [ + { + "commitHash": "0", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"0:1:false","parentHash":"1","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [{"id":"head:HEAD","title":"HEAD","kind":"head"},{"id":"branch:main","title":"main","kind":"branch"}], + "printElements": [{"id":"0:1:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}] + }, + { + "commitHash": "1", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"1:2:false","parentHash":"2","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"0:1:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"0"}, + {"id":"1:2:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"} + ] + }, + { + "commitHash": "2", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"2:3:false","parentHash":"3","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"1:2:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"1"}, + {"id":"2:3:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"} + ] + }, + { + "commitHash": "3", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"3:4:false","parentHash":"4","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"2:3:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"2"}, + {"id":"3:4:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"} + ] + }, + { + "commitHash": "4", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"4:5:false","parentHash":"5","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"3:4:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"3"}, + {"id":"4:5:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"} + ] + }, + { + "commitHash": "5", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"5:6:false","parentHash":"6","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"4:5:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"4"}, + {"id":"5:6:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"6"} + ] + }, + { + "commitHash": "6", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"6:7:false","parentHash":"7","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"5:6:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"5"}, + {"id":"6:7:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"7"} + ] + }, + { + "commitHash": "7", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"7:8:false","parentHash":"8","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"6:7:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"6"}, + {"id":"7:8:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"8"} + ] + }, + { + "commitHash": "8", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"8:9:false","parentHash":"9","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"7:8:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"7"}, + {"id":"8:9:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"9"} + ] + }, + { + "commitHash": "9", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"9:10:false","parentHash":"10","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"8:9:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"8"}, + {"id":"9:10:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"10"} + ] + }, + { + "commitHash": "10", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"10:11:false","parentHash":"11","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"9:10:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"9"}, + {"id":"10:11:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"11"} + ] + }, + { + "commitHash": "11", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"11:12:false","parentHash":"12","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"10:11:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"10"}, + {"id":"11:12:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"12"} + ] + }, + { + "commitHash": "12", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"12:13:false","parentHash":"13","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"11:12:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"11"}, + {"id":"12:13:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"13"} + ] + }, + { + "commitHash": "13", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"13:14:false","parentHash":"14","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"12:13:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"12"}, + {"id":"13:14:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"14"} + ] + }, + { + "commitHash": "14", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"14:15:false","parentHash":"15","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"13:14:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"13"}, + {"id":"14:15:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"15"} + ] + }, + { + "commitHash": "15", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"15:16:false","parentHash":"16","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"14:15:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"14"}, + {"id":"15:16:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"16"} + ] + }, + { + "commitHash": "16", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"16:17:false","parentHash":"17","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"15:16:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"15"}, + {"id":"16:17:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"17"} + ] + }, + { + "commitHash": "17", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"17:18:false","parentHash":"18","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"16:17:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"16"}, + {"id":"17:18:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"18"} + ] + }, + { + "commitHash": "18", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"18:19:false","parentHash":"19","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"17:18:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"17"}, + {"id":"18:19:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"19"} + ] + }, + { + "commitHash": "19", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"19:20:false","parentHash":"20","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"18:19:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"18"}, + {"id":"19:20:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"20"} + ] + }, + { + "commitHash": "20", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"20:21:false","parentHash":"21","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"19:20:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"19"}, + {"id":"20:21:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"21"} + ] + }, + { + "commitHash": "21", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"21:22:false","parentHash":"22","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"20:21:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"20"}, + {"id":"21:22:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"22"} + ] + }, + { + "commitHash": "22", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"22:23:false","parentHash":"23","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"21:22:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"21"}, + {"id":"22:23:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"23"} + ] + }, + { + "commitHash": "23", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"23:24:false","parentHash":"24","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"22:23:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"22"}, + {"id":"23:24:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"24"} + ] + }, + { + "commitHash": "24", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"24:25:false","parentHash":"25","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"23:24:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"23"}, + {"id":"24:25:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"25"} + ] + }, + { + "commitHash": "25", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"25:26:false","parentHash":"26","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"24:25:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"24"}, + {"id":"25:26:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"26"} + ] + }, + { + "commitHash": "26", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"26:27:false","parentHash":"27","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"25:26:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"25"}, + {"id":"26:27:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"27"} + ] + }, + { + "commitHash": "27", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"27:28:false","parentHash":"28","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"26:27:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"26"}, + {"id":"27:28:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"28"} + ] + }, + { + "commitHash": "28", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"28:29:false","parentHash":"29","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"27:28:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"27"}, + {"id":"28:29:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"} + ] + }, + { + "commitHash": "29", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"29:30:false","parentHash":"30","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"28:29:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"28"}, + {"id":"29:30:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"} + ] + }, + { + "commitHash": "30", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [ + {"id":"30:31:false","parentHash":"31","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}, + {"id":"30:32:false","parentHash":"32","targetLane":1,"colorId":2,"isMissing":false,"isDotted":false}, + {"id":"30:33:false","parentHash":"33","targetLane":2,"colorId":3,"isMissing":false,"isDotted":false}, + {"id":"30:34:false","parentHash":"34","targetLane":3,"colorId":4,"isMissing":false,"isDotted":false}, + {"id":"30:35:false","parentHash":"35","targetLane":4,"colorId":5,"isMissing":false,"isDotted":false}, + {"id":"30:36:false","parentHash":"36","targetLane":5,"colorId":6,"isMissing":false,"isDotted":false}, + {"id":"30:37:false","parentHash":"37","targetLane":6,"colorId":7,"isMissing":false,"isDotted":false}, + {"id":"30:38:false","parentHash":"38","targetLane":7,"colorId":8,"isMissing":false,"isDotted":false} + ], + "labels": [], + "printElements": [ + {"id":"29:30:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"29"}, + {"id":"30:31:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"30:32:false:down","position":0,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"30:33:false:down","position":0,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"30:34:false:down","position":0,"adjacentPosition":3,"direction":"down","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"30:35:false:down","position":0,"adjacentPosition":4,"direction":"down","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"30:36:false:down","position":0,"adjacentPosition":5,"direction":"down","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"30:37:false:down","position":0,"adjacentPosition":6,"direction":"down","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"30:38:false:down","position":0,"adjacentPosition":7,"direction":"down","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "31", + "lane": 0, + "laneCount": 8, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801,2,3,4,5,6,7,8], + "parentEdges": [{"id":"31:39:false","parentHash":"39","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"30:31:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"31:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:32:false:up","position":1,"adjacentPosition":0,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:32:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"30:33:false:up","position":2,"adjacentPosition":0,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:33:false:down","position":2,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"30:34:false:up","position":3,"adjacentPosition":0,"direction":"up","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:34:false:down","position":3,"adjacentPosition":3,"direction":"down","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"30:35:false:up","position":4,"adjacentPosition":0,"direction":"up","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:35:false:down","position":4,"adjacentPosition":4,"direction":"down","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"30:36:false:up","position":5,"adjacentPosition":0,"direction":"up","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:36:false:down","position":5,"adjacentPosition":5,"direction":"down","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"30:37:false:up","position":6,"adjacentPosition":0,"direction":"up","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:37:false:down","position":6,"adjacentPosition":6,"direction":"down","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"30:38:false:up","position":7,"adjacentPosition":0,"direction":"up","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:38:false:down","position":7,"adjacentPosition":7,"direction":"down","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "32", + "lane": 1, + "laneCount": 8, + "colorId": 2, + "layoutIndex": 2, + "incomingLaneColors": [3343801,2,3,4,5,6,7,8], + "parentEdges": [{"id":"32:39:false","parentHash":"39","targetLane":1,"colorId":2,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"31:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"31:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:32:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"32:39:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:33:false:up","position":2,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:33:false:down","position":2,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"30:34:false:up","position":3,"adjacentPosition":3,"direction":"up","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:34:false:down","position":3,"adjacentPosition":3,"direction":"down","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"30:35:false:up","position":4,"adjacentPosition":4,"direction":"up","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:35:false:down","position":4,"adjacentPosition":4,"direction":"down","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"30:36:false:up","position":5,"adjacentPosition":5,"direction":"up","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:36:false:down","position":5,"adjacentPosition":5,"direction":"down","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"30:37:false:up","position":6,"adjacentPosition":6,"direction":"up","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:37:false:down","position":6,"adjacentPosition":6,"direction":"down","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"30:38:false:up","position":7,"adjacentPosition":7,"direction":"up","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:38:false:down","position":7,"adjacentPosition":7,"direction":"down","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "33", + "lane": 2, + "laneCount": 8, + "colorId": 3, + "layoutIndex": 3, + "incomingLaneColors": [3343801,2,3,4,5,6,7,8], + "parentEdges": [{"id":"33:39:false","parentHash":"39","targetLane":2,"colorId":3,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"31:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"31:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"32:39:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"32:39:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:33:false:up","position":2,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"33:39:false:down","position":2,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:34:false:up","position":3,"adjacentPosition":3,"direction":"up","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:34:false:down","position":3,"adjacentPosition":3,"direction":"down","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"30:35:false:up","position":4,"adjacentPosition":4,"direction":"up","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:35:false:down","position":4,"adjacentPosition":4,"direction":"down","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"30:36:false:up","position":5,"adjacentPosition":5,"direction":"up","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:36:false:down","position":5,"adjacentPosition":5,"direction":"down","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"30:37:false:up","position":6,"adjacentPosition":6,"direction":"up","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:37:false:down","position":6,"adjacentPosition":6,"direction":"down","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"30:38:false:up","position":7,"adjacentPosition":7,"direction":"up","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:38:false:down","position":7,"adjacentPosition":7,"direction":"down","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "34", + "lane": 3, + "laneCount": 8, + "colorId": 4, + "layoutIndex": 4, + "incomingLaneColors": [3343801,2,3,4,5,6,7,8], + "parentEdges": [{"id":"34:39:false","parentHash":"39","targetLane":3,"colorId":4,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"31:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"31:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"32:39:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"32:39:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"33:39:false:up","position":2,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"33:39:false:down","position":2,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:34:false:up","position":3,"adjacentPosition":3,"direction":"up","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"34:39:false:down","position":3,"adjacentPosition":3,"direction":"down","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:35:false:up","position":4,"adjacentPosition":4,"direction":"up","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:35:false:down","position":4,"adjacentPosition":4,"direction":"down","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"30:36:false:up","position":5,"adjacentPosition":5,"direction":"up","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:36:false:down","position":5,"adjacentPosition":5,"direction":"down","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"30:37:false:up","position":6,"adjacentPosition":6,"direction":"up","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:37:false:down","position":6,"adjacentPosition":6,"direction":"down","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"30:38:false:up","position":7,"adjacentPosition":7,"direction":"up","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:38:false:down","position":7,"adjacentPosition":7,"direction":"down","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "35", + "lane": 4, + "laneCount": 8, + "colorId": 5, + "layoutIndex": 5, + "incomingLaneColors": [3343801,2,3,4,5,6,7,8], + "parentEdges": [{"id":"35:39:false","parentHash":"39","targetLane":4,"colorId":5,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"31:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"31:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"32:39:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"32:39:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"33:39:false:up","position":2,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"33:39:false:down","position":2,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"34:39:false:up","position":3,"adjacentPosition":3,"direction":"up","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"34:39:false:down","position":3,"adjacentPosition":3,"direction":"down","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:35:false:up","position":4,"adjacentPosition":4,"direction":"up","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"35:39:false:down","position":4,"adjacentPosition":4,"direction":"down","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:36:false:up","position":5,"adjacentPosition":5,"direction":"up","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:36:false:down","position":5,"adjacentPosition":5,"direction":"down","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"30:37:false:up","position":6,"adjacentPosition":6,"direction":"up","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:37:false:down","position":6,"adjacentPosition":6,"direction":"down","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"30:38:false:up","position":7,"adjacentPosition":7,"direction":"up","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:38:false:down","position":7,"adjacentPosition":7,"direction":"down","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "36", + "lane": 5, + "laneCount": 8, + "colorId": 6, + "layoutIndex": 6, + "incomingLaneColors": [3343801,2,3,4,5,6,7,8], + "parentEdges": [{"id":"36:39:false","parentHash":"39","targetLane":5,"colorId":6,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"31:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"31:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"32:39:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"32:39:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"33:39:false:up","position":2,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"33:39:false:down","position":2,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"34:39:false:up","position":3,"adjacentPosition":3,"direction":"up","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"34:39:false:down","position":3,"adjacentPosition":3,"direction":"down","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"35:39:false:up","position":4,"adjacentPosition":4,"direction":"up","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"35:39:false:down","position":4,"adjacentPosition":4,"direction":"down","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:36:false:up","position":5,"adjacentPosition":5,"direction":"up","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"36:39:false:down","position":5,"adjacentPosition":5,"direction":"down","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:37:false:up","position":6,"adjacentPosition":6,"direction":"up","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:37:false:down","position":6,"adjacentPosition":6,"direction":"down","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"30:38:false:up","position":7,"adjacentPosition":7,"direction":"up","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:38:false:down","position":7,"adjacentPosition":7,"direction":"down","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "37", + "lane": 6, + "laneCount": 8, + "colorId": 7, + "layoutIndex": 7, + "incomingLaneColors": [3343801,2,3,4,5,6,7,8], + "parentEdges": [{"id":"37:39:false","parentHash":"39","targetLane":6,"colorId":7,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"31:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"31:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"32:39:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"32:39:false:down","position":1,"adjacentPosition":1,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"33:39:false:up","position":2,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"33:39:false:down","position":2,"adjacentPosition":2,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"34:39:false:up","position":3,"adjacentPosition":3,"direction":"up","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"34:39:false:down","position":3,"adjacentPosition":3,"direction":"down","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"35:39:false:up","position":4,"adjacentPosition":4,"direction":"up","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"35:39:false:down","position":4,"adjacentPosition":4,"direction":"down","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"36:39:false:up","position":5,"adjacentPosition":5,"direction":"up","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"36:39:false:down","position":5,"adjacentPosition":5,"direction":"down","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:37:false:up","position":6,"adjacentPosition":6,"direction":"up","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"37:39:false:down","position":6,"adjacentPosition":6,"direction":"down","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:38:false:up","position":7,"adjacentPosition":7,"direction":"up","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"30:38:false:down","position":7,"adjacentPosition":7,"direction":"down","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"} + ] + }, + { + "commitHash": "38", + "lane": 7, + "laneCount": 8, + "colorId": 8, + "layoutIndex": 8, + "incomingLaneColors": [3343801,2,3,4,5,6,7,8], + "parentEdges": [{"id":"38:39:false","parentHash":"39","targetLane":0,"colorId":8,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"31:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"31:39:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"32:39:false:up","position":1,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"32:39:false:down","position":1,"adjacentPosition":0,"direction":"down","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"33:39:false:up","position":2,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"33:39:false:down","position":2,"adjacentPosition":0,"direction":"down","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"34:39:false:up","position":3,"adjacentPosition":3,"direction":"up","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"34:39:false:down","position":3,"adjacentPosition":0,"direction":"down","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"35:39:false:up","position":4,"adjacentPosition":4,"direction":"up","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"35:39:false:down","position":4,"adjacentPosition":0,"direction":"down","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"36:39:false:up","position":5,"adjacentPosition":5,"direction":"up","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"36:39:false:down","position":5,"adjacentPosition":0,"direction":"down","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"37:39:false:up","position":6,"adjacentPosition":6,"direction":"up","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"37:39:false:down","position":6,"adjacentPosition":0,"direction":"down","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"30:38:false:up","position":7,"adjacentPosition":7,"direction":"up","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"30"}, + {"id":"38:39:false:down","position":7,"adjacentPosition":0,"direction":"down","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"} + ] + }, + { + "commitHash": "39", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"39:40:false","parentHash":"40","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"31:39:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"31"}, + {"id":"32:39:false:up","position":0,"adjacentPosition":1,"direction":"up","colorId":2,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"32"}, + {"id":"33:39:false:up","position":0,"adjacentPosition":2,"direction":"up","colorId":3,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"33"}, + {"id":"34:39:false:up","position":0,"adjacentPosition":3,"direction":"up","colorId":4,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"34"}, + {"id":"35:39:false:up","position":0,"adjacentPosition":4,"direction":"up","colorId":5,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"35"}, + {"id":"36:39:false:up","position":0,"adjacentPosition":5,"direction":"up","colorId":6,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"36"}, + {"id":"37:39:false:up","position":0,"adjacentPosition":6,"direction":"up","colorId":7,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"37"}, + {"id":"38:39:false:up","position":0,"adjacentPosition":7,"direction":"up","colorId":8,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"38"}, + {"id":"39:40:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"40"} + ] + }, + { + "commitHash": "40", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"40:41:false","parentHash":"41","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"39:40:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"39"}, + {"id":"40:41:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"41"} + ] + }, + { + "commitHash": "41", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"41:42:false","parentHash":"42","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"40:41:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"40"}, + {"id":"41:42:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"42"} + ] + }, + { + "commitHash": "42", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"42:43:false","parentHash":"43","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"41:42:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"41"}, + {"id":"42:43:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"43"} + ] + }, + { + "commitHash": "43", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"43:44:false","parentHash":"44","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"42:43:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"42"}, + {"id":"43:44:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"44"} + ] + }, + { + "commitHash": "44", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"44:45:false","parentHash":"45","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"43:44:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"43"}, + {"id":"44:45:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"45"} + ] + }, + { + "commitHash": "45", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"45:46:false","parentHash":"46","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"44:45:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"44"}, + {"id":"45:46:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"46"} + ] + }, + { + "commitHash": "46", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"46:47:false","parentHash":"47","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"45:46:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"45"}, + {"id":"46:47:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"47"} + ] + }, + { + "commitHash": "47", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"47:48:false","parentHash":"48","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"46:47:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"46"}, + {"id":"47:48:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"48"} + ] + }, + { + "commitHash": "48", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"48:49:false","parentHash":"49","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"47:48:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"47"}, + {"id":"48:49:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"49"} + ] + }, + { + "commitHash": "49", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"49:50:false","parentHash":"50","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"48:49:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"48"}, + {"id":"49:50:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"50"} + ] + }, + { + "commitHash": "50", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"50:51:false","parentHash":"51","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"49:50:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"49"}, + {"id":"50:51:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"51"} + ] + }, + { + "commitHash": "51", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"51:52:false","parentHash":"52","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"50:51:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"50"}, + {"id":"51:52:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"52"} + ] + }, + { + "commitHash": "52", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"52:53:false","parentHash":"53","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"51:52:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"51"}, + {"id":"52:53:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"53"} + ] + }, + { + "commitHash": "53", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"53:54:false","parentHash":"54","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"52:53:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"52"}, + {"id":"53:54:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"54"} + ] + }, + { + "commitHash": "54", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"54:55:false","parentHash":"55","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"53:54:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"53"}, + {"id":"54:55:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"55"} + ] + }, + { + "commitHash": "55", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"55:56:false","parentHash":"56","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"54:55:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"54"}, + {"id":"55:56:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"56"} + ] + }, + { + "commitHash": "56", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"56:57:false","parentHash":"57","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"55:56:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"55"}, + {"id":"56:57:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"57"} + ] + }, + { + "commitHash": "57", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"57:58:false","parentHash":"58","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"56:57:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"56"}, + {"id":"57:58:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"58"} + ] + }, + { + "commitHash": "58", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [{"id":"58:59:false","parentHash":"59","targetLane":0,"colorId":3343801,"isMissing":false,"isDotted":false}], + "labels": [], + "printElements": [ + {"id":"57:58:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"57"}, + {"id":"58:59:false:down","position":0,"adjacentPosition":0,"direction":"down","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"59"} + ] + }, + { + "commitHash": "59", + "lane": 0, + "laneCount": 1, + "colorId": 3343801, + "layoutIndex": 1, + "incomingLaneColors": [3343801], + "parentEdges": [], + "labels": [], + "printElements": [{"id":"58:59:false:up","position":0,"adjacentPosition":0,"direction":"up","colorId":3343801,"isDotted":false,"isMissing":false,"hasArrow":false,"isTerminal":false,"targetHash":"58"}] + } + ], + "laneCount": 8, + "recommendedLaneCount": 4, + "hasMissingParents": false, + "currentBranchHashes": [] + } } ], "stability": [{"name":"namedBranchKeepsColorAcrossPagesAndRefresh","branch":"main","expectedColorId":3343801,"steps":[{"case":"pageOne","hash":"m3"},{"case":"pageTwo","hash":"m3"},{"case":"windowAfterRefresh","hash":"m4"}]}], diff --git a/windows/tauri/src/features/git/api/git-graph-projection-api.test.ts b/windows/tauri/src/features/git/api/git-graph-projection-api.test.ts new file mode 100644 index 0000000000..ad377aef9e --- /dev/null +++ b/windows/tauri/src/features/git/api/git-graph-projection-api.test.ts @@ -0,0 +1,108 @@ +import { afterEach, beforeEach, expect, spyOn, test } from "bun:test"; +import * as native from "@/platform/tauri-core"; +import fixture from "../../../../../../shared/fixtures/git/graph-projection-v1.json"; +import { + graphFixtureCommits, + installGitGraphProjectionStub, + normalizeGraphRequest, +} from "@/test-utils/git-graph-projection-stub"; +import type { GitReference } from "../types/git.types"; +import { buildGitGraphRequest, layoutGitGraph } from "./git-graph-projection-api"; + +const cases = fixture.cases as unknown as Array<{ + name: string; + request: Record<string, any>; + response: { rows: Array<{ commitHash: string }>; currentBranchHashes: string[] }; +}>; +let spy: ReturnType<typeof installGitGraphProjectionStub>; + +beforeEach(() => { + spy = installGitGraphProjectionStub(); +}); +afterEach(() => spy.mockRestore()); + +const remote = (shortName: string): GitReference => ({ + fullName: `refs/remotes/${shortName}`, + shortName, + kind: "remote", + isCurrent: false, + peelsToCommit: true, +}); + +/** The host-side inputs a fixture case stands for. */ +function inputsOf(request: Record<string, any>) { + const normalized = normalizeGraphRequest(request); + const asCommit = (commit: (typeof normalized.commits)[number]) => ({ + ...commit, + shortHash: commit.hash, + message: commit.hash, + author: "Fixture", + date: "unknown", + }); + return { + commits: normalized.commits.map(asCommit), + visibleHashes: normalized.visibleHashes ?? undefined, + options: { + references: normalized.remoteNames.map(remote), + repositoryCommits: normalized.repositoryCommits.map(asCommit), + displayMode: normalized.displayMode as "compact" | "expanded", + currentBranch: normalized.currentBranch ?? undefined, + }, + }; +} + +test("the request built from host inputs is the fixture request for every case", () => { + for (const testCase of cases) { + const { commits, visibleHashes, options } = inputsOf(testCase.request); + expect( + normalizeGraphRequest(buildGitGraphRequest(commits, visibleHashes, options)), + testCase.name, + ).toEqual(normalizeGraphRequest(testCase.request)); + } +}); + +test("rows carry Core's projection and the caller's first commit for each hash", async () => { + for (const testCase of cases) { + const { commits, visibleHashes, options } = inputsOf(testCase.request); + const layout = await layoutGitGraph(commits, visibleHashes, options); + expect(layout.rows.map((row) => row.commitHash), testCase.name).toEqual( + testCase.response.rows.map((row) => row.commitHash), + ); + for (const row of layout.rows) { + expect(row.commit).toBe(commits.find((commit) => commit.hash === row.commitHash)!); + } + expect([...layout.currentBranchHashes].sort()).toEqual(testCase.response.currentBranchHashes); + } +}); + +test("a window is projected in one call, never once per commit", async () => { + const commits = graphFixtureCommits("compactLongEdge"); + expect(commits.length).toBeGreaterThan(30); + const layout = await layoutGitGraph(commits); + expect(layout.rows).toHaveLength(commits.length); + expect(spy.mock.calls.filter(([command]) => command === "git.graphProjection")).toHaveLength(1); +}); + +test("an empty window skips Core", async () => { + const layout = await layoutGitGraph([]); + expect(layout.rows).toEqual([]); + expect(spy.mock.calls).toHaveLength(0); +}); + +test("an unknown commit in Core's answer is an error, not a fabricated row", async () => { + spy.mockRestore(); + const invoke = spyOn(native, "invoke").mockImplementation((async () => ({ + version: 1, + rows: [{ commitHash: "ghost" }], + laneCount: 1, + recommendedLaneCount: 1, + hasMissingParents: false, + currentBranchHashes: [], + })) as unknown as typeof native.invoke); + try { + await expect(layoutGitGraph(graphFixtureCommits("linearHistory"))).rejects.toThrow("ghost"); + } finally { + invoke.mockRestore(); + spy = installGitGraphProjectionStub(); + } +}); diff --git a/windows/tauri/src/features/git/api/git-graph-projection-api.ts b/windows/tauri/src/features/git/api/git-graph-projection-api.ts new file mode 100644 index 0000000000..4bcbeb937a --- /dev/null +++ b/windows/tauri/src/features/git/api/git-graph-projection-api.ts @@ -0,0 +1,168 @@ +import { invoke as tauriInvoke } from "@/platform/tauri-core"; +import type { GitCommit, GitReference } from "../types/git.types"; + +// Note: shared/fixtures/git/graph-projection-v1.json defines every rule of +// `git.graphProjection`. Core owns lanes, colors, routes, and labels; this module +// only builds the request and attaches the loaded commits to the returned rows. + +export type GitGraphLabelKind = "head" | "branch" | "remote" | "tag"; + +export interface GitGraphLabel { + id: string; + title: string; + kind: GitGraphLabelKind; +} + +export interface GitGraphParentEdge { + id: string; + parentHash: string; + /** Lane in the next row; `null` at the last row. */ + targetLane: number | null; + /** Signed IDEA color ID, not a palette slot or screen lane. */ + colorId: number; + isMissing: boolean; + /** A visible ancestor reached through one or more filtered-out commits. */ + isDotted: boolean; +} + +export interface GitGraphPrintElement { + id: string; + position: number; + adjacentPosition: number; + direction: "up" | "down"; + colorId: number; + isDotted: boolean; + isMissing: boolean; + /** Compact long edges and unloaded parents end with a directional marker. */ + hasArrow: boolean; + isTerminal: boolean; + /** Loaded visible endpoint; missing history never invents a navigation target. */ + targetHash: string | null; +} + +/** One visible commit as Core projects it. */ +export interface GitGraphProjectionRow { + commitHash: string; + lane: number; + laneCount: number; + /** Color ID of the node and its own lane. */ + colorId: number; + layoutIndex: number; + incomingLaneColors: number[]; + parentEdges: GitGraphParentEdge[]; + labels: GitGraphLabel[]; + /** Explicit half-edges retain identity, geometry and color for every graph row. */ + printElements: GitGraphPrintElement[]; +} + +export interface GitGraphProjection { + version: number; + rows: GitGraphProjectionRow[]; + laneCount: number; + /** IDEA's weighted visible-edge width; a baseline, not the widest row. */ + recommendedLaneCount: number; + hasMissingParents: boolean; + currentBranchHashes: string[]; +} + +export type GitGraphDisplayMode = "compact" | "expanded"; + +export interface GitGraphProjectionRequest { + commits: Pick<GitCommit, "hash" | "parentHashes" | "decorations">[]; + remoteNames?: string[]; + repositoryCommits?: Pick<GitCommit, "hash" | "parentHashes" | "decorations">[]; + visibleHashes?: string[]; + displayMode?: GitGraphDisplayMode; + currentBranch?: string; +} + +export interface GitGraphRow extends GitGraphProjectionRow { + commit: GitCommit; +} + +export interface GitGraphLayout { + rows: GitGraphRow[]; + laneCount: number; + recommendedLaneCount: number; + hasMissingParents: boolean; + /** Ancestry of the current branch, for the table's background highlight. */ + currentBranchHashes: ReadonlySet<string>; +} + +export interface GitGraphLayoutOptions { + references?: readonly GitReference[]; + repositoryCommits?: readonly GitCommit[]; + displayMode?: GitGraphDisplayMode; + /** Ask Core for this local branch's ancestry (`currentBranchHashes`). */ + currentBranch?: string; +} + +export const EMPTY_GIT_GRAPH_LAYOUT: GitGraphLayout = { + rows: [], + laneCount: 0, + recommendedLaneCount: 0, + hasMissingParents: false, + currentBranchHashes: new Set(), +}; + +const identity = (commit: GitCommit) => ({ + hash: commit.hash, + parentHashes: commit.parentHashes, + decorations: commit.decorations, +}); + +/** The Core request for one loaded window; the whole window is projected in one call. */ +export function buildGitGraphRequest( + commits: readonly GitCommit[], + visibleHashes: readonly string[] | undefined, + options: GitGraphLayoutOptions = {}, +): GitGraphProjectionRequest { + const request: GitGraphProjectionRequest = { + commits: commits.map(identity), + displayMode: options.displayMode ?? "compact", + }; + const remoteNames = options.references + ?.filter((reference) => reference.kind === "remote") + .map((reference) => reference.shortName); + if (remoteNames?.length) request.remoteNames = remoteNames; + if (options.repositoryCommits?.length) { + request.repositoryCommits = options.repositoryCommits.map(identity); + } + if (visibleHashes) request.visibleHashes = [...visibleHashes]; + if (options.currentBranch) request.currentBranch = options.currentBranch; + return request; +} + +/** Attaches the caller's commit metadata to Core's rows; the first row of a hash wins. */ +export function attachGitGraphCommits( + commits: readonly GitCommit[], + projection: GitGraphProjection, +): GitGraphLayout { + const byHash = new Map<string, GitCommit>(); + for (const commit of commits) if (!byHash.has(commit.hash)) byHash.set(commit.hash, commit); + return { + rows: projection.rows.map((row) => { + const commit = byHash.get(row.commitHash); + if (!commit) throw new Error(`Git graph projection returned unknown commit ${row.commitHash}`); + return { ...row, commit }; + }), + laneCount: projection.laneCount, + recommendedLaneCount: projection.recommendedLaneCount, + hasMissingParents: projection.hasMissingParents, + currentBranchHashes: new Set(projection.currentBranchHashes), + }; +} + +/** Projects one loaded history window through Core. */ +export async function layoutGitGraph( + commits: readonly GitCommit[], + visibleHashes?: readonly string[], + options: GitGraphLayoutOptions = {}, +): Promise<GitGraphLayout> { + if (commits.length === 0) return EMPTY_GIT_GRAPH_LAYOUT; + const projection = await tauriInvoke<GitGraphProjection>( + "git.graphProjection", + buildGitGraphRequest(commits, visibleHashes, options) as unknown as Record<string, unknown>, + ); + return attachGitGraphCommits(commits, projection); +} diff --git a/windows/tauri/src/features/git/components/log/git-commit-table-keyboard-menu.test.tsx b/windows/tauri/src/features/git/components/log/git-commit-table-keyboard-menu.test.tsx index fd8161c7da..c70f887f6d 100644 --- a/windows/tauri/src/features/git/components/log/git-commit-table-keyboard-menu.test.tsx +++ b/windows/tauri/src/features/git/components/log/git-commit-table-keyboard-menu.test.tsx @@ -4,6 +4,7 @@ import { act, useState, useLayoutEffect } from "react"; import { createRoot, type Root } from "react-dom/client"; import { LocaleProvider } from "@/i18n/locale-provider"; import { installHappyDom } from "@/test-utils/happy-dom"; +import { installGitGraphProjectionStub } from "@/test-utils/git-graph-projection-stub"; import { useGitLogPreferencesStore } from "../../stores/git-log-preferences.store"; import type { GitCommit } from "../../types/git.types"; import * as historyApi from "../../api/git-history-rewrite-api"; @@ -37,8 +38,11 @@ const commits: GitCommit[] = ["a", "b"].map((letter) => ({ date: "2026/10/06 10:00", decorations: "", })); +let graphStub: ReturnType<typeof installGitGraphProjectionStub>; + beforeEach(() => { restoreDom = installHappyDom(); + graphStub = installGitGraphProjectionStub({ geometryFree: true }); previousAct = globals.IS_REACT_ACT_ENVIRONMENT; globals.IS_REACT_ACT_ENVIRONMENT = true; previousPreferences = useGitLogPreferencesStore.getState(); @@ -90,7 +94,8 @@ afterEach(async () => { host.remove(); if (previousAct === undefined) delete globals.IS_REACT_ACT_ENVIRONMENT; else globals.IS_REACT_ACT_ENVIRONMENT = previousAct; - restoreDom(); + graphStub.mockRestore(); + restoreDom(); } }); function Harness({ selected = true, selectedHashes }: { selected?: boolean; selectedHashes?: Set<string> }) { diff --git a/windows/tauri/src/features/git/components/log/git-commit-table-tag.test.tsx b/windows/tauri/src/features/git/components/log/git-commit-table-tag.test.tsx index b39b90ebe9..e5d87191dc 100644 --- a/windows/tauri/src/features/git/components/log/git-commit-table-tag.test.tsx +++ b/windows/tauri/src/features/git/components/log/git-commit-table-tag.test.tsx @@ -3,6 +3,7 @@ import { act, useState, type ReactNode } from "react"; import { createRoot, type Root } from "react-dom/client"; import { LocaleProvider } from "@/i18n/locale-provider"; import { installHappyDom } from "@/test-utils/happy-dom"; +import { installGitGraphProjectionStub } from "@/test-utils/git-graph-projection-stub"; import { useGitLogPreferencesStore } from "../../stores/git-log-preferences.store"; import type { GitCommit } from "../../types/git.types"; @@ -36,8 +37,11 @@ const content = ({ children }: { children?: unknown }) => ( <div>{typeof children === "function" ? null : (children as ReactNode)}</div> ); +let graphStub: ReturnType<typeof installGitGraphProjectionStub>; + beforeEach(() => { restoreDom = installHappyDom(); + graphStub = installGitGraphProjectionStub({ geometryFree: true }); previousAct = globals.IS_REACT_ACT_ENVIRONMENT; globals.IS_REACT_ACT_ENVIRONMENT = true; previousPreferences = useGitLogPreferencesStore.getState(); @@ -93,7 +97,8 @@ afterEach(async () => { container.remove(); if (previousAct === undefined) delete globals.IS_REACT_ACT_ENVIRONMENT; else globals.IS_REACT_ACT_ENVIRONMENT = previousAct; - restoreDom(); + graphStub.mockRestore(); + restoreDom(); } }); diff --git a/windows/tauri/src/features/git/components/log/git-commit-table.filter.test.tsx b/windows/tauri/src/features/git/components/log/git-commit-table.filter.test.tsx index cf6013c931..c74916b7d1 100644 --- a/windows/tauri/src/features/git/components/log/git-commit-table.filter.test.tsx +++ b/windows/tauri/src/features/git/components/log/git-commit-table.filter.test.tsx @@ -4,6 +4,7 @@ import { act } from "react"; import { createRoot, type Root } from "react-dom/client"; import { LocaleProvider } from "@/i18n/locale-provider"; import { installHappyDom } from "@/test-utils/happy-dom"; +import { installGitGraphProjectionStub } from "@/test-utils/git-graph-projection-stub"; import { useGitLogPreferencesStore } from "../../stores/git-log-preferences.store"; import type { GitCommit } from "../../types/git.types"; import { GitCommitTable } from "./git-commit-table"; @@ -16,8 +17,11 @@ let previousPreferences: ReturnType<typeof useGitLogPreferencesStore.getState>; const environment = globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean }; let previousActEnvironment: boolean | undefined; +let graphStub: ReturnType<typeof installGitGraphProjectionStub>; + beforeEach(() => { restoreDom = installHappyDom(); + graphStub = installGitGraphProjectionStub(); previousActEnvironment = environment.IS_REACT_ACT_ENVIRONMENT; environment.IS_REACT_ACT_ENVIRONMENT = true; previousPreferences = useGitLogPreferencesStore.getState(); @@ -48,6 +52,7 @@ afterEach(async () => { viewportSpy.mockRestore(); useGitLogPreferencesStore.setState(previousPreferences, true); environment.IS_REACT_ACT_ENVIRONMENT = previousActEnvironment; + graphStub.mockRestore(); restoreDom(); }); diff --git a/windows/tauri/src/features/git/components/log/git-commit-table.navigation.test.tsx b/windows/tauri/src/features/git/components/log/git-commit-table.navigation.test.tsx index a641438c1b..25434b0cb3 100644 --- a/windows/tauri/src/features/git/components/log/git-commit-table.navigation.test.tsx +++ b/windows/tauri/src/features/git/components/log/git-commit-table.navigation.test.tsx @@ -4,6 +4,7 @@ import { createRoot, type Root } from "react-dom/client"; import * as virtual from "@tanstack/react-virtual"; import { LocaleProvider } from "@/i18n/locale-provider"; import { installHappyDom } from "@/test-utils/happy-dom"; +import { installGitGraphProjectionStub } from "@/test-utils/git-graph-projection-stub"; import { useGitLogPreferencesStore } from "../../stores/git-log-preferences.store"; import type { GitCommit } from "../../types/git.types"; import { GitCommitTable } from "./git-commit-table"; @@ -87,8 +88,11 @@ function Harness({ ); } +let graphStub: ReturnType<typeof installGitGraphProjectionStub>; + beforeEach(() => { restoreDom = installHappyDom(); + graphStub = installGitGraphProjectionStub(); previousActEnvironment = environment.IS_REACT_ACT_ENVIRONMENT; environment.IS_REACT_ACT_ENVIRONMENT = true; previousPreferences = useGitLogPreferencesStore.getState(); @@ -152,6 +156,7 @@ afterEach(async () => { viewportSpy.mockRestore(); useGitLogPreferencesStore.setState(previousPreferences, true); environment.IS_REACT_ACT_ENVIRONMENT = previousActEnvironment; + graphStub.mockRestore(); restoreDom(); }); @@ -246,6 +251,9 @@ test("missing-history markers have no navigation target and ordinary row selecti }); test("appending a page and repainting references preserve the manually scrolled viewport and selection", async () => { + // The two pages are not a recorded Core history; this test asserts scrolling, not geometry. + graphStub.mockRestore(); + graphStub = installGitGraphProjectionStub({ geometryFree: true }); await mount(); await click(container.querySelector('[data-git-commit-hash="0"]')!); await act(async () => moveViewport?.(36)); diff --git a/windows/tauri/src/features/git/components/log/git-commit-table.presentation.test.tsx b/windows/tauri/src/features/git/components/log/git-commit-table.presentation.test.tsx index 92c13288fe..8e506777df 100644 --- a/windows/tauri/src/features/git/components/log/git-commit-table.presentation.test.tsx +++ b/windows/tauri/src/features/git/components/log/git-commit-table.presentation.test.tsx @@ -5,6 +5,7 @@ import { createRoot, type Root } from "react-dom/client"; import * as virtual from "@tanstack/react-virtual"; import { LocaleProvider } from "@/i18n/locale-provider"; import { installHappyDom } from "@/test-utils/happy-dom"; +import { installGitGraphProjectionStub } from "@/test-utils/git-graph-projection-stub"; import { useGitLogPreferencesStore } from "../../stores/git-log-preferences.store"; import type { GitCommit, GitReference } from "../../types/git.types"; import { GitCommitTable } from "./git-commit-table"; @@ -94,8 +95,11 @@ function Harness({ scope = null }: { scope?: GitReference | null }) { ); } +let graphStub: ReturnType<typeof installGitGraphProjectionStub>; + beforeEach(() => { restoreDom = installHappyDom(); + graphStub = installGitGraphProjectionStub({ geometryFree: true }); actEnvironment = environment.IS_REACT_ACT_ENVIRONMENT; environment.IS_REACT_ACT_ENVIRONMENT = true; preferences = useGitLogPreferencesStore.getState(); @@ -161,6 +165,7 @@ afterEach(async () => { else Reflect.deleteProperty(globalThis, "ResizeObserver"); useGitLogPreferencesStore.setState(preferences, true); environment.IS_REACT_ACT_ENVIRONMENT = actEnvironment; + graphStub.mockRestore(); restoreDom(); }); const render = async (scope: GitReference | null = null) => { diff --git a/windows/tauri/src/features/git/components/log/git-commit-table.toolbar.test.tsx b/windows/tauri/src/features/git/components/log/git-commit-table.toolbar.test.tsx index c8c6804eca..cb7a3a97d4 100644 --- a/windows/tauri/src/features/git/components/log/git-commit-table.toolbar.test.tsx +++ b/windows/tauri/src/features/git/components/log/git-commit-table.toolbar.test.tsx @@ -4,6 +4,7 @@ import { act } from "react"; import { createRoot, type Root } from "react-dom/client"; import { LocaleProvider } from "@/i18n/locale-provider"; import { installHappyDom } from "@/test-utils/happy-dom"; +import { installGitGraphProjectionStub } from "@/test-utils/git-graph-projection-stub"; import { useGitLogPreferencesStore } from "../../stores/git-log-preferences.store"; import type { GitCommit, GitReference } from "../../types/git.types"; import { GitCommitTable } from "./git-commit-table"; @@ -36,8 +37,11 @@ const references: GitReference[] = [ { fullName: "refs/heads/feature", shortName: "feature", kind: "local", peelsToCommit: true, isCurrent: false }, ]; +let graphStub: ReturnType<typeof installGitGraphProjectionStub>; + beforeEach(() => { restoreDom = installHappyDom(); + graphStub = installGitGraphProjectionStub({ geometryFree: true }); (globalThis as { ResizeObserver?: unknown }).ResizeObserver = StubResizeObserver; previousActEnvironment = environment.IS_REACT_ACT_ENVIRONMENT; environment.IS_REACT_ACT_ENVIRONMENT = true; @@ -91,6 +95,7 @@ afterEach(async () => { if (descriptor) Object.defineProperty(globalThis, key, descriptor); else Reflect.deleteProperty(globalThis, key); } + graphStub.mockRestore(); restoreDom(); }); diff --git a/windows/tauri/src/features/git/components/log/git-commit-table.tsx b/windows/tauri/src/features/git/components/log/git-commit-table.tsx index 0962895f74..189b9f1f9a 100644 --- a/windows/tauri/src/features/git/components/log/git-commit-table.tsx +++ b/windows/tauri/src/features/git/components/log/git-commit-table.tsx @@ -32,14 +32,14 @@ import { useTranslation } from "@/i18n/locale-provider"; import { useGitLogColumnResize } from "../../hooks/use-git-log-column-resize"; import { useGitGraphPaint } from "../../hooks/use-git-graph-paint"; import { useGitGraphReferenceMetrics } from "../../hooks/use-git-graph-reference-metrics"; -import { currentGitBranchHashes, shouldHighlightCurrentGitBranch } from "../../utils/git-graph-highlights"; +import { shouldHighlightCurrentGitBranch } from "../../utils/git-graph-highlights"; import { groupGitGraphReferences } from "../../utils/git-graph-reference-group"; import { type GitLogFilterScope, useGitLogPreferencesStore, } from "../../stores/git-log-preferences.store"; import type { GitCommit, GitReference } from "../../types/git.types"; -import { layoutGitGraph } from "../../utils/git-graph-layout"; +import { useGitGraphLayout } from "../../hooks/use-git-graph-layout"; import { matchesGitLogCommit } from "../../utils/git-log-filter"; import { selectedCommitsInHistoryOrder, @@ -146,21 +146,27 @@ export function GitCommitTable({ useEffect(() => setDraftQuery(query), [query]); const loadMoreRef = useRef<HTMLDivElement>(null); const paint = useGitGraphPaint(); - const graphLayout = useMemo( + const matchingHashes = useMemo( () => - layoutGitGraph( - commits, - query.trim() - ? new Set( - commits - .filter((commit) => matchesGitLogCommit(commit, query, scope)) - .map((commit) => commit.hash), - ) - : undefined, - { repositoryCommits, references, displayMode: showLongGraphEdges ? "expanded" : "compact" }, - ), - [commits, repositoryCommits, references, query, scope, showLongGraphEdges], + query.trim() + ? commits + .filter((commit) => matchesGitLogCommit(commit, query, scope)) + .map((commit) => commit.hash) + : undefined, + [commits, query, scope], ); + const highlightsCurrentBranch = shouldHighlightCurrentGitBranch(selectedReference); + const currentBranchName = highlightsCurrentBranch + ? references?.find((reference) => reference.kind === "local" && reference.isCurrent)?.shortName + : undefined; + const graphLayout = useGitGraphLayout({ + commits, + repositoryCommits, + references, + visibleHashes: matchingHashes, + displayMode: showLongGraphEdges ? "expanded" : "compact", + currentBranch: currentBranchName, + }); const visibleRows = graphLayout.rows; const graphWidth = useMemo( () => gitGraphWidth(visibleRows, paint, graphLayout.recommendedLaneCount), @@ -234,9 +240,7 @@ export function GitCommitTable({ ); const { columnStyle, activeColumn, startResize } = useGitLogColumnResize(scrollRef); const referenceMetrics = useGitGraphReferenceMetrics(scrollRef, columnStyle, paint.rowHeight); - const currentBranchHashes = useMemo(() => shouldHighlightCurrentGitBranch(selectedReference) - ? currentGitBranchHashes(commits, repositoryCommits ?? [], references ?? []) : new Set<string>(), - [commits, repositoryCommits, references, selectedReference]); + const currentBranchHashes = graphLayout.currentBranchHashes; const referenceGroups = useMemo(() => new Map(visibleRows.map((row) => [row.commit.hash, groupGitGraphReferences(row.labels, references)])), [visibleRows, references]); diff --git a/windows/tauri/src/features/git/components/log/git-graph-row.test.ts b/windows/tauri/src/features/git/components/log/git-graph-row.test.ts index 9e74353875..f5bbfa49e5 100644 --- a/windows/tauri/src/features/git/components/log/git-graph-row.test.ts +++ b/windows/tauri/src/features/git/components/log/git-graph-row.test.ts @@ -2,46 +2,29 @@ import { describe, expect, test } from "bun:test"; import { GitGraphCanvas, GitGraphRow, gitGraphWidth } from "./git-graph-row"; import { createElement } from "react"; import { renderToStaticMarkup } from "react-dom/server"; -import { layoutGitGraph } from "../../utils/git-graph-layout"; -import type { GitCommit } from "../../types/git.types"; +import { graphFixtureLayout } from "@/test-utils/git-graph-projection-stub"; import { graphColor } from "../../utils/git-graph-colors"; import { gitGraphPaintMetrics } from "../../utils/git-graph-geometry"; describe("git graph decoration labels", () => { test("subject and references use each row's graph extent within a shared recommended baseline", () => { - const commits: GitCommit[] = Array.from({ length: 100 }, (_, row) => ({ - hash: String(row), shortHash: String(row), - parentHashes: row === 60 ? Array.from({ length: 8 }, (_, index) => String(61 + index)) - : row > 60 && row <= 68 ? ["69"] : row < 99 ? [String(row + 1)] : [], - message: `subject ${row}`, author: "fixture", date: "unknown", - decorations: row === 0 ? "HEAD -> main" : "", - })); - const layout = layoutGitGraph(commits); + const layout = graphFixtureLayout("wideMerge"); const render = (index: number) => renderToStaticMarkup(createElement(GitGraphRow, { row: layout.rows[index], showDecorations: true, recommendedLaneCount: layout.recommendedLaneCount, })); const spacerWidth = (markup: string) => Number(markup.match(/git-graph-row-spacer[^>]*style="width:(\d+)px/)![1]); const simple = render(0); - const dense = render(64); - const after = render(90); + const dense = render(34); + const after = render(55); expect(spacerWidth(simple)).toBeLessThan(117); expect(spacerWidth(dense)).toBeGreaterThan(spacerWidth(simple)); expect(spacerWidth(after)).toBe(spacerWidth(simple)); - expect(simple).toContain("subject 0"); + expect(simple).toContain(">0<"); expect(simple).toContain('data-reference-kind="branch"'); - expect(dense).toContain("subject 64"); + expect(dense).toContain(">34<"); }); test("compact long edges render solid arrow arms and filled nodes at 2x", () => { - const commits: GitCommit[] = Array.from({ length: 40 }, (_, row) => ({ - hash: String(row), - shortHash: String(row), - parentHashes: row === 0 ? ["1", "39"] : row < 39 ? [String(row + 1)] : [], - message: String(row), - author: "fixture", - date: "unknown", - decorations: row === 0 ? "HEAD -> main" : "", - })); - const arrows = layoutGitGraph(commits).rows.filter((row) => + const arrows = graphFixtureLayout("compactLongEdge").rows.filter((row) => row.printElements.some((element) => element.hasArrow), ); expect(arrows.length).toBeGreaterThan(0); @@ -68,17 +51,7 @@ describe("git graph decoration labels", () => { }); test("unfiltered SVG connects shifted passing lanes at the same boundary midpoint", () => { - const parents = [["1"], ["3", "2"], ["3", "5"], ["5", "4"], ["5"], []]; - const commits: GitCommit[] = parents.map((parentHashes, row) => ({ - hash: String(row), - shortHash: String(row), - parentHashes, - message: String(row), - author: "fixture", - date: "unknown", - decorations: row === 0 ? "HEAD -> main" : row === 1 ? "feature" : "", - })); - const layout = layoutGitGraph(commits); + const layout = graphFixtureLayout("shiftedForks"); const paint = gitGraphPaintMetrics(); const canvas = renderToStaticMarkup( createElement(GitGraphCanvas, { @@ -95,18 +68,7 @@ describe("git graph decoration labels", () => { }); test("unfiltered SVG paints two incoming colors separately at a merge endpoint", () => { - const commits: GitCommit[] = [["main", "side"], ["root"], ["root"], []].map( - (parentHashes, row) => ({ - hash: ["merge", "main", "side", "root"][row], - shortHash: String(row), - parentHashes, - message: String(row), - author: "fixture", - date: "unknown", - decorations: row === 0 ? "HEAD -> main" : row === 2 ? "feature" : "", - }), - ); - const layout = layoutGitGraph(commits); + const layout = graphFixtureLayout("namedMergeEndpoint"); const paint = gitGraphPaintMetrics(); const svg = renderToStaticMarkup( createElement(GitGraphCanvas, { @@ -117,17 +79,11 @@ describe("git graph decoration labels", () => { ); expect(svg.match(/<path /g)).toHaveLength(2); for (const row of layout.rows.slice(1, 3)) - expect(svg).toContain(`--git-graph-light:${graphColor(row.parentEdges[0].colorIndex)}`); + expect(svg).toContain(`--git-graph-light:${graphColor(row.parentEdges[0].colorId)}`); }); test("keeps same-row fork edges separate when edge ids contain colons", () => { - const commits: GitCommit[] = [ - { hash: "merge", shortHash: "merge", parentHashes: ["left", "right"], message: "merge", author: "Fixture", date: "unknown", decorations: "HEAD -> main" }, - { hash: "left", shortHash: "left", parentHashes: ["root"], message: "left", author: "Fixture", date: "unknown", decorations: "" }, - { hash: "right", shortHash: "right", parentHashes: ["root"], message: "right", author: "Fixture", date: "unknown", decorations: "" }, - { hash: "root", shortHash: "root", parentHashes: [], message: "root", author: "Fixture", date: "unknown", decorations: "" }, - ]; - const layout = layoutGitGraph(commits); + const layout = graphFixtureLayout("forkAndMerge"); const paint = gitGraphPaintMetrics(); const svg = renderToStaticMarkup( createElement(GitGraphCanvas, { @@ -141,16 +97,7 @@ describe("git graph decoration labels", () => { }); test("renders both halves of a filtered ancestor edge as dashed SVG paths", () => { - const commits: GitCommit[] = ["a", "b", "c"].map((hash, row) => ({ - hash, - shortHash: hash, - parentHashes: row < 2 ? [String.fromCharCode(hash.charCodeAt(0) + 1)] : [], - message: hash, - author: "fixture", - date: "unknown", - decorations: "", - })); - const layout = layoutGitGraph(commits, new Set(["a", "c"])); + const layout = graphFixtureLayout("filteredDottedAncestor"); for (const row of layout.rows) { const paint = gitGraphPaintMetrics(); const svg = renderToStaticMarkup( @@ -168,7 +115,7 @@ describe("git graph decoration labels", () => { }); test("renders one compact reference group with full names and original kind markers", () => { - const row = layoutGitGraph([{ hash: "tip", shortHash: "tip", parentHashes: [], message: "Subject", author: "Fixture", date: "unknown", decorations: "HEAD -> master, origin/master, tag: v1.0.0" }]).rows[0]; + const row = graphFixtureLayout("decoratedTip").rows[0]; const html = renderToStaticMarkup(createElement(GitGraphRow, { row, showDecorations: true })); expect(html.match(/data-git-reference-group=/g)).toHaveLength(1); expect(html).toContain("origin & master"); @@ -177,10 +124,7 @@ describe("git graph decoration labels", () => { }); test("renders the checked-out HEAD node as IDEA's larger ring with a filled center", () => { - const layout = layoutGitGraph([ - { hash: "head", shortHash: "head", parentHashes: ["root"], message: "head", author: "Fixture", date: "unknown", decorations: "HEAD -> main" }, - { hash: "root", shortHash: "root", parentHashes: [], message: "root", author: "Fixture", date: "unknown", decorations: "" }, - ]); + const layout = graphFixtureLayout("headAndRoot"); const paint = gitGraphPaintMetrics(); const svg = renderToStaticMarkup( createElement(GitGraphCanvas, { diff --git a/windows/tauri/src/features/git/components/log/git-graph-row.theme.test.tsx b/windows/tauri/src/features/git/components/log/git-graph-row.theme.test.tsx index bc02cfec0d..a2079ba240 100644 --- a/windows/tauri/src/features/git/components/log/git-graph-row.theme.test.tsx +++ b/windows/tauri/src/features/git/components/log/git-graph-row.theme.test.tsx @@ -7,7 +7,7 @@ import themes from "@/extensions/themes/builtin/lithe.json"; import { toThemeDefinition } from "@/extensions/themes/theme-file"; import { themeRegistry } from "@/extensions/themes/theme-registry"; import type { ThemeFile } from "@/extensions/themes/theme-schema"; -import { layoutGitGraph } from "../../utils/git-graph-layout"; +import { graphFixtureLayout } from "@/test-utils/git-graph-projection-stub"; import { gitGraphPaintMetrics } from "../../utils/git-graph-geometry"; import { GitGraphCanvas, gitGraphWidth } from "./git-graph-row"; @@ -32,26 +32,7 @@ for (const [themeId, color] of [ function Harness() { const layout = useMemo(() => { layoutBuilds += 1; - return layoutGitGraph([ - { - hash: "tip", - shortHash: "tip", - parentHashes: ["root"], - message: "tip", - author: "Fixture", - date: "unknown", - decorations: "HEAD -> main", - }, - { - hash: "root", - shortHash: "root", - parentHashes: [], - message: "root", - author: "Fixture", - date: "unknown", - decorations: "", - }, - ]); + return graphFixtureLayout("headAndRoot"); }, []); const paint = gitGraphPaintMetrics(); return ( diff --git a/windows/tauri/src/features/git/components/log/git-graph-row.tsx b/windows/tauri/src/features/git/components/log/git-graph-row.tsx index bc9d5bcb05..dae1c39c6e 100644 --- a/windows/tauri/src/features/git/components/log/git-graph-row.tsx +++ b/windows/tauri/src/features/git/components/log/git-graph-row.tsx @@ -1,6 +1,6 @@ import { memo, useId, type CSSProperties } from "react"; import { graphColor } from "../../utils/git-graph-colors"; -import type { GitGraphRow as GraphRow } from "../../utils/git-graph-layout"; +import type { GitGraphRow as GraphRow } from "../../api/git-graph-projection-api"; import { groupGitGraphReferences, type GitGraphReferenceGroup, @@ -120,7 +120,7 @@ export const GitGraphCanvas = memo(function GitGraphCanvas({ d={path.d} fill="none" className="git-graph-tone" - style={tone(path.colorIndex)} + style={tone(path.colorId)} stroke="currentColor" strokeWidth={paint.lineWidth} strokeLinecap="round" @@ -143,7 +143,7 @@ export const GitGraphCanvas = memo(function GitGraphCanvas({ rx={radius} ry={radius} className="git-graph-tone" - style={tone(row.colorIndex)} + style={tone(row.colorId)} fill={isHead ? "none" : "currentColor"} stroke={isHead ? "currentColor" : undefined} strokeWidth={isHead ? paint.headRingWidth : undefined} @@ -155,7 +155,7 @@ export const GitGraphCanvas = memo(function GitGraphCanvas({ rx={paint.headInnerDiameter / 2} ry={paint.headInnerDiameter / 2} className="git-graph-tone" - style={tone(row.colorIndex)} + style={tone(row.colorId)} fill="currentColor" /> )} @@ -180,7 +180,7 @@ export const GitGraphCanvas = memo(function GitGraphCanvas({ type GraphPath = { id: string; d: string; - colorIndex: number; + colorId: number; dash?: ReturnType<GitGraphPaintMetrics["dash"]>; }; @@ -245,7 +245,7 @@ function buildGraphPaths( paths.push({ id: `${edgeId}:${rowIndex + rowOffset}:${segment.direction}`, d: points.join(" "), - colorIndex: segment.colorIndex, + colorId: segment.colorId, dash: segment.isDotted && !segment.hasArrow && !next?.hasArrow ? paint.dash(segment) : undefined, }); }); diff --git a/windows/tauri/src/features/git/components/log/git-log-branch-actions.test.tsx b/windows/tauri/src/features/git/components/log/git-log-branch-actions.test.tsx index a915d0af7b..8940143a30 100644 --- a/windows/tauri/src/features/git/components/log/git-log-branch-actions.test.tsx +++ b/windows/tauri/src/features/git/components/log/git-log-branch-actions.test.tsx @@ -5,6 +5,7 @@ import { toast } from "sonner"; import { LocaleProvider } from "@/i18n/locale-provider"; import { installGitHistoryWindowStub } from "@/test-utils/git-history-window-stub"; import { installHappyDom } from "@/test-utils/happy-dom"; +import { installGitGraphProjectionStub } from "@/test-utils/git-graph-projection-stub"; import { useRepositoryStore } from "../../stores/git-repository.store"; import { useGitLogPreferencesStore } from "../../stores/git-log-preferences.store"; import { useGitLogRevealStore } from "../../stores/git-log-reveal.store"; @@ -119,11 +120,14 @@ const controllerState = ( ...overrides, }); +let graphStub: ReturnType<typeof installGitGraphProjectionStub>; + beforeEach(() => { controllerSpy = spyOn(controller, "useGitLogController").mockImplementation(() => controllerState(), ); restoreDom = installHappyDom(); + graphStub = installGitGraphProjectionStub(); previousAct = globals.IS_REACT_ACT_ENVIRONMENT; globals.IS_REACT_ACT_ENVIRONMENT = true; previousRepos = useRepositoryStore.getState(); @@ -255,7 +259,8 @@ afterEach(async () => { container.remove(); if (previousAct === undefined) delete globals.IS_REACT_ACT_ENVIRONMENT; else globals.IS_REACT_ACT_ENVIRONMENT = previousAct; - restoreDom(); + graphStub.mockRestore(); + restoreDom(); } }); const render = async (language: "en-US" | "zh-CN" = "en-US") => diff --git a/windows/tauri/src/features/git/hooks/use-git-graph-layout.test.tsx b/windows/tauri/src/features/git/hooks/use-git-graph-layout.test.tsx new file mode 100644 index 0000000000..f65c3f9ba3 --- /dev/null +++ b/windows/tauri/src/features/git/hooks/use-git-graph-layout.test.tsx @@ -0,0 +1,99 @@ +import { afterEach, beforeEach, expect, spyOn, test } from "bun:test"; +import { act } from "react"; +import { createRoot, type Root } from "react-dom/client"; +import * as native from "@/platform/tauri-core"; +import { + graphFixtureCase, + graphFixtureCommits, +} from "@/test-utils/git-graph-projection-stub"; +import { installHappyDom } from "@/test-utils/happy-dom"; +import type { GitGraphLayout, GitGraphProjection } from "../api/git-graph-projection-api"; +import { useGitGraphLayout } from "./use-git-graph-layout"; + +const environment = globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean }; +let restoreDom: () => void; +let previousActEnvironment: boolean | undefined; +let root: Root; +let container: HTMLElement; +let latest: GitGraphLayout; +let pending: Array<{ request: any; resolve: (value: GitGraphProjection) => void; reject: (e: unknown) => void }>; +let invoke: ReturnType<typeof spyOn>; +let errors: ReturnType<typeof spyOn>; + +type Input = Parameters<typeof useGitGraphLayout>[0]; +function Harness({ input }: { input: Input }) { + latest = useGitGraphLayout(input); + return null; +} +const render = (input: Input) => act(async () => root.render(<Harness input={input} />)); + +beforeEach(() => { + restoreDom = installHappyDom(); + previousActEnvironment = environment.IS_REACT_ACT_ENVIRONMENT; + environment.IS_REACT_ACT_ENVIRONMENT = true; + pending = []; + invoke = spyOn(native, "invoke").mockImplementation(((command: string, request: unknown) => { + expect(command).toBe("git.graphProjection"); + return new Promise((resolve, reject) => pending.push({ request, resolve, reject })); + }) as unknown as typeof native.invoke); + errors = spyOn(console, "error").mockImplementation(() => {}); + container = document.createElement("div"); + document.body.append(container); + root = createRoot(container); +}); +afterEach(async () => { + await act(async () => root.unmount()); + invoke.mockRestore(); + errors.mockRestore(); + environment.IS_REACT_ACT_ENVIRONMENT = previousActEnvironment; + restoreDom(); +}); + +const answer = (index: number, name: string) => + act(async () => pending[index].resolve(graphFixtureCase(name).response)); + +test("projects the loaded window in one call and keeps the previous layout while the next loads", async () => { + const pageOne = graphFixtureCommits("pageOne"); + await render({ commits: pageOne, displayMode: "compact" }); + expect(latest.rows).toHaveLength(0); + expect(pending).toHaveLength(1); + await answer(0, "pageOne"); + expect(latest.rows.map((row) => row.commit.hash)).toEqual(["m3", "m2", "m1"]); + expect(latest.hasMissingParents).toBe(true); + + // Appending a page reprojects the whole window; the old rows stay until it arrives. + await render({ commits: graphFixtureCommits("pageTwo"), displayMode: "compact" }); + expect(pending).toHaveLength(2); + expect(latest.rows).toHaveLength(3); + await answer(1, "pageTwo"); + expect(latest.rows).toHaveLength(5); + expect(latest.hasMissingParents).toBe(false); +}); + +test("a re-render with the same window and filter does not call Core again", async () => { + const commits = graphFixtureCommits("filteredDottedAncestor"); + await render({ commits, visibleHashes: ["a", "d"], displayMode: "compact" }); + await answer(0, "filteredDottedAncestor"); + await render({ commits, visibleHashes: ["a", "d"], displayMode: "compact" }); + expect(pending).toHaveLength(1); + expect(latest.rows.map((row) => row.commit.hash)).toEqual(["a", "d"]); +}); + +test("a superseded response is discarded", async () => { + await render({ commits: graphFixtureCommits("pageOne"), displayMode: "compact" }); + await render({ commits: graphFixtureCommits("pageTwo"), displayMode: "compact" }); + expect(pending).toHaveLength(2); + // The newer request answers first; the stale answer must not replace it. + await answer(1, "pageTwo"); + await answer(0, "pageOne"); + expect(latest.rows).toHaveLength(5); +}); + +test("a failed projection clears the graph and reports the error", async () => { + await render({ commits: graphFixtureCommits("pageOne"), displayMode: "compact" }); + await answer(0, "pageOne"); + await render({ commits: graphFixtureCommits("pageTwo"), displayMode: "compact" }); + await act(async () => pending[1].reject(new Error("core rejected"))); + expect(latest.rows).toHaveLength(0); + expect(errors).toHaveBeenCalled(); +}); diff --git a/windows/tauri/src/features/git/hooks/use-git-graph-layout.ts b/windows/tauri/src/features/git/hooks/use-git-graph-layout.ts new file mode 100644 index 0000000000..ce046e8175 --- /dev/null +++ b/windows/tauri/src/features/git/hooks/use-git-graph-layout.ts @@ -0,0 +1,53 @@ +import { useEffect, useMemo, useState } from "react"; +import { + EMPTY_GIT_GRAPH_LAYOUT, + layoutGitGraph, + type GitGraphDisplayMode, + type GitGraphLayout, +} from "../api/git-graph-projection-api"; +import type { GitCommit, GitReference } from "../types/git.types"; + +/** + * Projects the loaded history window through Core (`git.graphProjection`). + * + * The whole window is projected in one call whenever its commits, the filter, the + * display mode, or the reference set change. Keeping the previous layout until the + * next one arrives avoids a blank graph while a page loads, and a response for a + * superseded request is discarded. + */ +export function useGitGraphLayout(input: { + commits: readonly GitCommit[]; + repositoryCommits?: readonly GitCommit[]; + references?: readonly GitReference[]; + /** `undefined` shows every commit. */ + visibleHashes?: readonly string[]; + displayMode: GitGraphDisplayMode; + currentBranch?: string; +}): GitGraphLayout { + const { commits, repositoryCommits, references, visibleHashes, displayMode, currentBranch } = + input; + const [layout, setLayout] = useState<GitGraphLayout>(EMPTY_GIT_GRAPH_LAYOUT); + // Hashes are compared by content so a new array with the same filter result is not a change. + const visibleKey = useMemo(() => visibleHashes?.join("\n"), [visibleHashes]); + useEffect(() => { + let current = true; + layoutGitGraph(commits, visibleHashes, { + references, + repositoryCommits, + displayMode, + currentBranch, + }).then( + (next) => { + if (current) setLayout(next); + }, + (error) => { + console.error("Failed to project the Git graph:", error); + if (current) setLayout(EMPTY_GIT_GRAPH_LAYOUT); + }, + ); + return () => { + current = false; + }; + }, [commits, repositoryCommits, references, visibleKey, displayMode, currentBranch]); + return layout; +} diff --git a/windows/tauri/src/features/git/hooks/use-git-graph-paint.test.tsx b/windows/tauri/src/features/git/hooks/use-git-graph-paint.test.tsx index bd4d544482..f0500c1a4c 100644 --- a/windows/tauri/src/features/git/hooks/use-git-graph-paint.test.tsx +++ b/windows/tauri/src/features/git/hooks/use-git-graph-paint.test.tsx @@ -4,7 +4,7 @@ import { createRoot, type Root } from "react-dom/client"; import { useSettingsStore } from "@/features/settings/stores/settings.store"; import { installHappyDom } from "@/test-utils/happy-dom"; import { GitGraphCanvas, gitGraphWidth } from "../components/log/git-graph-row"; -import { layoutGitGraph } from "../utils/git-graph-layout"; +import { graphFixtureLayout } from "@/test-utils/git-graph-projection-stub"; import { useGitGraphPaint } from "./use-git-graph-paint"; let restoreDom: () => void; @@ -21,17 +21,7 @@ function Harness() { const paint = useGitGraphPaint(); const layout = useMemo(() => { layoutBuilds += 1; - return layoutGitGraph([ - { - hash: "tip", - shortHash: "tip", - parentHashes: [], - author: "fixture", - message: "tip", - date: "unknown", - decorations: "", - }, - ]); + return graphFixtureLayout("singleCommit"); }, []); return ( <div> diff --git a/windows/tauri/src/features/git/utils/git-graph-colors.test.ts b/windows/tauri/src/features/git/utils/git-graph-colors.test.ts index d5c29af8fd..8f7622a4d6 100644 --- a/windows/tauri/src/features/git/utils/git-graph-colors.test.ts +++ b/windows/tauri/src/features/git/utils/git-graph-colors.test.ts @@ -1,6 +1,6 @@ import { expect, test } from "bun:test"; import { readFileSync } from "node:fs"; -import { graphColor, graphColorIdForName } from "./git-graph-colors"; +import { graphColor } from "./git-graph-colors"; test("light/dark RGB matches the real IntelliJ generator, including signed integer overflow", () => { const oracle = readFileSync( @@ -16,8 +16,7 @@ test("light/dark RGB matches the real IntelliJ generator, including signed integ } }); -test("keeps full Java IDs and uses foreground for unreferenced fragments", () => { - expect(graphColorIdForName("main")).toBe(3343801); +test("uses foreground for unreferenced fragments and distinct hues for distinct IDs", () => { expect(graphColor(0)).toBe("var(--foreground)"); expect(graphColor(0, true)).toBe("var(--foreground)"); expect(graphColor(1)).not.toBe(graphColor(7)); diff --git a/windows/tauri/src/features/git/utils/git-graph-colors.ts b/windows/tauri/src/features/git/utils/git-graph-colors.ts index 45ecf5f443..1deb432582 100644 --- a/windows/tauri/src/features/git/utils/git-graph-colors.ts +++ b/windows/tauri/src/features/git/utils/git-graph-colors.ts @@ -43,21 +43,3 @@ export function graphColor(colorId: number, isDark = false): string { ][Math.floor(h) % 6]; return `rgb(${channels.map((channel) => Math.floor(Math.fround(Math.fround(channel * 255) + 0.5))).join(", ")})`; } - -/** - * Java `String.hashCode` over UTF-16 code units. IDEA's graph coloring keys a - * branch's color off this value, so matching it keeps the identity stable across - * renders and topology changes. - */ -export function javaStringHashCode(value: string): number { - let hash = 0; - for (let index = 0; index < value.length; index += 1) { - hash = (Math.imul(hash, 31) + value.charCodeAt(index)) | 0; - } - return hash; -} - -/** Stable full Java color ID for a principal reference fragment. */ -export function graphColorIdForName(name: string): number { - return javaStringHashCode(name); -} diff --git a/windows/tauri/src/features/git/utils/git-graph-filter-projection.ts b/windows/tauri/src/features/git/utils/git-graph-filter-projection.ts deleted file mode 100644 index f3d629c674..0000000000 --- a/windows/tauri/src/features/git/utils/git-graph-filter-projection.ts +++ /dev/null @@ -1,130 +0,0 @@ -// Portions adapted from JetBrains IntelliJ Community DottedFilterEdgesGenerator, -// Copyright 2000-2024 JetBrains s.r.o. and contributors, Apache-2.0. -// TypeScript adaptation follows macOS GitGraphProjection / GitGraphMissingParents. -// See macos/Resources/GitGraph/NOTICE.txt and the owning Git graph Agent Note. - -export interface FilteredGraphEdge { - up: number; - down: number | null; - parentHash: string; - isDotted: boolean; -} - -/** Projects visible endpoints in the original permanent graph's row coordinates. */ -export function projectGitGraphFilter( - hashes: string[], - parentHashes: string[][], - parents: number[][], - children: number[][], - visible: number[], -): FilteredGraphEdge[] { - if (visible.length === 0) return []; - const visibleSet = new Set(visible); - const knownHashes = new Set(hashes); - const edges: FilteredGraphEdge[] = []; - const pairs = new Set<string>(); - const add = (up: number, down: number, isDotted: boolean) => { - const key = `${up}:${down}`; - if (up >= down || !visibleSet.has(up) || !visibleSet.has(down) || pairs.has(key)) return; - pairs.add(key); - edges.push({ up, down, parentHash: hashes[down], isDotted }); - }; - - // Direct edges win over a second path that happens to cross hidden commits. - for (const row of visible) { - for (const parent of parents[row]) add(row, parent, false); - for (const hash of new Set(parentHashes[row])) { - if (!knownHashes.has(hash)) - edges.push({ up: row, down: null, parentHash: hash, isDotted: false }); - } - } - - // IntelliJ's two directional nearest-visible walks preserve merge topology - // without enumerating every path through a hidden diamond. - const numbers = Array<number>(hashes.length).fill(Number.NEGATIVE_INFINITY); - for (let node = 0; node < hashes.length; node += 1) { - let nearest = Number.NEGATIVE_INFINITY; - let adjacent = Number.NEGATIVE_INFINITY; - for (const child of children[node]) { - if (visibleSet.has(child)) { - if (visibleSet.has(node)) adjacent = Math.max(adjacent, numbers[child]); - else nearest = Math.max(nearest, child); - } else nearest = Math.max(nearest, numbers[child]); - } - if (visibleSet.has(node)) { - if (nearest === adjacent || nearest === Number.NEGATIVE_INFINITY) numbers[node] = adjacent; - else { - add(nearest, node, true); - numbers[node] = nearest; - } - } else numbers[node] = nearest; - } - numbers.fill(Number.POSITIVE_INFINITY); - for (let node = hashes.length - 1; node >= 0; node -= 1) { - let nearest = Number.POSITIVE_INFINITY; - let adjacent = Number.POSITIVE_INFINITY; - for (const parent of parents[node]) { - if (visibleSet.has(parent)) { - if (visibleSet.has(node)) adjacent = Math.min(adjacent, numbers[parent]); - else nearest = Math.min(nearest, parent); - } else nearest = Math.min(nearest, numbers[parent]); - } - if (visibleSet.has(node)) { - if (nearest === adjacent || nearest === Number.POSITIVE_INFINITY) numbers[node] = adjacent; - else { - add(node, nearest, true); - numbers[node] = nearest; - } - } else numbers[node] = nearest; - } - - // Share hidden boundary groups rather than copying every ancestor hash set. - // A visible ancestor owns its continuation; never propagate through it. - const groups: Array<{ hashes: string[]; parents: number[] }> = []; - const groupIDs = new Map<string, number>(); - const groupForRow = Array<number | undefined>(hashes.length).fill(undefined); - for (let row = hashes.length - 1; row >= 0; row -= 1) { - if (visibleSet.has(row)) continue; - const missing = [...new Set(parentHashes[row].filter((hash) => !knownHashes.has(hash)))].sort(); - const inherited = [ - ...new Set( - parents[row].flatMap((parent) => { - const group = groupForRow[parent]; - return group === undefined ? [] : [group]; - }), - ), - ].sort((a, b) => a - b); - if (missing.length === 0 && inherited.length <= 1) { - groupForRow[row] = inherited[0]; - } else { - const key = JSON.stringify([missing, inherited]); - let id = groupIDs.get(key); - if (id === undefined) { - id = groups.length; - groupIDs.set(key, id); - groups.push({ hashes: missing, parents: inherited }); - } - groupForRow[row] = id; - } - } - const visited = Array<number>(groups.length).fill(-1); - for (const row of visible) { - const pending = parents[row].flatMap((parent) => { - const group = groupForRow[parent]; - return group === undefined ? [] : [group]; - }); - const missing = new Set<string>(); - while (pending.length > 0) { - const id = pending.pop()!; - if (visited[id] === row) continue; - visited[id] = row; - for (const hash of groups[id].hashes) missing.add(hash); - pending.push(...groups[id].parents); - } - const direct = new Set(parentHashes[row]); - for (const hash of [...missing].sort()) { - if (!direct.has(hash)) edges.push({ up: row, down: null, parentHash: hash, isDotted: true }); - } - } - return edges; -} diff --git a/windows/tauri/src/features/git/utils/git-graph-highlights.test.ts b/windows/tauri/src/features/git/utils/git-graph-highlights.test.ts index 54ef647164..1e5015539c 100644 --- a/windows/tauri/src/features/git/utils/git-graph-highlights.test.ts +++ b/windows/tauri/src/features/git/utils/git-graph-highlights.test.ts @@ -1,15 +1,8 @@ import { expect, test } from "bun:test"; -import type { GitCommit, GitReference } from "../types/git.types"; -import { currentGitBranchHashes, shouldHighlightCurrentGitBranch } from "./git-graph-highlights"; -const commit = (hash: string, parentHashes: string[] = [], decorations = ""): GitCommit => ({ - hash, - shortHash: hash, - parentHashes, - decorations, - message: hash, - author: "Fixture", - date: "unknown", -}); +import type { GitReference } from "../types/git.types"; +import { shouldHighlightCurrentGitBranch } from "./git-graph-highlights"; + +// Current-branch ancestry itself is Core's (`git.graphProjection` currentBranchHashes). const branch: GitReference = { fullName: "refs/heads/main", shortName: "main", @@ -17,36 +10,6 @@ const branch: GitReference = { isCurrent: true, peelsToCommit: true, }; -test("current-branch membership crosses both merge parents through the repository context", () => { - const scope = [commit("feature", ["base"], "feature")]; - const context = [ - commit("main", ["a", "b"], "HEAD -> main"), - commit("a", ["base"]), - commit("b", ["base"]), - commit("base"), - ]; - expect([...currentGitBranchHashes(scope, context, [branch])].sort()).toEqual([ - "a", - "b", - "base", - "main", - ]); -}); -test("missing branch identities do not guess membership and cycles remain bounded", () => { - expect(currentGitBranchHashes([commit("head", [], "HEAD")], [], []).size).toBe(0); - expect(currentGitBranchHashes([commit("head")], [], [branch]).size).toBe(0); - const values = [commit("a", ["b"], "main"), commit("b", ["a"])]; - expect([...currentGitBranchHashes(values, [], [branch])].sort()).toEqual(["a", "b"]); -}); -test("visible commits win over stale duplicate context and pagination extends ancestry", () => { - const scope = [commit("main", ["new"], "main")]; - const context = [commit("main", ["stale"], "main"), commit("new", ["root"]), commit("root")]; - expect([...currentGitBranchHashes(scope, context, [branch])].sort()).toEqual([ - "main", - "new", - "root", - ]); -}); test("all references and other branches highlight while current branch and HEAD views do not", () => { expect(shouldHighlightCurrentGitBranch(null)).toBe(true); expect(shouldHighlightCurrentGitBranch(branch)).toBe(false); diff --git a/windows/tauri/src/features/git/utils/git-graph-highlights.ts b/windows/tauri/src/features/git/utils/git-graph-highlights.ts index 3a9a89ddd1..0bda7590b8 100644 --- a/windows/tauri/src/features/git/utils/git-graph-highlights.ts +++ b/windows/tauri/src/features/git/utils/git-graph-highlights.ts @@ -1,38 +1,4 @@ -import type { GitCommit, GitReference } from "../types/git.types"; -import { parseGitDecorations } from "./git-graph-layout"; - -/** Matches macOS currentBranchHashes: membership includes every merge parent. */ -export function currentGitBranchHashes( - commits: readonly GitCommit[], - repositoryCommits: readonly GitCommit[], - references: readonly GitReference[], -): ReadonlySet<string> { - const branch = references.find((reference) => reference.kind === "local" && reference.isCurrent); - if (!branch) return new Set(); - const values = [...commits, ...repositoryCommits]; - const remoteNames = new Set( - references - .filter((reference) => reference.kind === "remote") - .map((reference) => reference.shortName), - ); - const head = values.find((commit) => - parseGitDecorations(commit.decorations, remoteNames).some( - (label) => label.kind === "branch" && label.title === branch.shortName, - ), - ); - if (!head) return new Set(); - const byHash = new Map<string, GitCommit>(); - for (const commit of values) if (!byHash.has(commit.hash)) byHash.set(commit.hash, commit); - const pending = [head.hash]; - const hashes = new Set<string>(); - while (pending.length) { - const hash = pending.pop()!; - if (hashes.has(hash)) continue; - hashes.add(hash); - pending.push(...(byHash.get(hash)?.parentHashes ?? [])); - } - return hashes; -} +import type { GitReference } from "../types/git.types"; /** A current-branch/HEAD-only view already identifies its branch. */ export function shouldHighlightCurrentGitBranch(reference?: GitReference | null): boolean { diff --git a/windows/tauri/src/features/git/utils/git-graph-layout.test.ts b/windows/tauri/src/features/git/utils/git-graph-layout.test.ts deleted file mode 100644 index 6131804505..0000000000 --- a/windows/tauri/src/features/git/utils/git-graph-layout.test.ts +++ /dev/null @@ -1,624 +0,0 @@ -import { describe, expect, test } from "bun:test"; -import { readFileSync } from "node:fs"; -import type { GitCommit, GitReference } from "../types/git.types"; -import { graphColorIdForName, javaStringHashCode } from "./git-graph-colors"; -import { - bestGraphReferenceLabel, - layoutGitGraph, - parseGitDecorations, - type GitGraphLayout, -} from "./git-graph-layout"; - -const commit = (hash: string, parentHashes: string[] = [], decorations = ""): GitCommit => ({ - hash, - shortHash: hash, - parentHashes, - message: hash, - author: "Developer", - date: "2026/08/16 10:00", - decorations, -}); - -const colorIndexOfCommit = (layout: GitGraphLayout, hash: string): number | null => { - const row = layout.rows.find((candidate) => candidate.commit.hash === hash); - if (!row) throw new Error(`No graph row for ${hash}`); - return row.colorIndex; -}; - -describe("Git graph layout", () => { - for (const prefix of ["issue410", "issue410-date"]) { - test(`repository-context graph matches the real IDEA ${prefix} oracle`, () => { - const fixture = (name: string) => - readFileSync( - new URL( - `../../../../../../macos/Tests/LitheTests/Fixtures/GitGraph/${name}`, - import.meta.url, - ), - "utf8", - ) - .trim() - .split(/\r?\n/); - const readCommits = (name: string) => - fixture(name).map((line) => { - const [hash, parents, decorations] = line.split("\t"); - return commit( - hash, - parents ? parents.split(" ") : [], - decorations.trim().replace(/^\(|\)$/g, ""), - ); - }); - const layout = layoutGitGraph(readCommits(`${prefix}-history.tsv`), undefined, { - repositoryCommits: readCommits(`${prefix}-context.tsv`), - }); - const actual = layout.rows - .flatMap((row, index) => [ - `Node|${index}:${row.lane}:${row.colorIndex}`, - ...row.printElements.map( - (element) => - `Edge|${index}:${element.position}:${element.adjacentPosition}:${element.direction.toUpperCase()}:${element.hasArrow}:${element.isTerminal}:${element.isDotted ? "DASHED" : "SOLID"}:${element.colorIndex}`, - ), - ]) - .sort(); - const expected = fixture( - prefix === "issue410" ? "issue410-context-idea.txt" : "issue410-date-idea.txt", - ) - .filter((line) => !line.startsWith("Width|")) - .map((line) => { - const [kind, value] = line.split("|"); - const fields = value.split(":"); - return kind === "Node" ? `Node|${fields[0]}:${fields[1]}:${fields[3]}` : line; - }) - .sort(); - expect(actual).toEqual(expected); - const expectedWidth = fixture(prefix === "issue410" ? "issue410-context-idea.txt" : "issue410-date-idea.txt") - .find((line) => line.startsWith("Width|"))!; - expect(layout.recommendedLaneCount).toBe(Number(expectedWidth.split("|")[1])); - }); - } - - test("branch scopes inherit repository colors and base order without replacing commit metadata", () => { - const main = commit("main-tip", ["root"], "origin/main"); - const side = commit("side", ["root"], "HEAD -> feature"); - const root = commit("root"); - const context = [main, side, root]; - const full = layoutGitGraph(context); - const scoped = layoutGitGraph([side, root], undefined, { repositoryCommits: context }); - expect(scoped.rows.map((row) => row.colorIndex)).toEqual( - full.rows.slice(1).map((row) => row.colorIndex), - ); - expect(scoped.rows[0].commit).toBe(side); - expect( - layoutGitGraph([side, main, root], undefined, { repositoryCommits: context }).rows.map( - (row) => row.commit.hash, - ), - ).toEqual(["main-tip", "side", "root"]); - expect( - layoutGitGraph([side, root], new Set(["root"]), { repositoryCommits: context }).rows[0] - .colorIndex, - ).toBe(full.rows[2].colorIndex); - }); - - test("incomplete or duplicate repository context falls back without dropping visible commits", () => { - const commits = [commit("tip", ["root"]), commit("root")]; - const expected = layoutGitGraph(commits); - for (const context of [[commits[1]], [commits[0], commits[0], commits[1]]]) { - expect(layoutGitGraph(commits, undefined, { repositoryCommits: context })).toEqual(expected); - } - }); - - test("recognizes non-origin remote short names from actual reference metadata", () => { - const remote: GitReference = { - fullName: "refs/remotes/upstream/work", - shortName: "upstream/work", - kind: "remote", - isCurrent: false, - peelsToCommit: true, - }; - const commits = [ - commit("local", ["root"], "main"), - commit("remote", ["root"], "upstream/work"), - commit("root"), - ]; - const layout = layoutGitGraph(commits, undefined, { references: [remote] }); - expect(layout.rows[1].labels).toEqual([{ title: "upstream/work", kind: "remote" }]); - expect(layout.rows[2].colorIndex).toBe(javaStringHashCode("upstream/work")); - expect(layout.rows[0].colorIndex).toBe(javaStringHashCode("main")); - expect(parseGitDecorations("team/local", new Set(["upstream/work"]))[0].kind).toBe("branch"); - }); - - for (const span of [29, 30, 31, 999, 1_000]) { - test(`compact and expanded long edges preserve topology and visible navigation endpoints at ${span} rows`, () => { - const commits = Array.from({ length: span + 1 }, (_, row) => - commit( - String(row), - row === span ? [] : row === 0 ? ["1", String(span)] : [String(row + 1)], - ), - ); - for (const displayMode of ["compact", "expanded"] as const) { - const layout = layoutGitGraph(commits, undefined, { displayMode }); - const arrows = layout.rows - .flatMap((row) => row.printElements) - .filter((element) => element.hasArrow); - const expectedCount = span < 30 ? 0 : displayMode === "compact" || span < 1_000 ? 2 : 4; - expect(arrows).toHaveLength(expectedCount); - if (expectedCount) - expect(new Set(arrows.map((element) => element.targetHash))).toEqual( - new Set(["0", String(span)]), - ); - expect(layout.rows).toHaveLength(commits.length); - if (span >= 30) - expect(layout.rows[Math.floor(span / 2)].laneCount).toBe( - displayMode === "expanded" && span < 1_000 ? 2 : 1, - ); - for (const [index, row] of layout.rows.entries()) { - for (const element of row.printElements.filter((value) => !value.isTerminal)) { - const neighbor = layout.rows[index + (element.direction === "down" ? 1 : -1)]; - expect( - neighbor.printElements.some( - (other) => - other.id.replace(/:(up|down)$/, "") === element.id.replace(/:(up|down)$/, "") && - other.direction !== element.direction && - other.position === element.adjacentPosition && - other.adjacentPosition === element.position && - other.colorIndex === element.colorIndex, - ), - ).toBe(true); - } - } - } - }); - } - - test("unloaded parent arrows have no fabricated destination", () => { - const layout = layoutGitGraph([commit("tip", ["unloaded"]), commit("other")]); - const arrows = layout.rows - .flatMap((row) => row.printElements) - .filter((element) => element.hasArrow); - expect(arrows).toHaveLength(1); - expect(arrows[0].targetHash).toBeNull(); - }); - - test("the unfiltered 200-commit graph matches the frozen IDEA positions, terminal markers and color identities", () => { - const fixture = (name: string) => - readFileSync( - new URL( - `../../../../../../macos/Tests/LitheTests/Fixtures/GitGraph/${name}`, - import.meta.url, - ), - "utf8", - ); - const commits = fixture("issue410-history.tsv") - .trim() - .split(/\r?\n/) - .map((line) => { - const [hash, parents, decorations] = line.split("\t"); - return commit( - hash, - parents ? parents.split(" ") : [], - decorations.trim().replace(/^\(|\)$/g, ""), - ); - }); - const layout = layoutGitGraph(commits); - const actual = layout.rows - .flatMap((row, index) => [ - `Node|${index}:${row.lane}:${row.colorIndex}`, - ...row.printElements.map( - (element) => - `Edge|${index}:${element.position}:${element.adjacentPosition}:${element.direction.toUpperCase()}:${element.hasArrow}:${element.isTerminal}:${element.isDotted ? "DASHED" : "SOLID"}:${element.colorIndex}`, - ), - ]) - .sort(); - // Compare full signed upstream color IDs, with no palette normalization. - const expected = fixture("issue410-idea.txt") - .trim() - .split(/\r?\n/) - .filter((line) => !line.startsWith("Width|")) - .map((line) => { - const [kind, value] = line.split("|"); - const fields = value.split(":"); - if (kind === "Node") return `Node|${fields[0]}:${fields[1]}:${fields[3]}`; - return `Edge|${fields.join(":")}`; - }) - .sort(); - expect(actual).toEqual(expected); - }); - - test("unfiltered passing edges keep a shared midpoint while compact columns change", () => { - const commits = [ - commit("0", ["1"], "HEAD -> main"), - commit("1", ["3", "2"], "feature"), - commit("2", ["3", "5"]), - commit("3", ["5", "4"]), - commit("4", ["5"]), - commit("5"), - ]; - const layout = layoutGitGraph(commits); - const edge = layout.rows[2].parentEdges.find((candidate) => candidate.parentHash === "5")!; - const down = layout.rows[3].printElements.find((element) => element.id === `${edge.id}:down`)!; - const up = layout.rows[4].printElements.find((element) => element.id === `${edge.id}:up`)!; - expect(down).toMatchObject({ position: 1, adjacentPosition: 2 }); - expect(up).toMatchObject({ position: 2, adjacentPosition: 1, colorIndex: down.colorIndex }); - }); - - test("unfiltered merging half-edges retain each parent's color until the commit node", () => { - const layout = layoutGitGraph([ - commit("merge", ["main", "side"], "HEAD -> main"), - commit("main", ["root"]), - commit("side", ["root"], "feature"), - commit("root"), - ]); - const incoming = layout.rows[3].printElements.filter((element) => element.direction === "up"); - expect(incoming).toHaveLength(2); - expect(new Set(incoming.map((element) => element.colorIndex)).size).toBe(2); - expect(incoming.every((element) => element.position === layout.rows[3].lane)).toBe(true); - for (const row of layout.rows.slice(1, 3)) { - expect( - incoming.find((element) => element.id === `${row.parentEdges[0].id}:up`)?.colorIndex, - ).toBe(row.parentEdges[0].colorIndex); - } - }); - - test("a last-row missing parent does not invent a continuation, and paging resolves it", () => { - const page = layoutGitGraph([commit("head", ["older"])]); - expect(page.hasMissingParents).toBe(true); - expect(page.rows[0].printElements).toEqual([]); - const complete = layoutGitGraph([commit("head", ["older"]), commit("older")]); - expect(complete.hasMissingParents).toBe(false); - expect(complete.rows[0].printElements).toHaveLength(1); - expect(complete.rows[1].printElements).toHaveLength(1); - }); - - test("filtered half-edge positions and dashed styles match the pinned IntelliJ manyNodes fixture", () => { - const fixture = (kind: "in" | "out") => - readFileSync( - new URL( - `../../../../../../macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/elementGenerator/manyNodes_${kind}.txt`, - import.meta.url, - ), - "utf8", - ); - const commits: GitCommit[] = []; - const visible = new Set<string>(); - for (const line of fixture("in").trim().split(/\r?\n/)) { - const [node, targets] = line.split("|-"); - const id = node.split("_")[0]; - visible.add(id); - const hidden: GitCommit[] = []; - const parents = targets - .split(" ") - .filter(Boolean) - .map((target) => { - const [hash, style] = target.split("_"); - if (style !== "D") return hash; - const hiddenHash = `hidden-${id}-${hash}`; - hidden.push(commit(hiddenHash, [hash])); - return hiddenHash; - }); - commits.push(commit(id, parents), ...hidden); - } - // This upstream case has no >=7-row edges, so its custom threshold and - // our 30-row compact threshold produce the same print elements. - const layout = layoutGitGraph(commits, visible); - const actual = layout.rows - .flatMap((row, index) => [ - `Node|${index}:${row.lane}`, - ...row.printElements!.map( - (segment) => - `Edge:${segment.direction.toUpperCase()}:${segment.isDotted ? "DASHED" : "SOLID"}|${index}:${segment.position}:${segment.adjacentPosition}`, - ), - ]) - .sort(); - const expected = fixture("out") - .trim() - .split(/\r?\n/) - .map((line) => { - const [element, position] = line.trim().split("|-"); - return `${element}|${position}`; - }) - .sort(); - expect(actual).toEqual(expected); - }); - - test("projects hidden linear ancestors as dotted edges without changing permanent colors", () => { - const commits = [ - commit("a", ["b"], "HEAD -> feature"), - commit("b", ["c"], "origin/main"), - commit("c", ["d"]), - commit("d"), - ]; - const full = layoutGitGraph(commits); - const filtered = layoutGitGraph(commits, new Set(["a", "d"])); - expect(filtered.rows.map((row) => row.commit.hash)).toEqual(["a", "d"]); - expect(filtered.rows[0].parentEdges).toMatchObject([ - { parentHash: "d", isDotted: true, isMissing: false }, - ]); - expect(filtered.hasMissingParents).toBe(false); - for (const row of filtered.rows) { - expect(row.colorIndex).toBe( - full.rows.find((candidate) => candidate.commit.hash === row.commit.hash)!.colorIndex, - ); - expect(row.printElements?.every((segment) => segment.isDotted)).toBe(true); - } - // Clearing a query recovers the original unfiltered graph and commit objects. - expect(layoutGitGraph(commits)).toEqual(full); - expect(filtered.rows[0].commit).toBe(commits[0]); - }); - - test("preserves direct and hidden merge parents as distinct solid and dotted connections", () => { - const commits = [ - commit("merge", ["left", "hidden"], "HEAD -> main"), - commit("left", ["root"]), - commit("hidden", ["right"]), - commit("right", ["root"]), - commit("root"), - ]; - const filtered = layoutGitGraph(commits, new Set(["merge", "left", "right"])); - expect( - filtered.rows[0].parentEdges.map(({ parentHash, isDotted }) => ({ parentHash, isDotted })), - ).toEqual([ - { parentHash: "left", isDotted: false }, - { parentHash: "right", isDotted: true }, - ]); - expect(filtered.rows.slice(1).every((row) => row.parentEdges.length === 0)).toBe(true); - expect(filtered.hasMissingParents).toBe(false); - // Every nonterminal half connects to the same edge, color and midpoint in - // the next visible row, even while compact columns shift at a merge. - for (let row = 0; row < filtered.rows.length - 1; row += 1) { - for (const down of filtered.rows[row].printElements!.filter( - (segment) => segment.direction === "down", - )) { - const up = filtered.rows[row + 1].printElements!.find( - (segment) => segment.id === down.id.replace(/:down$/, ":up"), - ); - expect(up).toBeDefined(); - expect(up).toMatchObject({ - position: down.adjacentPosition, - adjacentPosition: down.position, - colorIndex: down.colorIndex, - isDotted: down.isDotted, - }); - } - } - }); - - test("a direct parent wins over duplicate hidden paths to the same visible ancestor", () => { - const filtered = layoutGitGraph( - [commit("a", ["hidden", "root", "root"]), commit("hidden", ["root"]), commit("root")], - new Set(["a", "root"]), - ); - expect(filtered.rows[0].parentEdges).toMatchObject([{ parentHash: "root", isDotted: false }]); - expect(filtered.rows[0].parentEdges).toHaveLength(1); - }); - - test("does not connect unrelated visible commits or treat a hidden loaded root as missing", () => { - const filtered = layoutGitGraph( - [commit("a", ["hidden"]), commit("unrelated"), commit("hidden", ["root"]), commit("root")], - new Set(["a", "unrelated"]), - ); - expect( - filtered.rows.every((row) => row.parentEdges.length === 0 && row.printElements?.length === 0), - ).toBe(true); - expect(filtered.hasMissingParents).toBe(false); - }); - - test("projects unloaded parents through hidden ancestors and resolves them when paging", () => { - const page = [commit("a", ["hidden"]), commit("hidden", ["older"]), commit("unrelated")]; - const filtered = layoutGitGraph(page, new Set(["a", "unrelated"])); - expect(filtered.rows[0].parentEdges).toMatchObject([ - { parentHash: "older", isMissing: true, isDotted: true }, - ]); - expect(filtered.hasMissingParents).toBe(true); - expect( - filtered.rows - .flatMap((row) => row.printElements ?? []) - .every((segment) => segment.isDotted && segment.isMissing), - ).toBe(true); - const loaded = layoutGitGraph([...page, commit("older")], new Set(["a", "older"])); - expect(loaded.hasMissingParents).toBe(false); - expect(loaded.rows[0].parentEdges).toMatchObject([ - { parentHash: "older", isMissing: false, isDotted: true }, - ]); - }); - - test("deduplicates hidden missing merge paths and stops boundary propagation at visible parents", () => { - const filtered = layoutGitGraph( - [ - commit("a", ["left", "right", "missing", "missing"]), - commit("left", ["missing", "missing"]), - commit("right", ["missing", "other"]), - ], - new Set(["a"]), - ); - expect( - filtered.rows[0].parentEdges.map(({ parentHash, isDotted }) => ({ parentHash, isDotted })), - ).toEqual([ - { parentHash: "missing", isDotted: false }, - { parentHash: "other", isDotted: true }, - ]); - const stopped = layoutGitGraph( - [commit("a", ["b"]), commit("b", ["hidden"]), commit("hidden", ["missing"])], - new Set(["a", "b"]), - ); - expect(stopped.rows[0].parentEdges).toMatchObject([ - { parentHash: "b", isMissing: false, isDotted: false }, - ]); - expect(stopped.rows[1].parentEdges).toMatchObject([ - { parentHash: "missing", isMissing: true, isDotted: true }, - ]); - }); - - test("an empty match set produces no graph or missing-history marker", () => { - expect(layoutGitGraph([commit("a", ["missing"])], new Set())).toEqual({ - rows: [], - laneCount: 0, - recommendedLaneCount: 0, - hasMissingParents: false, - }); - }); - - test("projects 5,000 hidden merge boundaries without retaining ancestor sets per commit", () => { - const count = 5_000; - const commits = Array.from({ length: count }, (_, row) => - commit( - String(row), - row + 1 < count ? [String(row + 1), `missing-${row}`] : [`missing-${row}`], - ), - ); - const filtered = layoutGitGraph(commits, new Set(["0"])); - expect(filtered.rows).toHaveLength(1); - expect(new Set(filtered.rows[0].parentEdges.map((edge) => edge.parentHash))).toEqual( - new Set(Array.from({ length: count }, (_, row) => `missing-${row}`)), - ); - expect(filtered.hasMissingParents).toBe(true); - }); - - test("keeps a linear history in one fixed lane", () => { - const layout = layoutGitGraph([ - commit("three", ["two"]), - commit("two", ["one"]), - commit("one"), - ]); - - expect(layout.laneCount).toBe(1); - expect(layout.rows.map((row) => row.lane)).toEqual([0, 0, 0]); - expect(layout.hasMissingParents).toBe(false); - }); - - test("opens a stable secondary lane for a merge parent", () => { - const layout = layoutGitGraph([ - commit("merge", ["feature", "root"], "HEAD -> main"), - commit("feature", ["root"], "feature/orders"), - commit("root"), - ]); - - expect(layout.rows[0].parentEdges).toHaveLength(2); - expect(new Set(layout.rows[0].parentEdges.map((edge) => edge.targetLane)).size).toBe(2); - expect(layout.rows[1].parentEdges[0].targetLane).not.toBeNull(); - expect(layout.laneCount).toBeGreaterThan(1); - expect(layout.hasMissingParents).toBe(false); - }); - - test("starts a branch tip lane at its node instead of above it", () => { - // Regression: the newest commit drew a lane segment above its node with nothing above it. - const layout = layoutGitGraph([ - commit("tip", ["base"], "HEAD -> feature"), - commit("base", ["root"]), - commit("side", ["root"], "main"), - commit("root"), - ]); - - expect(layout.rows[0].incomingLaneColors[layout.rows[0].lane]).toBeNull(); - expect(layout.rows[1].incomingLaneColors[layout.rows[1].lane]).toBe(layout.rows[1].colorIndex); - const side = layout.rows[2]; - expect(side.incomingLaneColors[side.lane]).toBeNull(); - // Lanes of other branches passing through the tip row are still drawn. - expect( - side.incomingLaneColors.some((color, lane) => lane !== side.lane && color !== null), - ).toBe(true); - // The node keeps its own lane color even though its lane has no incoming segment. - expect(side.colorIndex).not.toBe(layout.rows[1].colorIndex); - }); - - test("marks parents outside the cumulative snapshot as missing", () => { - const layout = layoutGitGraph([commit("visible", ["not-loaded"])]); - - expect(layout.hasMissingParents).toBe(true); - expect(layout.rows[0].parentEdges[0]).toMatchObject({ targetLane: null, isMissing: true }); - }); - - test("parses head, branch, remote, and tag decorations", () => { - expect(parseGitDecorations("HEAD -> main, origin/main, tag: v1.0.0")).toEqual([ - { title: "HEAD", kind: "head" }, - { title: "main", kind: "branch" }, - { title: "origin/main", kind: "remote" }, - { title: "v1.0.0", kind: "tag" }, - ]); - }); - - test("keeps branch fragments distinct when topology moves them to another lane", () => { - const featureTipInFirstLane = layoutGitGraph([ - commit("tip", ["root"], "feature/orders"), - commit("root"), - ]); - const featureAsSecondParent = layoutGitGraph([ - commit("merge", ["root", "tip"], "HEAD -> main"), - commit("tip", ["root"], "feature/orders"), - commit("root"), - ]); - - expect(colorIndexOfCommit(featureTipInFirstLane, "tip")).toBe( - graphColorIdForName("feature/orders"), - ); - // Once the feature is a secondary parent of the main head, IntelliJ's - // permanent layout gives that side fragment its layout color rather than - // treating it as a new graph head. It must still remain distinct from - // the main fragment. - expect(featureAsSecondParent.rows[1].lane).toBe(1); - expect(colorIndexOfCommit(featureAsSecondParent, "tip")).not.toBe( - colorIndexOfCommit(featureAsSecondParent, "merge"), - ); - expect(colorIndexOfCommit(featureAsSecondParent, "tip")).not.toBe( - colorIndexOfCommit(featureAsSecondParent, "root"), - ); - }); - - test("keeps a local head visually distinct from a decorated parent branch", () => { - const layout = layoutGitGraph([ - commit("local", ["base"], "HEAD -> feature/orders"), - commit("base", ["root"], "origin/main"), - commit("root"), - ]); - - expect(colorIndexOfCommit(layout, "local")).toBe(graphColorIdForName("feature/orders")); - expect(colorIndexOfCommit(layout, "base")).toBe(graphColorIdForName("origin/main")); - expect(colorIndexOfCommit(layout, "local")).not.toBe(colorIndexOfCommit(layout, "base")); - }); - - test("gives unreferenced lanes a deterministic color", () => { - const commits = [commit("a", ["b", "c"]), commit("b", ["d"]), commit("c", ["d"]), commit("d")]; - const first = layoutGitGraph(commits); - const second = layoutGitGraph(commits); - - expect(colorIndexOfCommit(first, "a")).toBe(0); - expect(colorIndexOfCommit(first, "c")).toBe(2); - expect(first.rows.map((row) => row.incomingLaneColors)).toEqual( - second.rows.map((row) => row.incomingLaneColors), - ); - }); - - test("maps reference names through Java String.hashCode", () => { - expect(javaStringHashCode("main")).toBe(3343801); - expect(graphColorIdForName("main")).toBe(3343801); - expect(graphColorIdForName("feature/orders")).toBe(javaStringHashCode("feature/orders")); - }); - - test("prefers the most significant reference for the color identity", () => { - expect( - bestGraphReferenceLabel(parseGitDecorations("HEAD -> main, origin/main, tag: v1")), - ).toMatchObject({ title: "origin/main" }); - expect( - bestGraphReferenceLabel(parseGitDecorations("HEAD -> feature/orders, hotfix")), - ).toMatchObject({ title: "feature/orders" }); - expect(bestGraphReferenceLabel([])).toBeNull(); - }); -}); - -test("linear and single-commit graphs reserve one recommended lane, empty results reserve none", () => { - expect(layoutGitGraph([]).recommendedLaneCount).toBe(0); - expect(layoutGitGraph([commit("root")]).recommendedLaneCount).toBe(1); - expect(layoutGitGraph([commit("tip", ["middle"]), commit("middle", ["root"]), commit("root")]) - .recommendedLaneCount).toBe(1); -}); - -test("a rare dense merge widens its own rows without making every subject reserve that width", () => { - const commits = Array.from({ length: 100 }, (_, row) => commit(String(row), - row === 60 ? Array.from({ length: 8 }, (_, index) => String(61 + index)) - : row > 60 && row <= 68 ? ["69"] : row < 99 ? [String(row + 1)] : [])); - const layout = layoutGitGraph(commits); - expect(layout.laneCount).toBeGreaterThan(6); - expect(layout.recommendedLaneCount).toBeLessThan(layout.laneCount); - expect(layout.recommendedLaneCount).toBeLessThan(6); - // Changing the visible graph recalculates its baseline, using projected edges. - const filtered = layoutGitGraph(commits, new Set(["0", "99"])); - expect(filtered.recommendedLaneCount).toBe(1); -}); diff --git a/windows/tauri/src/features/git/utils/git-graph-layout.ts b/windows/tauri/src/features/git/utils/git-graph-layout.ts deleted file mode 100644 index 456ea9f739..0000000000 --- a/windows/tauri/src/features/git/utils/git-graph-layout.ts +++ /dev/null @@ -1,647 +0,0 @@ -import type { GitCommit, GitReference } from "../types/git.types"; -import { graphColorIdForName } from "./git-graph-colors"; -import { projectGitGraphFilter } from "./git-graph-filter-projection"; - -export type GitGraphLabelKind = "head" | "branch" | "remote" | "tag"; - -export interface GitGraphLabel { - title: string; - kind: GitGraphLabelKind; -} - -export interface GitGraphEdge { - id: string; - parentHash: string; - targetLane: number | null; - /** Signed IDEA color ID, not a palette slot or screen lane. */ - colorIndex: number; - isMissing: boolean; - /** A visible ancestor reached through one or more filtered-out commits. */ - isDotted: boolean; -} - -export interface GitGraphPrintElement { - id: string; - position: number; - adjacentPosition: number; - direction: "up" | "down"; - colorIndex: number; - isDotted: boolean; - isMissing: boolean; - /** Compact long edges and unloaded parents end with a directional marker. */ - hasArrow: boolean; - isTerminal: boolean; - /** Loaded visible endpoint; missing history never invents a navigation target. */ - targetHash: string | null; -} - -export interface GitGraphRow { - commit: GitCommit; - lane: number; - /** Color of the commit node and its own lane. */ - colorIndex: number; - laneCount: number; - /** Row-center color summary for structural diagnostics, never a drawing route. */ - incomingLaneColors: Array<number | null>; - parentEdges: GitGraphEdge[]; - labels: GitGraphLabel[]; - /** Explicit half-edges retain identity, geometry and color for every graph row. */ - printElements: GitGraphPrintElement[]; -} - -export interface GitGraphLayout { - rows: GitGraphRow[]; - laneCount: number; - /** IDEA's weighted visible-edge width; a baseline, not the widest row. */ - recommendedLaneCount: number; - hasMissingParents: boolean; -} - -interface GraphEdge { - up: number; - down: number | null; - parentHash: string; - id: string; - isDotted: boolean; -} - -type GraphElement = { kind: "node"; row: number } | { kind: "edge"; edge: number }; - -export const GIT_GRAPH_DISPLAY_OPTIONS = { - compact: { longEdgeSize: 30, visiblePartSize: 1, edgeWithArrowSize: Infinity }, - expanded: { longEdgeSize: 1_000, visiblePartSize: 250, edgeWithArrowSize: 30 }, -} as const; - -export interface GitGraphLayoutOptions { - references?: readonly GitReference[]; - repositoryCommits?: readonly GitCommit[]; - displayMode?: keyof typeof GIT_GRAPH_DISPLAY_OPTIONS; -} - -const RECOMMENDED_WIDTH_SAMPLE_SIZE = 20_000; -const RECOMMENDED_WIDTH_WEIGHT_RATIO = 0.1; - -/** PrintElementGeneratorImpl's weighted mean + deviation, using edge intervals. */ -function recommendedGraphWidth( - rowCount: number, - edges: readonly GraphEdge[], - display: (typeof GIT_GRAPH_DISPLAY_OPTIONS)[keyof typeof GIT_GRAPH_DISPLAY_OPTIONS], -): number { - const count = Math.min(RECOMMENDED_WIDTH_SAMPLE_SIZE, rowCount); - if (count <= 1) return count; - const changes = new Int32Array(count + 1); - const missing = new Int32Array(count); - const add = (start: number, end: number) => { - if (start >= count) return; - changes[start] += 1; - changes[Math.min(end, count)] -= 1; - }; - for (const edge of edges) { - if (edge.down === null) { - if (edge.up < count) missing[edge.up] += 1; - } else if (edge.down - edge.up < display.longEdgeSize) { - add(edge.up, edge.down); - } else { - add(edge.up, edge.up + display.visiblePartSize + 1); - add(edge.down - display.visiblePartSize, edge.down); - } - } - let current = 0; - let previous = 0; - let sum = 0; - let squares = 0; - for (let row = 0; row < count; row += 1) { - current += changes[row]; - const width = Math.max(previous, current + missing[row]); - const weight = 2 / (count * (RECOMMENDED_WIDTH_WEIGHT_RATIO + 1)) - * (1 + (RECOMMENDED_WIDTH_WEIGHT_RATIO - 1) * row / (count - 1)); - sum += width * weight; - squares += width * width * weight; - previous = current; - } - return Math.round(sum + Math.sqrt(Math.max(0, squares - sum * sum))); -} - -function stableElementKey(element: GraphElement): number { - return element.kind === "node" ? -1 : element.edge; -} - -export function parseGitDecorations( - decorations: string, - remoteNames: ReadonlySet<string> = new Set(), -): GitGraphLabel[] { - return decorations.split(",").flatMap((value): GitGraphLabel[] => { - const raw = value.trim(); - if (!raw) return []; - if (raw === "HEAD") return [{ title: "HEAD", kind: "head" }]; - if (raw.startsWith("HEAD -> ")) { - return [ - { title: "HEAD", kind: "head" }, - { title: localBranchName(raw.slice("HEAD -> ".length)), kind: "branch" }, - ]; - } - if (raw.startsWith("tag: ")) return [{ title: raw.slice("tag: ".length), kind: "tag" }]; - if (raw.startsWith("refs/tags/")) { - return [{ title: raw.slice("refs/tags/".length), kind: "tag" }]; - } - if (remoteNames.has(raw) || raw.startsWith("origin/") || raw.startsWith("refs/remotes/")) { - return [ - { - title: raw.startsWith("refs/remotes/") ? raw.slice("refs/remotes/".length) : raw, - kind: "remote", - }, - ]; - } - return [{ title: localBranchName(raw), kind: "branch" }]; - }); -} - -function localBranchName(name: string): string { - return name.startsWith("refs/heads/") ? name.slice("refs/heads/".length) : name; -} - -/** - * IDEA's GraphColorGetterByHead picks a head's principal reference in this - * order, so the same branch name always yields the same color id. - */ -function graphLabelPriority(label: GitGraphLabel): number { - if (label.kind === "remote") { - return label.title === "origin/main" || label.title === "origin/master" ? 0 : 1; - } - if (label.kind === "branch") { - return label.title === "main" || label.title === "master" ? 2 : 3; - } - return label.kind === "tag" ? 4 : 6; -} - -/** The natural-name ordering used by IntelliJ's Git reference comparator. */ -export function naturalCompare(left: string, right: string, ignoreCase = true): number { - const a = Array.from({ length: left.length }, (_, index) => left.charCodeAt(index)); - const b = Array.from({ length: right.length }, (_, index) => right.charCodeAt(index)); - let i = 0; - let j = 0; - const isDigit = (value: number) => value >= 48 && value <= 57; - const simpleCaseUnit = (value: number, uppercase: boolean) => { - if (value >= 0x61 && value <= 0x7a) return uppercase ? value - 0x20 : value; - if (value >= 0x41 && value <= 0x5a) return uppercase ? value : value + 0x20; - const mapped = String.fromCharCode(value)[uppercase ? "toUpperCase" : "toLowerCase"](); - return mapped.length === 1 ? mapped.charCodeAt(0) : value; - }; - - while (i < a.length && j < b.length) { - const first = a[i]; - const second = b[j]; - if ((isDigit(first) || first === 32) && (isDigit(second) || second === 32)) { - let firstStart = i; - while (firstStart < a.length && a[firstStart] === 32) firstStart += 1; - while (firstStart < a.length && a[firstStart] === 48) firstStart += 1; - let firstEnd = firstStart; - while (firstEnd < a.length && isDigit(a[firstEnd])) firstEnd += 1; - - let secondStart = j; - while (secondStart < b.length && b[secondStart] === 32) secondStart += 1; - while (secondStart < b.length && b[secondStart] === 48) secondStart += 1; - let secondEnd = secondStart; - while (secondEnd < b.length && isDigit(b[secondEnd])) secondEnd += 1; - - const firstLength = firstEnd - firstStart; - const secondLength = secondEnd - secondStart; - if (firstLength !== secondLength) return firstLength - secondLength; - for (let offset = 0; offset < firstLength; offset += 1) { - const difference = a[firstStart + offset] - b[secondStart + offset]; - if (difference !== 0) return difference; - } - const lengthDifference = firstEnd - i - (secondEnd - j); - if (lengthDifference !== 0) return lengthDifference; - for (let offset = 0; offset < firstStart - i; offset += 1) { - const difference = a[i + offset] - b[j + offset]; - if (difference !== 0) return difference; - } - i = firstEnd; - j = secondEnd; - continue; - } - - if (first === 32 && second > 32 && second < 48) return 1; - if (second === 32 && first > 32 && first < 48) return -1; - let difference = first - second; - if (difference !== 0 && ignoreCase) { - const upperDifference = simpleCaseUnit(first, true) - simpleCaseUnit(second, true); - difference = - upperDifference !== 0 - ? upperDifference - : simpleCaseUnit(first, false) - simpleCaseUnit(second, false); - } - if (difference !== 0) return difference; - i += 1; - j += 1; - } - if (i < a.length) return 1; - if (j < b.length) return -1; - if (a.length !== b.length) return a.length - b.length; - return ignoreCase ? naturalCompare(left, right, false) : 0; -} - -function compareGraphLabels(left: GitGraphLabel, right: GitGraphLabel): number { - const priorityDifference = graphLabelPriority(left) - graphLabelPriority(right); - return priorityDifference !== 0 ? priorityDifference : naturalCompare(left.title, right.title); -} - -export function bestGraphReferenceLabel(labels: GitGraphLabel[]): GitGraphLabel | null { - let best: GitGraphLabel | null = null; - for (const label of labels) { - if (best === null || compareGraphLabels(label, best) < 0) best = label; - } - return best; -} - -function sortedHeads(labels: GitGraphLabel[][], children: number[][]): number[] { - return labels - .map((value, index) => ({ index, labels: value, best: bestGraphReferenceLabel(value) })) - .filter( - ({ index, labels: value }) => - children[index].length === 0 || value.some((label) => label.kind !== "tag"), - ) - .sort((left, right) => { - if (left.best && right.best) { - const comparison = compareGraphLabels(left.best, right.best); - return comparison !== 0 ? comparison : left.index - right.index; - } - if (left.best) return -1; - if (right.best) return 1; - return left.index - right.index; - }) - .map(({ index }) => index); -} - -/** - * Reproduces the permanent layout used by macOS's IntelliJ-compatible graph. - * The graph head order is intentionally independent from the screen columns: - * a parent branch reference can therefore keep its color when a local branch - * is added on top of it. - */ -function permanentLayout( - labels: GitGraphLabel[][], - parents: number[][], - children: number[][], -): { indices: number[]; colors: number[] } { - const indices = Array<number>(parents.length).fill(0); - const colors = Array<number>(parents.length).fill(0); - const nextParent = Array<number>(parents.length).fill(0); - let layoutIndex = 1; - - for (const head of sortedHeads(labels, children)) { - if (indices[head] !== 0) continue; - const stack = [head]; - const headIndex = layoutIndex; - const headReference = bestGraphReferenceLabel(labels[head]); - const headColor = headReference ? graphColorIdForName(headReference.title) : 0; - - while (stack.length > 0) { - const node = stack[stack.length - 1]; - const firstVisit = indices[node] === 0; - if (firstVisit) { - indices[node] = layoutIndex; - colors[node] = layoutIndex === headIndex ? headColor : layoutIndex; - } - while ( - nextParent[node] < parents[node].length && - indices[parents[node][nextParent[node]]] !== 0 - ) { - nextParent[node] += 1; - } - if (nextParent[node] < parents[node].length) { - stack.push(parents[node][nextParent[node]]); - } else { - if (firstVisit) layoutIndex += 1; - stack.pop(); - } - } - } - - // A well-formed Git history always has a head for every component. Keep a - // deterministic fallback for incomplete snapshots or defensive fixtures. - for (let node = 0; node < parents.length; node += 1) { - if (indices[node] !== 0) continue; - const stack = [node]; - const headIndex = layoutIndex; - while (stack.length > 0) { - const current = stack[stack.length - 1]; - if (indices[current] === 0) { - indices[current] = layoutIndex; - colors[current] = layoutIndex === headIndex ? 0 : layoutIndex; - } - while ( - nextParent[current] < parents[current].length && - indices[parents[current][nextParent[current]]] !== 0 - ) { - nextParent[current] += 1; - } - if (nextParent[current] < parents[current].length) - stack.push(parents[current][nextParent[current]]); - else { - layoutIndex += 1; - stack.pop(); - } - } - } - - return { indices, colors }; -} - -function compareEdgeToNode(edge: GraphEdge, node: number, indices: number[]): number { - const nodeIndex = indices[node]; - if (edge.down === null) return indices[edge.up] - nodeIndex; - const edgeIndex = Math.max(indices[edge.up], indices[edge.down]); - return edgeIndex !== nodeIndex ? edgeIndex - nodeIndex : edge.up - node; -} - -function compareElements( - left: GraphElement, - right: GraphElement, - edges: GraphEdge[], - indices: number[], -): number { - if (left.kind === "node" && right.kind === "node") return 0; - if (left.kind === "edge" && right.kind === "node") { - return compareEdgeToNode(edges[left.edge], right.row, indices); - } - if (left.kind === "node" && right.kind === "edge") { - return -compareEdgeToNode(edges[right.edge], left.row, indices); - } - if (left.kind === "node" || right.kind === "node") return 0; - - const first = edges[left.edge]; - const second = edges[right.edge]; - if (first.down === null) return -compareEdgeToNode(second, first.up, indices); - if (second.down === null) return compareEdgeToNode(first, second.up, indices); - if (first.up === second.up) { - return first.down < second.down - ? -compareEdgeToNode(second, first.down, indices) - : compareEdgeToNode(first, second.down, indices); - } - return first.up < second.up - ? compareEdgeToNode(first, second.up, indices) - : -compareEdgeToNode(second, first.up, indices); -} - -// Note: IntelliJ graph parity and cross-platform ownership are documented in -// .agents/notes/implemented/feature/2026-09-25-windows-git-graph-branch-colors.md. -export function layoutGitGraph( - inputCommits: GitCommit[], - visibleHashes?: ReadonlySet<string>, - options: GitGraphLayoutOptions = {}, -): GitGraphLayout { - let commits = inputCommits; - if (commits.length === 0) return { rows: [], laneCount: 0, recommendedLaneCount: 0, hasMissingParents: false }; - - const remoteNames = new Set( - options.references - ?.filter((reference) => reference.kind === "remote") - .map((reference) => reference.shortName), - ); - const display = GIT_GRAPH_DISPLAY_OPTIONS[options.displayMode ?? "compact"]; - const context = options.repositoryCommits ?? []; - const contextRows = new Map(context.map((commit, row) => [commit.hash, row])); - let contextPermanent: ReturnType<typeof permanentLayout> | undefined; - // Match macOS: use only a unique context covering every scoped commit. - // A bounded-context miss falls back to the page; it never drops old commits. - if ( - context.length > 0 && - contextRows.size === context.length && - commits.every((commit) => contextRows.has(commit.hash)) - ) { - const contextParents = context.map(() => [] as number[]); - const contextChildren = context.map(() => [] as number[]); - context.forEach((commit, row) => { - for (const hash of new Set(commit.parentHashes)) { - const parent = contextRows.get(hash); - if (parent === undefined || parent <= row) continue; - contextParents[row].push(parent); - contextChildren[parent].push(row); - } - }); - contextPermanent = permanentLayout( - context.map((commit) => parseGitDecorations(commit.decorations, remoteNames)), - contextParents, - contextChildren, - ); - const scoped = new Map<string, GitCommit>(); - for (const commit of commits) if (!scoped.has(commit.hash)) scoped.set(commit.hash, commit); - commits = context.flatMap((commit) => - scoped.has(commit.hash) ? [scoped.get(commit.hash)!] : [], - ); - } - - const firstRowByHash = new Map<string, number>(); - for (const [row, commit] of commits.entries()) { - if (!firstRowByHash.has(commit.hash)) firstRowByHash.set(commit.hash, row); - } - - const labelsByRow = commits.map((commit) => parseGitDecorations(commit.decorations, remoteNames)); - const parents = commits.map(() => [] as number[]); - const children = commits.map(() => [] as number[]); - let edges: GraphEdge[] = []; - - for (const [row, commit] of commits.entries()) { - const seenParents = new Set<number>(); - const seenMissingParents = new Set<string>(); - for (const [parentIndex, parentHash] of commit.parentHashes.entries()) { - const parent = firstRowByHash.get(parentHash); - if (parent === undefined || parent <= row || seenParents.has(parent)) { - if (parent === undefined && !seenMissingParents.has(parentHash)) { - seenMissingParents.add(parentHash); - edges.push({ - up: row, - down: null, - parentHash, - id: `${row}:${parentHash}:missing`, - isDotted: false, - }); - } - continue; - } - seenParents.add(parent); - parents[row].push(parent); - children[parent].push(row); - edges.push({ - up: row, - down: parent, - parentHash, - id: `${row}:${parent}:${parentHash}:${parentIndex}`, - isDotted: false, - }); - } - } - - const permanent = contextPermanent - ? { - indices: commits.map((commit) => contextPermanent!.indices[contextRows.get(commit.hash)!]), - colors: commits.map((commit) => contextPermanent!.colors[contextRows.get(commit.hash)!]), - } - : permanentLayout(labelsByRow, parents, children); - const visible = commits.flatMap((commit, row) => - visibleHashes === undefined || - (visibleHashes.has(commit.hash) && firstRowByHash.get(commit.hash) === row) - ? [row] - : [], - ); - if (visible.length === 0) return { rows: [], laneCount: 0, recommendedLaneCount: 0, hasMissingParents: false }; - const visibleCommits = visible.map((row) => commits[row]); - const indices = visible.map((row) => permanent.indices[row]); - const colors = visible.map((row) => permanent.colors[row]); - if (visibleHashes !== undefined) { - const visibleRows = new Map(visible.map((row, index) => [row, index])); - edges = projectGitGraphFilter( - commits.map((commit) => commit.hash), - commits.map((commit) => commit.parentHashes), - parents, - children, - visible, - ).map((edge) => ({ - ...edge, - id: `${commits[edge.up].hash}:${edge.parentHash}:${edge.isDotted ? "filtered" : "direct"}`, - up: visibleRows.get(edge.up)!, - down: edge.down === null ? null : visibleRows.get(edge.down)!, - })); - } - edges.sort((left, right) => { - if (left.up !== right.up) return left.up - right.up; - if (left.down !== right.down) - return (left.down ?? Number.MAX_SAFE_INTEGER) - (right.down ?? Number.MAX_SAFE_INTEGER); - return left.parentHash < right.parentHash ? -1 : left.parentHash > right.parentHash ? 1 : 0; - }); - - const elements: GraphElement[][] = visibleCommits.map((_, row) => [ - { kind: "node" as const, row }, - ]); - const adjacent: number[][] = visibleCommits.map(() => []); - for (const [edgeIndex, edge] of edges.entries()) { - adjacent[edge.up].push(edgeIndex); - if (edge.down !== null) { - adjacent[edge.down].push(edgeIndex); - const span = edge.down - edge.up; - if (span > 1) { - if (span < display.longEdgeSize) { - for (let row = edge.up + 1; row < edge.down; row += 1) { - elements[row].push({ kind: "edge", edge: edgeIndex }); - } - } else { - for (let row = edge.up + 1; row <= edge.up + display.visiblePartSize; row += 1) { - elements[row].push({ kind: "edge", edge: edgeIndex }); - } - for (let row = edge.down - display.visiblePartSize; row < edge.down; row += 1) { - elements[row].push({ kind: "edge", edge: edgeIndex }); - } - } - } - } else if (edge.up + 1 < visibleCommits.length) { - elements[edge.up + 1].push({ kind: "edge", edge: edgeIndex }); - } - } - - const positions = elements.map(() => new Map<number, number>()); - const nodePositions = Array<number>(visibleCommits.length).fill(0); - for (let row = 0; row < elements.length; row += 1) { - const rowElements = elements[row]; - rowElements.sort((left, right) => { - const order = compareElements(left, right, edges, indices); - return order === 0 ? stableElementKey(left) - stableElementKey(right) : order; - }); - elements[row] = rowElements; - rowElements.forEach((element, position) => { - if (element.kind === "node") { - nodePositions[row] = position; - for (const edge of adjacent[row]) positions[row].set(edge, position); - } else { - positions[row].set(element.edge, position); - } - }); - } - - const edgeColor = (edge: GraphEdge): number => { - if (edge.down === null) return colors[edge.up]; - return indices[edge.up] > indices[edge.down] ? colors[edge.up] : colors[edge.down]; - }; - - const rows: GitGraphRow[] = visibleCommits.map((commit, row) => { - const incomingLaneColors = elements[row].map((element) => - element.kind === "edge" - ? edgeColor(edges[element.edge]) - : adjacent[row].some((edge) => edges[edge].down === row) - ? colors[row] - : null, - ); - const parentEdges = adjacent[row] - .filter((edgeIndex) => edges[edgeIndex].up === row) - .map((edgeIndex) => { - const edge = edges[edgeIndex]; - return { - id: edge.id, - parentHash: edge.parentHash, - targetLane: - row + 1 < visibleCommits.length ? (positions[row + 1].get(edgeIndex) ?? null) : null, - colorIndex: edgeColor(edge), - isMissing: edge.down === null, - isDotted: edge.isDotted, - }; - }); - // PrintElementGeneratorImpl: both halves keep the same edge identity and - // boundary midpoint; incoming colors must never be inferred from the node. - const printElements = elements[row].flatMap((element, position) => { - const ids = element.kind === "edge" ? [element.edge] : adjacent[row]; - return ids.flatMap((id) => { - const edge = edges[id]; - return (["up", "down"] as const).flatMap((direction): GitGraphPrintElement[] => { - const next = row + (direction === "up" ? -1 : 1); - const nextPosition = positions[next]?.get(id); - const hasArrow = - edge.down === null - ? direction === "down" && row === edge.up + 1 - : (edge.down - edge.up >= display.longEdgeSize && - (direction === "down" ? row - edge.up : edge.down - row) === - display.visiblePartSize) || - (edge.down - edge.up >= display.edgeWithArrowSize && - (direction === "down" ? row - edge.up : edge.down - row) === 1); - // Missing-parent markers belong on the next row. Never invent - // a continuation above a tip or below the last visible node. - if (nextPosition === undefined && !hasArrow) return []; - return [ - { - id: `${edge.id}:${direction}`, - position, - adjacentPosition: nextPosition ?? position, - direction, - colorIndex: edgeColor(edge), - isDotted: edge.isDotted, - isMissing: edge.down === null, - hasArrow, - isTerminal: nextPosition === undefined, - targetHash: - edge.down === null - ? null - : visibleCommits[direction === "down" ? edge.down : edge.up].hash, - }, - ]; - }); - }); - }); - return { - commit, - lane: nodePositions[row], - colorIndex: colors[row], - laneCount: elements[row].length, - incomingLaneColors, - parentEdges, - labels: labelsByRow[visible[row]], - printElements, - }; - }); - - return { - rows, - laneCount: Math.max(1, ...rows.map((row) => row.laneCount)), - recommendedLaneCount: recommendedGraphWidth(visibleCommits.length, edges, display), - hasMissingParents: edges.some((edge) => edge.down === null), - }; -} diff --git a/windows/tauri/src/features/git/utils/git-graph-reference-group.test.ts b/windows/tauri/src/features/git/utils/git-graph-reference-group.test.ts index d1d32f57c0..82c301fb6f 100644 --- a/windows/tauri/src/features/git/utils/git-graph-reference-group.test.ts +++ b/windows/tauri/src/features/git/utils/git-graph-reference-group.test.ts @@ -1,5 +1,5 @@ import { expect, test } from "bun:test"; -import { parseGitDecorations } from "./git-graph-layout"; +import { stubGitGraphProjection } from "@/test-utils/git-graph-projection-stub"; import { gitReferenceIconWidth, groupGitGraphReferences, @@ -7,6 +7,11 @@ import { } from "./git-graph-reference-group"; import type { GitReference } from "../types/git.types"; +/** Labels exactly as Core types a commit's decorations. */ +const parseGitDecorations = (decorations: string) => + stubGitGraphProjection({ commits: [{ hash: "x", decorations }] }, { geometryFree: true }).rows[0] + .labels; + const references: GitReference[] = [ { fullName: "refs/heads/main", diff --git a/windows/tauri/src/features/git/utils/git-graph-reference-group.ts b/windows/tauri/src/features/git/utils/git-graph-reference-group.ts index f477bbf5e1..e81b5b79af 100644 --- a/windows/tauri/src/features/git/utils/git-graph-reference-group.ts +++ b/windows/tauri/src/features/git/utils/git-graph-reference-group.ts @@ -1,7 +1,8 @@ // Adapted from macOS GitGraphReferenceGroup and IntelliJ LabelPainter. // Apache-2.0 attribution: macos/Resources/GitGraph/NOTICE.txt. import type { GitReference } from "../types/git.types"; -import { naturalCompare, type GitGraphLabel, type GitGraphLabelKind } from "./git-graph-layout"; +import type { GitGraphLabel, GitGraphLabelKind } from "../api/git-graph-projection-api"; +import { naturalCompare } from "./git-reference-name-compare"; export interface GitGraphReferenceGroup { title: string; diff --git a/windows/tauri/src/features/git/utils/git-log-branch-filter.ts b/windows/tauri/src/features/git/utils/git-log-branch-filter.ts index a04a871f4d..749e1ca289 100644 --- a/windows/tauri/src/features/git/utils/git-log-branch-filter.ts +++ b/windows/tauri/src/features/git/utils/git-log-branch-filter.ts @@ -1,5 +1,5 @@ import type { GitReference } from "../types/git.types"; -import { naturalCompare } from "./git-graph-layout"; +import { naturalCompare } from "./git-reference-name-compare"; import { isRemoteSymbolicReference } from "./git-log-refresh"; export interface GitLogBranchFilterGroup { diff --git a/windows/tauri/src/features/git/utils/git-reference-name-compare.ts b/windows/tauri/src/features/git/utils/git-reference-name-compare.ts new file mode 100644 index 0000000000..6f1ee66487 --- /dev/null +++ b/windows/tauri/src/features/git/utils/git-reference-name-compare.ts @@ -0,0 +1,71 @@ +// Display-order comparison for reference names (branch filter lists and reference +// groups). Graph head ordering is Core's (`git.graphProjection`); this is the same +// IntelliJ `NaturalComparator` order for UI sorting. + +/** The natural-name ordering used by IntelliJ's Git reference comparator. */ +export function naturalCompare(left: string, right: string, ignoreCase = true): number { + const a = Array.from({ length: left.length }, (_, index) => left.charCodeAt(index)); + const b = Array.from({ length: right.length }, (_, index) => right.charCodeAt(index)); + let i = 0; + let j = 0; + const isDigit = (value: number) => value >= 48 && value <= 57; + const simpleCaseUnit = (value: number, uppercase: boolean) => { + if (value >= 0x61 && value <= 0x7a) return uppercase ? value - 0x20 : value; + if (value >= 0x41 && value <= 0x5a) return uppercase ? value : value + 0x20; + const mapped = String.fromCharCode(value)[uppercase ? "toUpperCase" : "toLowerCase"](); + return mapped.length === 1 ? mapped.charCodeAt(0) : value; + }; + + while (i < a.length && j < b.length) { + const first = a[i]; + const second = b[j]; + if ((isDigit(first) || first === 32) && (isDigit(second) || second === 32)) { + let firstStart = i; + while (firstStart < a.length && a[firstStart] === 32) firstStart += 1; + while (firstStart < a.length && a[firstStart] === 48) firstStart += 1; + let firstEnd = firstStart; + while (firstEnd < a.length && isDigit(a[firstEnd])) firstEnd += 1; + + let secondStart = j; + while (secondStart < b.length && b[secondStart] === 32) secondStart += 1; + while (secondStart < b.length && b[secondStart] === 48) secondStart += 1; + let secondEnd = secondStart; + while (secondEnd < b.length && isDigit(b[secondEnd])) secondEnd += 1; + + const firstLength = firstEnd - firstStart; + const secondLength = secondEnd - secondStart; + if (firstLength !== secondLength) return firstLength - secondLength; + for (let offset = 0; offset < firstLength; offset += 1) { + const difference = a[firstStart + offset] - b[secondStart + offset]; + if (difference !== 0) return difference; + } + const lengthDifference = firstEnd - i - (secondEnd - j); + if (lengthDifference !== 0) return lengthDifference; + for (let offset = 0; offset < firstStart - i; offset += 1) { + const difference = a[i + offset] - b[j + offset]; + if (difference !== 0) return difference; + } + i = firstEnd; + j = secondEnd; + continue; + } + + if (first === 32 && second > 32 && second < 48) return 1; + if (second === 32 && first > 32 && first < 48) return -1; + let difference = first - second; + if (difference !== 0 && ignoreCase) { + const upperDifference = simpleCaseUnit(first, true) - simpleCaseUnit(second, true); + difference = + upperDifference !== 0 + ? upperDifference + : simpleCaseUnit(first, false) - simpleCaseUnit(second, false); + } + if (difference !== 0) return difference; + i += 1; + j += 1; + } + if (i < a.length) return 1; + if (j < b.length) return -1; + if (a.length !== b.length) return a.length - b.length; + return ignoreCase ? naturalCompare(left, right, false) : 0; +} diff --git a/windows/tauri/src/test-utils/git-graph-projection-stub.test.ts b/windows/tauri/src/test-utils/git-graph-projection-stub.test.ts new file mode 100644 index 0000000000..034ae57272 --- /dev/null +++ b/windows/tauri/src/test-utils/git-graph-projection-stub.test.ts @@ -0,0 +1,60 @@ +import { describe, expect, test } from "bun:test"; +import fixture from "../../../../shared/fixtures/git/graph-projection-v1.json"; +import { + geometryFreeProjection, + linearChainProjection, + normalizeGraphRequest, + stubGitGraphProjection, +} from "./git-graph-projection-stub"; + +const cases = fixture.cases as unknown as Array<{ + name: string; + request: Record<string, unknown>; + response: ReturnType<typeof stubGitGraphProjection>; +}>; + +describe("git.graphProjection test stub", () => { + for (const testCase of cases) { + test(`answers ${testCase.name} with Core's recorded response`, () => { + expect(stubGitGraphProjection(testCase.request)).toBe(testCase.response); + }); + } + + test("geometry-free rows, labels and ancestry match Core for every fixture case", () => { + for (const testCase of cases) { + const request = normalizeGraphRequest(testCase.request); + // A repository context reorders the scoped rows; that is Core's rule. + if (request.repositoryCommits.length > 0) continue; + const actual = geometryFreeProjection(request); + expect( + actual.rows.map((row) => [row.commitHash, row.labels]), + testCase.name, + ).toEqual(testCase.response.rows.map((row) => [row.commitHash, row.labels])); + expect(actual.currentBranchHashes, testCase.name).toEqual( + testCase.response.currentBranchHashes, + ); + } + }); + + test("projects a linear chain exactly as Core does", () => { + const linear = cases.filter( + (testCase) => linearChainProjection(normalizeGraphRequest(testCase.request)) !== null, + ); + expect(linear.length).toBeGreaterThan(0); + for (const testCase of linear) { + expect(linearChainProjection(normalizeGraphRequest(testCase.request))).toEqual( + testCase.response, + ); + } + }); + + test("refuses a history it cannot answer, unless geometry is not asserted", () => { + const request = { + commits: [{ hash: "m", parentHashes: ["a", "b"] }, { hash: "a" }, { hash: "b" }], + }; + expect(() => stubGitGraphProjection(request)).toThrow("not in the shared fixture"); + const rows = stubGitGraphProjection(request, { geometryFree: true }).rows; + expect(rows.map((row) => row.commitHash)).toEqual(["m", "a", "b"]); + expect(rows.every((row) => row.printElements.length === 0)).toBe(true); + }); +}); diff --git a/windows/tauri/src/test-utils/git-graph-projection-stub.ts b/windows/tauri/src/test-utils/git-graph-projection-stub.ts new file mode 100644 index 0000000000..75656172ee --- /dev/null +++ b/windows/tauri/src/test-utils/git-graph-projection-stub.ts @@ -0,0 +1,252 @@ +import * as native from "@/platform/tauri-core"; +import { spyOn } from "bun:test"; +import fixture from "../../../../shared/fixtures/git/graph-projection-v1.json"; +import { + attachGitGraphCommits, + type GitGraphLabel, + type GitGraphLayout, + type GitGraphProjection, + type GitGraphProjectionRequest, +} from "@/features/git/api/git-graph-projection-api"; +import type { GitCommit } from "@/features/git/types/git.types"; + +type FixtureCase = { name: string; request: unknown; response: GitGraphProjection }; +const cases = fixture.cases as unknown as FixtureCase[]; + +type NormalizedCommit = { hash: string; parentHashes: string[]; decorations: string }; +type NormalizedRequest = { + commits: NormalizedCommit[]; + remoteNames: string[]; + repositoryCommits: NormalizedCommit[]; + visibleHashes: string[] | null; + displayMode: string; + currentBranch: string | null; +}; + +const commitOf = (value: Record<string, any>): NormalizedCommit => ({ + hash: value.hash, + parentHashes: value.parentHashes ?? [], + decorations: value.decorations ?? "", +}); + +/** Fills every default Core applies, so equal requests compare equal as JSON. */ +export function normalizeGraphRequest(request: Record<string, any>): NormalizedRequest { + return { + commits: request.commits.map(commitOf), + remoteNames: request.remoteNames ?? [], + repositoryCommits: (request.repositoryCommits ?? []).map(commitOf), + visibleHashes: request.visibleHashes ?? null, + displayMode: request.displayMode ?? "compact", + currentBranch: request.currentBranch ?? null, + }; +} + +const key = (request: Record<string, any>) => JSON.stringify(normalizeGraphRequest(request)); +const byRequest = new Map(cases.map((value) => [key(value.request as Record<string, any>), value])); + +/** The shared-fixture case Core's response is defined by, when the request is one of them. */ +export function graphFixtureCase(name: string): FixtureCase { + const found = cases.find((value) => value.name === name); + if (!found) throw new Error(`No graph projection fixture named ${name}`); + return found; +} + +/** Commits of a fixture case, as the host would hold them. */ +export function graphFixtureCommits(name: string): GitCommit[] { + return normalizeGraphRequest(graphFixtureCase(name).request as Record<string, any>).commits.map( + (commit) => ({ + ...commit, + shortHash: commit.hash, + message: commit.hash, + author: "Fixture", + date: "unknown", + }), + ); +} + +/** The layout Core returns for a fixture case, with the fixture commits attached. */ +export function graphFixtureLayout(name: string): GitGraphLayout { + return attachGitGraphCommits(graphFixtureCommits(name), graphFixtureCase(name).response); +} + +function parseLabels(decorations: string, remoteNames: ReadonlySet<string>): GitGraphLabel[] { + const label = (title: string, kind: GitGraphLabel["kind"]) => ({ id: `${kind}:${title}`, title, kind }); + const local = (name: string) => name.replace(/^refs\/heads\//, ""); + return decorations.split(",").flatMap((value): GitGraphLabel[] => { + const raw = value.trim(); + if (!raw) return []; + if (raw === "HEAD") return [label("HEAD", "head")]; + if (raw.startsWith("HEAD -> ")) { + return [label("HEAD", "head"), label(local(raw.slice("HEAD -> ".length)), "branch")]; + } + if (raw.startsWith("tag: ")) return [label(raw.slice("tag: ".length), "tag")]; + if (raw.startsWith("refs/tags/")) return [label(raw.slice("refs/tags/".length), "tag")]; + if (remoteNames.has(raw) || raw.startsWith("origin/") || raw.startsWith("refs/remotes/")) { + return [label(raw.replace(/^refs\/remotes\//, ""), "remote")]; + } + return [label(local(raw), "branch")]; + }); +} + +/** + * Rows and labels only, with no routing: one lane, color zero, no edges. Table behavior tests + * that do not assert geometry use it for histories that are not in the shared fixture. + * First occurrences win and `visibleHashes` filters, as in Core. + */ +export function geometryFreeProjection(request: NormalizedRequest): GitGraphProjection { + const remoteNames = new Set(request.remoteNames); + const visible = request.visibleHashes ? new Set(request.visibleHashes) : null; + const seen = new Set<string>(); + const rows = request.commits + .filter((commit) => { + if (seen.has(commit.hash)) return false; + seen.add(commit.hash); + return !visible || visible.has(commit.hash); + }) + .map((commit) => ({ + commitHash: commit.hash, + lane: 0, + laneCount: 1, + colorId: 0, + layoutIndex: 1, + incomingLaneColors: [0], + parentEdges: [], + labels: parseLabels(commit.decorations, remoteNames), + printElements: [], + })); + const hashes = new Map<string, NormalizedCommit>(); + for (const commit of [...request.commits, ...request.repositoryCommits]) { + if (!hashes.has(commit.hash)) hashes.set(commit.hash, commit); + } + const head = request.currentBranch + ? [...hashes.values()].find((commit) => + parseLabels(commit.decorations, new Set()).some( + (label) => label.kind === "branch" && label.title === request.currentBranch, + ), + ) + : undefined; + const reached = new Set<string>(); + const pending = head ? [head.hash] : []; + while (pending.length) { + const hash = pending.pop()!; + if (reached.has(hash)) continue; + reached.add(hash); + pending.push(...(hashes.get(hash)?.parentHashes ?? [])); + } + return { + version: 1, + rows, + laneCount: rows.length ? 1 : 0, + recommendedLaneCount: rows.length ? 1 : 0, + hasMissingParents: false, + currentBranchHashes: [...reached].sort(), + }; +} + +/** + * A long undecorated linear history (each commit's only parent is the next row) is one + * lane of color zero. `projects a linear chain` in the stub test pins it to the fixture. + */ +export function linearChainProjection(request: NormalizedRequest): GitGraphProjection | null { + const { commits } = request; + if (request.visibleHashes || request.currentBranch) return null; + const linear = commits.every( + (commit, row) => + commit.decorations === "" && + (row + 1 < commits.length + ? commit.parentHashes.length === 1 && commit.parentHashes[0] === commits[row + 1].hash + : commit.parentHashes.length === 0), + ); + if (!linear || new Set(commits.map((commit) => commit.hash)).size !== commits.length) return null; + const element = (row: number, direction: "up" | "down") => { + const edge = direction === "down" ? row : row - 1; + return { + id: `${edge}:${edge + 1}:false:${direction}`, + position: 0, + adjacentPosition: 0, + direction, + colorId: 0, + isDotted: false, + isMissing: false, + hasArrow: false, + isTerminal: false, + targetHash: commits[direction === "down" ? row + 1 : row - 1].hash, + }; + }; + return { + version: 1, + rows: commits.map((commit, row) => ({ + commitHash: commit.hash, + lane: 0, + laneCount: 1, + colorId: 0, + layoutIndex: 1, + incomingLaneColors: [0], + parentEdges: + row + 1 < commits.length + ? [ + { + id: `${row}:${row + 1}:false`, + parentHash: commits[row + 1].hash, + targetLane: 0, + colorId: 0, + isMissing: false, + isDotted: false, + }, + ] + : [], + labels: [], + printElements: [ + ...(row > 0 ? [element(row, "up")] : []), + ...(row + 1 < commits.length ? [element(row, "down")] : []), + ], + })), + laneCount: 1, + recommendedLaneCount: commits.length > 0 ? 1 : 0, + hasMissingParents: false, + currentBranchHashes: [], + }; +} + +export interface GitGraphProjectionStubOptions { + /** + * Accept histories that are not in the shared fixture and project them without routing. + * Only for tests that do not assert graph geometry. + */ + geometryFree?: boolean; +} + +/** + * Stand-in for Core's `git.graphProjection` in Git Log tests. Core owns the layout rules + * (`git/graph.rs`); this stub never routes a graph itself. It answers a request that is in + * `shared/fixtures/git/graph-projection-v1.json` with Core's recorded response, projects an + * undecorated linear chain, and otherwise either fails loudly or, when `geometryFree` + * is set, returns rows and labels without geometry. `git-graph-projection-stub.test.ts` + * replays the fixture through it so it cannot drift. + */ +export function stubGitGraphProjection( + request: Record<string, any>, + options: GitGraphProjectionStubOptions = {}, +): GitGraphProjection { + const normalized = normalizeGraphRequest(request); + const recorded = byRequest.get(JSON.stringify(normalized)); + if (recorded) return recorded.response; + if (normalized.visibleHashes?.length === 0) return geometryFreeProjection(normalized); + const chain = linearChainProjection(normalized); + if (chain) return chain; + if (options.geometryFree) return geometryFreeProjection(normalized); + throw new Error( + "git.graphProjection stub: this history is not in the shared fixture; add a case to graph-projection-v1.json or pass geometryFree", + ); +} + +/** Routes `git.graphProjection` to the stub; other Core commands keep their behavior. */ +export function installGitGraphProjectionStub(options: GitGraphProjectionStubOptions = {}) { + const original = native.invoke; + return spyOn(native, "invoke").mockImplementation((async (command: string, payload?: unknown) => + command === "git.graphProjection" + ? stubGitGraphProjection(payload as Record<string, unknown>, options) + : original(command, payload as Record<string, unknown>)) as typeof native.invoke); +} + +export type { GitGraphProjectionRequest }; From f334d57aae2e81f1aa8b6fb9115e234944c2e8a0 Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Thu, 5 Nov 2026 17:57:44 -0800 Subject: [PATCH 3/6] =?UTF-8?q?feat(macos):=20#1662=20GIT-18/19=20macOS=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=9B=BE=E6=94=B9=E8=B5=B0=20Core=20git.grap?= =?UTF-8?q?hProjection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提交图布局、定色、过滤后的虚线拓扑和 missing parents 改为整窗口一次调用 git.graphProjection, 删除 Swift 的 GitGraphProjection / GitGraphHeadOrdering / GitGraphMissingParents; 当前分支祖先高亮改用 Core 返回的 currentBranchHashes。 测试通过 GitGraphCoreTestSupport 调用真实链接的 Core;删除 LitheGitGraphVerifier 与 CoreVerifier 里的图布局检查, 性能 verifier 链接 Rust Core;同步功能矩阵、Agent Note 与语言特定词基线。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- ...6-09-13-macos-git-graph-intellij-layout.md | 4 + ...6-09-25-windows-git-graph-branch-colors.md | 4 + Package.swift | 12 +- .../Views/Git/GitGraphReferenceGroup.swift | 3 +- .../Sources/Lithe/Views/Git/GitLogView.swift | 19 +- .../LitheGitModule/Models/GitCorePlans.swift | 1 + .../Models/GitGraphModels.swift | 18 +- .../Models/GitGraphProjectionModels.swift | 86 ++++ .../Services/GitGraphHeadOrdering.swift | 57 --- .../Services/GitGraphLayoutService.swift | 157 ++++--- .../Services/GitGraphMissingParents.swift | 67 --- .../Services/GitGraphProjection.swift | 325 -------------- .../LitheCoreVerifier/CoreVerification.swift | 81 ---- .../GitGraphVerification.swift | 100 ----- .../GitGraphLayoutTests.swift | 411 +++++------------- .../GitGraphPerformanceBaselineTests.swift | 17 +- .../GitPerformanceVerifier.swift | 5 +- .../GitGraphCoreTestSupport.swift | 43 ++ .../Tests/LitheTests/BundledUIFontTests.swift | 3 +- .../LitheTests/GitGraphInteractionTests.swift | 47 +- rust/lithe-core/src/git/graph_tests.rs | 2 +- .../language-specifics-baseline.json | 3 - scripts/git-graph/verify-git-graph.sh | 4 +- .../perf/test-git-performance-baseline.sh | 9 + .../features/git-history.json | 12 +- 25 files changed, 401 insertions(+), 1089 deletions(-) create mode 100644 macos/Sources/LitheGitModule/Models/GitGraphProjectionModels.swift delete mode 100644 macos/Sources/LitheGitModule/Services/GitGraphHeadOrdering.swift delete mode 100644 macos/Sources/LitheGitModule/Services/GitGraphMissingParents.swift delete mode 100644 macos/Sources/LitheGitModule/Services/GitGraphProjection.swift delete mode 100644 macos/Tests/LitheGitGraphVerifier/GitGraphVerification.swift create mode 100644 macos/Tests/LitheGitTestSupport/GitGraphCoreTestSupport.swift diff --git a/.agents/notes/implemented/feature/2026-09-13-macos-git-graph-intellij-layout.md b/.agents/notes/implemented/feature/2026-09-13-macos-git-graph-intellij-layout.md index 388419f4b2..b851369ab5 100644 --- a/.agents/notes/implemented/feature/2026-09-13-macos-git-graph-intellij-layout.md +++ b/.agents/notes/implemented/feature/2026-09-13-macos-git-graph-intellij-layout.md @@ -618,3 +618,7 @@ Lithe 在工作台视图中持有 `WorkbenchToolContentStore`,本次用于 Git - `macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/` - `macos/Tests/LitheTests/Fixtures/GitGraph/` - `macos/Resources/GitGraph/` + +## 后续:布局下沉到 Rust Core(#1662 GIT-18/19) + +本文描述的 DFS、head 排序、定色、过滤后的虚线拓扑和 missing parents 算法已搬进 `rust/lithe-core/src/git/graph.rs`,由 `git.graphProjection` 统一提供,规则以 `shared/fixtures/git/graph-projection-v1.json` 为准。文中提到的 Swift/TS 实现文件已删除;两端只保留绘制、像素和颜色 ID 到主题色的映射。 diff --git a/.agents/notes/implemented/feature/2026-09-25-windows-git-graph-branch-colors.md b/.agents/notes/implemented/feature/2026-09-25-windows-git-graph-branch-colors.md index d8111b57b8..2d0d36d47d 100644 --- a/.agents/notes/implemented/feature/2026-09-25-windows-git-graph-branch-colors.md +++ b/.agents/notes/implemented/feature/2026-09-25-windows-git-graph-branch-colors.md @@ -307,3 +307,7 @@ ResizeObserver(浏览器按帧合并的尺寸观察器)服务已挂载行, - `macos/Sources/LitheGitModule/Services/GitGraphHeadOrdering.swift` - `macos/Sources/LitheGitModule/Services/GitGraphProjection.swift` - `macos/Tests/LitheGitModuleTests/Fixtures/GitGraphIDEA/` + +## 后续:布局下沉到 Rust Core(#1662 GIT-18/19) + +本文描述的 DFS、head 排序、定色、过滤后的虚线拓扑和 missing parents 算法已搬进 `rust/lithe-core/src/git/graph.rs`,由 `git.graphProjection` 统一提供,规则以 `shared/fixtures/git/graph-projection-v1.json` 为准。文中提到的 Swift/TS 实现文件已删除;两端只保留绘制、像素和颜色 ID 到主题色的映射。 diff --git a/Package.swift b/Package.swift index 6d93d9c05b..edb090d12a 100644 --- a/Package.swift +++ b/Package.swift @@ -24,7 +24,6 @@ let package = Package( .library(name: "LitheWorkspaceModule", targets: ["LitheWorkspaceModule"]), .library(name: "LithePluginPackageSigning", targets: ["LithePluginPackageSigning"]), .executable(name: "LitheCoreVerifier", targets: ["LitheCoreVerifier"]), - .executable(name: "LitheGitGraphVerifier", targets: ["LitheGitGraphVerifier"]), .executable(name: "LitheGitPerformanceVerifier", targets: ["LitheGitPerformanceVerifier"]), .executable(name: "LitheOfficialPluginVerifier", targets: ["LitheOfficialPluginVerifier"]), .executable(name: "LithePluginPackageSigner", targets: ["LithePluginPackageSigner"]) @@ -147,7 +146,7 @@ let package = Package( ), .target( name: "LitheGitTestSupport", - dependencies: ["LitheGitModule"], + dependencies: ["LitheGitModule", "LitheRustCore"], path: "macos/Tests/LitheGitTestSupport", swiftSettings: [.swiftLanguageMode(.v6)] ), @@ -213,6 +212,7 @@ let package = Package( "Lithe", "LitheGitModule", "LitheGitPerformanceSupport", + "LitheGitTestSupport", .product(name: "Testing", package: "swift-testing") ], path: "macos/Tests/LitheGitPerformanceTests", @@ -248,15 +248,9 @@ let package = Package( path: "macos/Tests/LitheCoreVerifier", swiftSettings: [.swiftLanguageMode(.v6)] ), - .executableTarget( - name: "LitheGitGraphVerifier", - dependencies: ["LitheGitModule"], - path: "macos/Tests/LitheGitGraphVerifier", - swiftSettings: [.swiftLanguageMode(.v6)] - ), .executableTarget( name: "LitheGitPerformanceVerifier", - dependencies: ["LitheGitModule", "LitheGitPerformanceSupport"], + dependencies: ["LitheGitModule", "LitheGitPerformanceSupport", "LitheGitTestSupport"], path: "macos/Tests/LitheGitPerformanceVerifier", swiftSettings: [.swiftLanguageMode(.v6)] ), diff --git a/macos/Sources/Lithe/Views/Git/GitGraphReferenceGroup.swift b/macos/Sources/Lithe/Views/Git/GitGraphReferenceGroup.swift index f00db61e64..fd5ffb9d1f 100644 --- a/macos/Sources/Lithe/Views/Git/GitGraphReferenceGroup.swift +++ b/macos/Sources/Lithe/Views/Git/GitGraphReferenceGroup.swift @@ -2,6 +2,7 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Apache-2.0. // See Resources/GitGraph/NOTICE.txt. import AppKit +import LitheCoreContracts import LitheGitModule /// IDEA's default compact reference display. The original names remain intact @@ -40,7 +41,7 @@ struct GitGraphReferenceGroup: Equatable, Sendable { } let sorted = labels.sorted { rank($0) == rank($1) - ? GitGraphHeadOrdering.naturalCompare(Array($0.title.utf16), Array($1.title.utf16)) < 0 + ? NaturalNameOrder.compare(Array($0.title.utf16), Array($1.title.utf16)) < 0 : rank($0) < rank($1) } let locals = sorted.filter { $0.kind == .branch } diff --git a/macos/Sources/Lithe/Views/Git/GitLogView.swift b/macos/Sources/Lithe/Views/Git/GitLogView.swift index 6fc4076e73..caec5b2429 100644 --- a/macos/Sources/Lithe/Views/Git/GitLogView.swift +++ b/macos/Sources/Lithe/Views/Git/GitLogView.swift @@ -165,9 +165,16 @@ struct GitLogView: View { let visibleHashes = visibleCommitHashes let options: GitGraphDisplayOptions = showLongGraphEdges ? .expanded : .compact let highlightsCurrentBranch = graphProjectionIdentity.highlightsCurrentBranch - let task = UserActionContext.detached(priority: .userInitiated) { - let layout = GitGraphLayoutService.layout(commits: commits, references: references, - repositoryCommits: repositoryCommits, visibleHashes: visibleHashes, options: options) + let currentBranch = highlightsCurrentBranch + ? references.first(where: { $0.kind == .local && $0.isCurrent })?.shortName : nil + let projector = feature.graphProjector + // One Core call projects the whole loaded window; layout runs off the main actor. + let task = UserActionContext.detached(priority: .userInitiated) { () -> GitGraphPresentation? in + guard let layout = await GitGraphLayoutService.layout( + commits: commits, references: references, repositoryCommits: repositoryCommits, + visibleHashes: visibleHashes, options: options, currentBranch: currentBranch, + project: projector + ) else { return nil } let referenceIndex = GitGraphReferenceGroup.ReferenceIndex(references) return GitGraphPresentation(rows: layout.rows, routingSnapshot: GitGraphLayoutService.routingSnapshot(for: layout), @@ -175,14 +182,14 @@ struct GitLogView: View { referenceGroups: Dictionary(uniqueKeysWithValues: layout.rows.map { ($0.commit.hash, GitGraphReferenceGroup(labels: $0.labels, index: referenceIndex)) }), - currentBranchHashes: highlightsCurrentBranch - ? GitGraphLayoutService.currentBranchHashes(commits: commits, repositoryCommits: repositoryCommits, references: references) : []) + currentBranchHashes: layout.currentBranchHashes) } - let presentation = await withTaskCancellationHandler { + let result = await withTaskCancellationHandler { await task.value } onCancel: { task.cancel() } + guard let presentation = result else { return } guard !Task.isCancelled, graphProjectionIdentity == identity else { return } presentationCache.store(presentation, for: identity) graphPresentation = presentation diff --git a/macos/Sources/LitheGitModule/Models/GitCorePlans.swift b/macos/Sources/LitheGitModule/Models/GitCorePlans.swift index 782579a095..a87366e124 100644 --- a/macos/Sources/LitheGitModule/Models/GitCorePlans.swift +++ b/macos/Sources/LitheGitModule/Models/GitCorePlans.swift @@ -7,6 +7,7 @@ package enum GitCorePlanCommand: String, Sendable { case rebasePlanPreview = "git.rebasePlanPreview" case updatePlan = "git.updatePlan" case historyWindow = "git.historyWindow" + case graphProjection = "git.graphProjection" } // MARK: - git.normalizeChangeTargets diff --git a/macos/Sources/LitheGitModule/Models/GitGraphModels.swift b/macos/Sources/LitheGitModule/Models/GitGraphModels.swift index 0c4cd32a4e..bb61fbbac7 100644 --- a/macos/Sources/LitheGitModule/Models/GitGraphModels.swift +++ b/macos/Sources/LitheGitModule/Models/GitGraphModels.swift @@ -1,12 +1,12 @@ import Foundation +/// How much of a long edge the graph draws. Core owns the thresholds +/// (`git.graphProjection` `displayMode`); the host only picks the mode. package struct GitGraphDisplayOptions: Hashable, Sendable { - package static let compact = Self(longEdgeSize: 30, visiblePartSize: 1, edgeWithArrowSize: Int.max) - package static let expanded = Self(longEdgeSize: 1_000, visiblePartSize: 250, edgeWithArrowSize: 30) + package static let compact = Self(mode: "compact") + package static let expanded = Self(mode: "expanded") - let longEdgeSize: Int - let visiblePartSize: Int - let edgeWithArrowSize: Int + let mode: String } package enum GitGraphReferenceKind: String, Hashable, Sendable { @@ -74,12 +74,18 @@ package struct GitGraphLayout: Sendable { package let laneCount: Int package let hasMissingParents: Bool package let recommendedLaneCount: Int + /// Ancestry of the requested current branch, for the row background highlight. + package let currentBranchHashes: Set<String> - package init(rows: [GitGraphRow], laneCount: Int, hasMissingParents: Bool, recommendedLaneCount: Int = 0) { + package init( + rows: [GitGraphRow], laneCount: Int, hasMissingParents: Bool, recommendedLaneCount: Int = 0, + currentBranchHashes: Set<String> = [] + ) { self.rows = rows self.laneCount = laneCount self.hasMissingParents = hasMissingParents self.recommendedLaneCount = recommendedLaneCount + self.currentBranchHashes = currentBranchHashes } } diff --git a/macos/Sources/LitheGitModule/Models/GitGraphProjectionModels.swift b/macos/Sources/LitheGitModule/Models/GitGraphProjectionModels.swift new file mode 100644 index 0000000000..16f7aa7c24 --- /dev/null +++ b/macos/Sources/LitheGitModule/Models/GitGraphProjectionModels.swift @@ -0,0 +1,86 @@ +import Foundation + +// Wire types for Core's `git.graphProjection`. Core owns lanes, colors, routes, and +// labels (`shared/fixtures/git/graph-projection-v1.json`); the host builds the request +// and turns the response into its drawing models. + +package struct GitGraphProjectionRequest: Encodable, Sendable, Equatable { + package struct Commit: Encodable, Sendable, Equatable { + package let hash: String + package let parentHashes: [String] + package let decorations: String + + package init(hash: String, parentHashes: [String], decorations: String) { + self.hash = hash + self.parentHashes = parentHashes + self.decorations = decorations + } + } + + package let commits: [Commit] + package let remoteNames: [String] + package let repositoryCommits: [Commit] + package let visibleHashes: [String]? + package let displayMode: String + package let currentBranch: String? + + package init( + commits: [Commit], remoteNames: [String] = [], repositoryCommits: [Commit] = [], + visibleHashes: [String]? = nil, displayMode: String = "compact", currentBranch: String? = nil + ) { + self.commits = commits + self.remoteNames = remoteNames + self.repositoryCommits = repositoryCommits + self.visibleHashes = visibleHashes + self.displayMode = displayMode + self.currentBranch = currentBranch + } +} + +package struct GitGraphProjectionResponse: Decodable, Sendable { + package struct Label: Decodable, Sendable { + package let title: String + package let kind: String + } + + package struct ParentEdge: Decodable, Sendable { + package let id: String + package let parentHash: String + package let targetLane: Int? + package let colorId: Int + package let isMissing: Bool + } + + package struct PrintElement: Decodable, Sendable { + package let id: String + package let position: Int + package let adjacentPosition: Int + package let direction: String + package let colorId: Int + package let isDotted: Bool + package let hasArrow: Bool + package let isTerminal: Bool + package let targetHash: String? + } + + package struct Row: Decodable, Sendable { + package let commitHash: String + package let lane: Int + package let laneCount: Int + package let colorId: Int + package let layoutIndex: Int + package let incomingLaneColors: [Int] + package let parentEdges: [ParentEdge] + package let labels: [Label] + package let printElements: [PrintElement] + } + + package let rows: [Row] + package let laneCount: Int + package let recommendedLaneCount: Int + package let hasMissingParents: Bool + package let currentBranchHashes: [String] +} + +/// Runs one `git.graphProjection` call; `nil` means Core rejected the request. +package typealias GitGraphProjector = @Sendable (GitGraphProjectionRequest) async -> GitGraphProjectionResponse? diff --git a/macos/Sources/LitheGitModule/Services/GitGraphHeadOrdering.swift b/macos/Sources/LitheGitModule/Services/GitGraphHeadOrdering.swift deleted file mode 100644 index a83eadcb20..0000000000 --- a/macos/Sources/LitheGitModule/Services/GitGraphHeadOrdering.swift +++ /dev/null @@ -1,57 +0,0 @@ -// Adapted from IntelliJ GitRefManager, HeadCommitsComparator and NaturalComparator. -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Apache-2.0. -// Swift adaptation: Lithe contributors. See macos/Resources/GitGraph/NOTICE.txt. -import Foundation -import LitheCoreContracts - -package enum GitGraphHeadOrdering { - static func sortedHeads(labels: [[GitGraphLabel]], children: [[Int]]) -> [Int] { - let best = labels.map(bestReference) - // A referenced branch may already have children. It still seeds DFS - // before less important graph tips; tags alone do not create a head. - return labels.indices.filter { - children[$0].isEmpty || labels[$0].contains { $0.kind != .tag } - }.sorted { left, right in - switch (best[left], best[right]) { - case let (a?, b?): - if a == b { return left < right } - return precedes(a, b) - case (_?, nil): return true - case (nil, _?): return false - case (nil, nil): return left < right - } - } - } - - static func bestReference(_ labels: [GitGraphLabel]) -> GitGraphLabel? { - labels.min(by: precedes) - } - - /// Java String.hashCode, used by IDEA's GraphColorManagerImpl for the - /// principal fragment of a referenced head. Unreferenced heads use zero. - static func colorID(for labels: [GitGraphLabel]) -> Int { - guard let ref = bestReference(labels) else { return 0 } - let hash = ref.title.utf16.reduce(Int32(0)) { ($0 &* 31) &+ Int32($1) } - return Int(hash) - } - - private static func precedes(_ left: GitGraphLabel, _ right: GitGraphLabel) -> Bool { - let a = priority(left), b = priority(right) - return a == b ? naturalCompare(Array(left.title.utf16), Array(right.title.utf16)) < 0 : a < b - } - - private static func priority(_ ref: GitGraphLabel) -> Int { - switch ref.kind { - case .remote: return ["origin/main", "origin/master"].contains(ref.title) ? 0 : 1 - case .branch: return ["main", "master"].contains(ref.title) ? 2 : 3 - case .tag: return 4 - case .head: return 6 - } - } - - /// IntelliJ `NaturalComparator` order for ref names. The algorithm is shared - /// with the Project tree through `NaturalNameOrder` in LitheCoreContracts. - package static func naturalCompare(_ a: [UInt16], _ b: [UInt16], ignoreCase: Bool = true) -> Int { - NaturalNameOrder.compare(a, b, ignoreCase: ignoreCase) - } -} diff --git a/macos/Sources/LitheGitModule/Services/GitGraphLayoutService.swift b/macos/Sources/LitheGitModule/Services/GitGraphLayoutService.swift index 7e1954ecda..9464d6bc65 100644 --- a/macos/Sources/LitheGitModule/Services/GitGraphLayoutService.swift +++ b/macos/Sources/LitheGitModule/Services/GitGraphLayoutService.swift @@ -1,60 +1,86 @@ import Foundation +/// Turns a loaded history window into the native graph models. The layout itself — +/// permanent layout, head ordering, colors, filtered topology, lanes, print elements — +/// is Core's `git.graphProjection`; this service builds the request and maps the answer. package enum GitGraphLayoutService { - /// CurrentBranchHighlighter colors ancestry, including every merge parent. - /// ponytail: only the loaded graph can prove membership; a missing parent - /// ends this walk. A complete repository graph can extend it without I/O in drawing. - package static func currentBranchHashes( - commits: [GitCommit], repositoryCommits: [GitCommit], references: [GitReference] - ) -> Set<String> { - guard let branch = references.first(where: { $0.kind == .local && $0.isCurrent }) else { return [] } - let byHash = Dictionary((commits + repositoryCommits).map { ($0.hash, $0) }, - uniquingKeysWith: { first, _ in first }) - guard let head = (commits + repositoryCommits).first(where: { - labels(from: $0.decorations, remoteNames: []).contains { $0.kind == .branch && $0.title == branch.shortName } - }) else { return [] } - var pending = [head.hash] - var result = Set<String>() - while let hash = pending.popLast() { - guard result.insert(hash).inserted else { continue } - pending.append(contentsOf: byHash[hash]?.parentHashes ?? []) + /// The Core request for one loaded window; the whole window is projected in one call. + package static func request( + commits: [GitCommit], + references: [GitReference] = [], + repositoryCommits: [GitCommit] = [], + visibleHashes: Set<String>? = nil, + options: GitGraphDisplayOptions = .compact, + currentBranch: String? = nil + ) -> GitGraphProjectionRequest { + func identities(_ values: [GitCommit]) -> [GitGraphProjectionRequest.Commit] { + values.map { .init(hash: $0.hash, parentHashes: $0.parentHashes, decorations: $0.decorations) } } - return result + return GitGraphProjectionRequest( + commits: identities(commits), + remoteNames: references.filter { $0.kind == .remote }.map(\.shortName), + repositoryCommits: identities(repositoryCommits), + visibleHashes: visibleHashes.map { Array($0) }, + displayMode: options.mode, + currentBranch: currentBranch + ) } - /// Uses IntelliJ's permanent-layout, visible-graph and print-element rules. - /// Input stays in Git's child-before-parent order; filtering never mutates it. + /// Projects one loaded window through Core. `nil` means Core rejected the request. package static func layout( commits: [GitCommit], references: [GitReference] = [], repositoryCommits: [GitCommit] = [], visibleHashes: Set<String>? = nil, - options: GitGraphDisplayOptions = .compact - ) -> GitGraphLayout { - guard !Task.isCancelled else { return GitGraphLayout(rows: [], laneCount: 0, hasMissingParents: false) } - let remoteNames = Set(references.filter { $0.kind == .remote }.map(\.shortName)) - func commitLabels(_ values: [GitCommit]) -> [[GitGraphLabel]] { - values.map { labels(from: $0.decorations, remoteNames: remoteNames) } - } - var orderedCommits = commits - var permanentGraph: GitGraphProjection? - let scopedHashes = Set(commits.map(\.hash)) - let repositoryHashes = Set(repositoryCommits.map(\.hash)) - // IDEA builds the permanent graph before applying the branch scope. - // Otherwise an older release ref can steal the main branch's layout - // when main's tip is outside the selected branch's first history page. - // Use only a complete, unique context; bounded-history misses fall back - // to the scoped graph instead of dropping commits or mixing indices. - if !repositoryCommits.isEmpty, repositoryHashes.count == repositoryCommits.count, - scopedHashes.isSubset(of: repositoryHashes) { - permanentGraph = GitGraphProjection(commits: repositoryCommits, labels: commitLabels(repositoryCommits), visibleHashes: nil) - let scopedByHash = Dictionary(commits.map { ($0.hash, $0) }, uniquingKeysWith: { first, _ in first }) - orderedCommits = repositoryCommits.compactMap { scopedByHash[$0.hash] } + options: GitGraphDisplayOptions = .compact, + currentBranch: String? = nil, + project: GitGraphProjector + ) async -> GitGraphLayout? { + guard !commits.isEmpty else { return GitGraphLayout(rows: [], laneCount: 0, hasMissingParents: false) } + let request = request( + commits: commits, references: references, repositoryCommits: repositoryCommits, + visibleHashes: visibleHashes, options: options, currentBranch: currentBranch + ) + guard let response = await project(request), !Task.isCancelled else { return nil } + return layout(commits: commits, response: response) + } + + /// Attaches the caller's commits to Core's rows; the first commit of a hash wins. + package static func layout(commits: [GitCommit], response: GitGraphProjectionResponse) -> GitGraphLayout? { + var byHash: [String: GitCommit] = [:] + for commit in commits where byHash[commit.hash] == nil { byHash[commit.hash] = commit } + var rows: [GitGraphRow] = [] + rows.reserveCapacity(response.rows.count) + for row in response.rows { + guard let commit = byHash[row.commitHash] else { return nil } + rows.append(GitGraphRow( + commit: commit, lane: row.lane, laneCount: row.laneCount, + incomingLaneColors: row.incomingLaneColors.map { Optional($0) }, + parentEdges: row.parentEdges.map { + GitGraphEdge(id: $0.id, parentHash: $0.parentHash, targetLane: $0.targetLane, + colorIndex: $0.colorId, isMissing: $0.isMissing) + }, + labels: row.labels.compactMap { label in + GitGraphReferenceKind(rawValue: label.kind).map { GitGraphLabel(title: label.title, kind: $0) } + }, + layoutIndex: row.layoutIndex, nodeColorIndex: row.colorId, + printElements: row.printElements.map { element in + // `<edge id>:<direction>`; both halves of an edge share the edge ID. + let edgeID = element.id.lastIndex(of: ":").map { String(element.id[..<$0]) } ?? element.id + return GitGraphPrintElement( + edgeID: edgeID, position: element.position, adjacentPosition: element.adjacentPosition, + direction: element.direction == "down" ? .down : .up, colorIndex: element.colorId, + isDotted: element.isDotted, hasArrow: element.hasArrow, isTerminal: element.isTerminal, + targetHash: element.targetHash + ) + } + )) } - let graph = GitGraphProjection(commits: orderedCommits, labels: commitLabels(orderedCommits), - visibleHashes: visibleHashes, permanentGraph: permanentGraph) - guard !Task.isCancelled else { return GitGraphLayout(rows: [], laneCount: 0, hasMissingParents: false) } - return graph.layout(options: options) + return GitGraphLayout( + rows: rows, laneCount: response.laneCount, hasMissingParents: response.hasMissingParents, + recommendedLaneCount: response.recommendedLaneCount, + currentBranchHashes: Set(response.currentBranchHashes) + ) } package static func routingSnapshot(for layout: GitGraphLayout) -> GitGraphRoutingSnapshot { @@ -78,41 +104,12 @@ package enum GitGraphLayoutService { recommendedLaneCount: layout.recommendedLaneCount ) } +} - private static func labels(from decorations: String, remoteNames: Set<String>) -> [GitGraphLabel] { - decorations - .split(separator: ",") - .flatMap { rawValue -> [GitGraphLabel] in - let raw = rawValue.trimmingCharacters(in: .whitespacesAndNewlines) - guard !raw.isEmpty else { return [] } - - if raw == "HEAD" { - return [GitGraphLabel(title: "HEAD", kind: .head)] - } - if raw.hasPrefix("HEAD -> ") { - let branch = localName(String(raw.dropFirst("HEAD -> ".count))) - return [ - GitGraphLabel(title: "HEAD", kind: .head), - GitGraphLabel(title: branch, kind: .branch) - ] - } - if raw.hasPrefix("tag: ") { - return [GitGraphLabel(title: String(raw.dropFirst("tag: ".count)), kind: .tag)] - } - if raw.hasPrefix("refs/tags/") { - return [GitGraphLabel(title: String(raw.dropFirst("refs/tags/".count)), kind: .tag)] - } - if remoteNames.contains(raw) || raw.hasPrefix("origin/") || raw.hasPrefix("refs/remotes/") { - let title = raw.hasPrefix("refs/remotes/") - ? String(raw.dropFirst("refs/remotes/".count)) - : raw - return [GitGraphLabel(title: title, kind: .remote)] - } - return [GitGraphLabel(title: localName(raw), kind: .branch)] - } - } - - private static func localName(_ name: String) -> String { - name.hasPrefix("refs/heads/") ? String(name.dropFirst("refs/heads/".count)) : name +extension GitFeatureModel { + /// Projects the loaded history window through Core off the main actor. + package var graphProjector: GitGraphProjector { + let service = service + return { request in await service.corePlan(.graphProjection, request) } } } diff --git a/macos/Sources/LitheGitModule/Services/GitGraphMissingParents.swift b/macos/Sources/LitheGitModule/Services/GitGraphMissingParents.swift deleted file mode 100644 index f8c447002e..0000000000 --- a/macos/Sources/LitheGitModule/Services/GitGraphMissingParents.swift +++ /dev/null @@ -1,67 +0,0 @@ -import Foundation - -/// Projects unloaded ancestors through hidden commits without storing a full -/// reachable-hash set at every hidden node. All input rows are topological. -enum GitGraphMissingParents { - /// Shared boundary DAG: local unloaded hashes and links to older groups. - /// Equal groups share an ID; single-parent paths with no local boundary - /// reuse their parent's ID instead of creating another traversal step. - private struct Group: Hashable { - let hashes: [String] - let parents: [Int] - } - - static func project( - commits: [GitCommit], byHash: [String: Int], parents: [[Int]], visible: [Int], - add: (Int, String) -> Void - ) { - guard !visible.isEmpty, !Task.isCancelled else { return } - let visibleRows = Set(visible) - var groupForRow = [Int?](repeating: nil, count: commits.count) - var groups: [Group] = [] - var groupIDs: [Group: Int] = [:] - for row in commits.indices.reversed() { - guard !Task.isCancelled else { return } - // A visible ancestor owns its own continuation. Duplicate page - // entries and unrelated hidden roots cannot introduce fake edges. - guard !visibleRows.contains(row), byHash[commits[row].hash] == row else { continue } - let hashes = Set(commits[row].parentHashes.filter { byHash[$0] == nil }).sorted() - let inherited = Set(parents[row].compactMap { groupForRow[$0] }).sorted() - if hashes.isEmpty, inherited.count <= 1 { - groupForRow[row] = inherited.first - } else { - let group = Group(hashes: hashes, parents: inherited) - if let id = groupIDs[group] { - groupForRow[row] = id - } else { - let id = groups.count - groups.append(group) - groupIDs[group] = id - groupForRow[row] = id - } - } - } - guard !groups.isEmpty else { return } - - // A traversal stamp avoids clearing an O(history-size) visited array - // for each visible commit. Only that commit's output hashes accumulate. - var visited = [Int](repeating: -1, count: groups.count) - for row in visible { - guard !Task.isCancelled else { return } - var pending = parents[row].compactMap { groupForRow[$0] } - var missing = Set<String>() - while let id = pending.popLast() { - guard !Task.isCancelled else { return } - guard visited[id] != row else { continue } - visited[id] = row - missing.formUnion(groups[id].hashes) - pending.append(contentsOf: groups[id].parents) - } - let direct = Set(commits[row].parentHashes) - for hash in missing.sorted() where !direct.contains(hash) { - guard !Task.isCancelled else { return } - add(row, hash) - } - } - } -} diff --git a/macos/Sources/LitheGitModule/Services/GitGraphProjection.swift b/macos/Sources/LitheGitModule/Services/GitGraphProjection.swift deleted file mode 100644 index be7177496a..0000000000 --- a/macos/Sources/LitheGitModule/Services/GitGraphProjection.swift +++ /dev/null @@ -1,325 +0,0 @@ -// Portions adapted from JetBrains IntelliJ Community, Copyright 2000-2024 -// JetBrains s.r.o. and contributors, under the Apache License, Version 2.0. -// Swift adaptation: Lithe contributors. See -// .agents/notes/implemented/feature/2026-09-13-macos-git-graph-intellij-layout.md -// and macos/Resources/GitGraph/NOTICE.txt for the pinned sources and license. -import Foundation - -/// Permanent layout indices are deliberately independent of compact screen -/// columns. This is the macOS projection; it performs no I/O or native drawing. -struct GitGraphProjection { - private struct Edge { - let up: Int - let down: Int? - let parentHash: String - let dotted: Bool - var id: String { "\(up):\(down.map(String.init) ?? parentHash):\(dotted)" } - } - - private enum Element { - case node(Int) - case edge(Int) - } - - private let commits: [GitCommit] - private let labels: [[GitGraphLabel]] - private let visible: [Int] - private let indices: [Int] - private let colors: [Int] - private let edges: [Edge] - - init(commits: [GitCommit], labels: [[GitGraphLabel]], visibleHashes: Set<String>?, permanentGraph: GitGraphProjection? = nil) { - self.commits = commits - self.labels = labels - // History normally has unique IDs. First occurrence wins for defensive - // handling of overlapping pages without making Dictionary trap. - var byHash: [String: Int] = [:] - for (row, commit) in commits.enumerated() where byHash[commit.hash] == nil { - byHash[commit.hash] = row - } - var parents = [[Int]](repeating: [], count: commits.count) - var children = parents - for (row, commit) in commits.enumerated() { - var seen = Set<Int>() - for hash in commit.parentHashes { - if let parent = byHash[hash], parent > row, seen.insert(parent).inserted { - parents[row].append(parent) - children[parent].append(row) - } - } - } - if let permanentGraph { - let permanentRows = Dictionary(uniqueKeysWithValues: permanentGraph.commits.enumerated().map { ($1.hash, $0) }) - indices = commits.map { permanentGraph.indices[permanentRows[$0.hash]!] } - colors = commits.map { permanentGraph.colors[permanentRows[$0.hash]!] } - } else { - let heads = GitGraphHeadOrdering.sortedHeads(labels: labels, children: children) - (indices, colors) = Self.permanentLayout(labels: labels, parents: parents, heads: heads) - } - visible = commits.indices.filter { byHash[commits[$0].hash] == $0 && (visibleHashes?.contains(commits[$0].hash) ?? true) } - let visibleRows = Dictionary(uniqueKeysWithValues: visible.enumerated().map { ($1, $0) }) - var result: [Edge] = [] - var pairs = Set<String>() - func add(_ up: Int, _ down: Int, dotted: Bool) { - guard let u = visibleRows[up], let d = visibleRows[down], u < d, - pairs.insert("\(u):\(d)").inserted else { return } - result.append(Edge(up: u, down: d, parentHash: commits[down].hash, dotted: dotted)) - } - for row in visible { - for parent in parents[row] where visibleRows[parent] != nil { add(row, parent, dotted: false) } - var seen = Set<String>() - for hash in commits[row].parentHashes where byHash[hash] == nil && seen.insert(hash).inserted { - result.append(Edge(up: visibleRows[row]!, down: nil, parentHash: hash, dotted: false)) - } - } - if visibleHashes != nil { - Self.dottedEdges(parents: parents, children: children, visible: Set(visible), add: { add($0, $1, dotted: true) }) - GitGraphMissingParents.project(commits: commits, byHash: byHash, parents: parents, visible: visible) { row, hash in - result.append(Edge(up: visibleRows[row]!, down: nil, parentHash: hash, dotted: true)) - } - } - edges = result.sorted { - if $0.up != $1.up { return $0.up < $1.up } - if $0.down != $1.down { return ($0.down ?? Int.max) < ($1.down ?? Int.max) } - return $0.parentHash < $1.parentHash - } - } - - private static func permanentLayout(labels: [[GitGraphLabel]], parents: [[Int]], heads: [Int]) -> ([Int], [Int]) { - var indices = [Int](repeating: 0, count: parents.count) - var colors = indices - var nextParent = indices - var layoutIndex = 1 - for head in heads { - guard indices[head] == 0 else { continue } - var stack = [head] - let headIndex = layoutIndex - let headColor = GitGraphHeadOrdering.colorID(for: labels[head]) - while let node = stack.last { - let firstVisit = indices[node] == 0 - if firstVisit { - indices[node] = layoutIndex - // GraphColorGetterByHead + GraphColorManagerImpl: the head - // fragment uses its reference name; side fragments use LI. - colors[node] = layoutIndex == headIndex ? headColor : layoutIndex - } - while nextParent[node] < parents[node].count && indices[parents[node][nextParent[node]]] != 0 { - nextParent[node] += 1 - } - if nextParent[node] < parents[node].count { - stack.append(parents[node][nextParent[node]]) - } else { - if firstVisit { layoutIndex += 1 } - stack.removeLast() - } - } - } - return (indices, colors) - } - - /// IntelliJ DottedFilterEdgesGenerator's two directional number walks. - /// Nearest-visible propagation avoids an exponential ancestor path search. - private static func dottedEdges(parents: [[Int]], children: [[Int]], visible: Set<Int>, add: (Int, Int) -> Void) { - var numbers = [Int](repeating: Int.min, count: parents.count) - for node in parents.indices { - if visible.contains(node) { - var nearest = Int.min - var adjacent = Int.min - for child in children[node] { - if visible.contains(child) { adjacent = max(adjacent, numbers[child]) } - else { nearest = max(nearest, numbers[child]) } - } - if nearest == adjacent || nearest == Int.min { numbers[node] = adjacent } - else { add(nearest, node); numbers[node] = nearest } - } else { - numbers[node] = children[node].reduce(Int.min) { - max($0, visible.contains($1) ? $1 : numbers[$1]) - } - } - } - numbers = [Int](repeating: Int.max, count: parents.count) - for node in parents.indices.reversed() { - if visible.contains(node) { - var nearest = Int.max - var adjacent = Int.max - for parent in parents[node] { - if visible.contains(parent) { adjacent = min(adjacent, numbers[parent]) } - else { nearest = min(nearest, numbers[parent]) } - } - if nearest == adjacent || nearest == Int.max { numbers[node] = adjacent } - else { add(node, nearest); numbers[node] = nearest } - } else { - numbers[node] = parents[node].reduce(Int.max) { - min($0, visible.contains($1) ? $1 : numbers[$1]) - } - } - } - } - - func layout(options: GitGraphDisplayOptions) -> GitGraphLayout { - guard !visible.isEmpty else { return GitGraphLayout(rows: [], laneCount: 0, hasMissingParents: false) } - // Values from the pinned PrintElementGeneratorImpl. Even expanded mode - // caps extreme edges while retaining direction arrows for ordinary long edges. - let longEdgeSize = options.longEdgeSize - let visiblePartSize = options.visiblePartSize - var elements = visible.indices.map { [Element.node($0)] } - var adjacent = [[Int]](repeating: [], count: visible.count) - for (id, edge) in edges.enumerated() { - adjacent[edge.up].append(id) - if let down = edge.down { - adjacent[down].append(id) - guard down > edge.up + 1 else { continue } - if down - edge.up < longEdgeSize { - for row in (edge.up + 1)..<down { elements[row].append(.edge(id)) } - } else { - for row in (edge.up + 1)...(edge.up + visiblePartSize) { elements[row].append(.edge(id)) } - for row in (down - visiblePartSize)..<down { elements[row].append(.edge(id)) } - } - } else if edge.up + 1 < visible.count { - elements[edge.up + 1].append(.edge(id)) - } - } - var positions = [[Int: Int]](repeating: [:], count: visible.count) - var nodePositions = [Int](repeating: 0, count: visible.count) - for row in visible.indices { - elements[row].sort { - let order = compare($0, $1) - return order == 0 ? stableElementKey($0) < stableElementKey($1) : order < 0 - } - for (position, element) in elements[row].enumerated() { - switch element { - case .node: - nodePositions[row] = position - for edge in adjacent[row] { positions[row][edge] = position } - case .edge(let edge): positions[row][edge] = position - } - } - } - var rows: [GitGraphRow] = [] - for row in visible.indices { - if Task.isCancelled { return GitGraphLayout(rows: [], laneCount: 0, hasMissingParents: false) } - var prints: [GitGraphPrintElement] = [] - for (position, element) in elements[row].enumerated() { - let ids: [Int] - if case .edge(let id) = element { ids = [id] } else { ids = adjacent[row] } - for id in ids { - let edge = edges[id] - for direction in [GitGraphPrintElement.Direction.up, .down] { - let next = row + (direction == .up ? -1 : 1) - let nextPosition = positions.indices.contains(next) ? positions[next][id] : nil - let arrow: Bool - if let down = edge.down { - let span = down - edge.up - let offset = direction == .down ? row - edge.up : down - row - arrow = (span >= longEdgeSize && offset == visiblePartSize) - || (span >= options.edgeWithArrowSize && offset == 1) - } else { - // IDEA places unloaded-parent arrows on the next - // row, never stacked on the last visible node. - arrow = direction == .down && row == edge.up + 1 - } - guard nextPosition != nil || arrow else { continue } - // Nodes never draw a terminal for a normal edge without - // a neighbour; only long-edge intermediate elements do. - prints.append(GitGraphPrintElement( - edgeID: edge.id, position: position, adjacentPosition: nextPosition ?? position, - direction: direction, colorIndex: edgeColor(edge), isDotted: edge.dotted, - hasArrow: arrow, isTerminal: nextPosition == nil, - targetHash: edge.down.map { commits[visible[direction == .down ? $0 : edge.up]].hash } - )) - } - } - } - let node = visible[row] - rows.append(GitGraphRow( - commit: commits[node], lane: nodePositions[row], laneCount: elements[row].count, - incomingLaneColors: elements[row].map { element in - if case .edge(let id) = element { return edgeColor(edges[id]) } - return colors[node] - }, - parentEdges: adjacent[row].compactMap { id in - let edge = edges[id] - guard edge.up == row else { return nil } - return GitGraphEdge(id: edge.id, parentHash: edge.parentHash, - targetLane: row + 1 < visible.count ? positions[row + 1][id] : nil, - colorIndex: edgeColor(edge), isMissing: edge.down == nil) - }, - labels: labels[node], layoutIndex: indices[node], - nodeColorIndex: colors[node], printElements: prints - )) - } - return GitGraphLayout(rows: rows, laneCount: elements.map(\.count).max() ?? 0, - hasMissingParents: edges.contains { $0.down == nil }, - recommendedLaneCount: recommendedWidth(options: options)) - } - - /// IntelliJ's weighted mean plus deviation. Difference intervals produce - /// the same per-row edge counts without scanning every live edge per row. - private func recommendedWidth(options: GitGraphDisplayOptions) -> Int { - let count = min(20_000, visible.count) - guard count > 1 else { return count } - var changes = [Int](repeating: 0, count: visible.count + 1) - var missing = [Int](repeating: 0, count: visible.count) - func add(_ lower: Int, _ upper: Int) { - changes[lower] += 1 - changes[upper] -= 1 - } - for edge in edges { - guard let down = edge.down else { missing[edge.up] += 1; continue } - if down - edge.up < options.longEdgeSize { - add(edge.up, down) - } else { - add(edge.up, edge.up + options.visiblePartSize + 1) - add(down - options.visiblePartSize, down) - } - } - let weightRatio = 0.1 - var current = 0, previous = 0 - var sum = 0.0, squares = 0.0 - for row in 0..<count { - current += changes[row] - let width = Double(max(previous, current + missing[row])) - let weight = 2 / (Double(count) * (weightRatio + 1)) - * (1 + (weightRatio - 1) * Double(row) / Double(count - 1)) - sum += width * weight - squares += width * width * weight - previous = current - } - return Int((sum + sqrt(max(0, squares - sum * sum))).rounded()) - } - - private func edgeColor(_ edge: Edge) -> Int { - let up = visible[edge.up] - guard let down = edge.down.map({ visible[$0] }) else { return colors[up] } - return colors[indices[up] > indices[down] ? up : down] - } - - private func stableElementKey(_ element: Element) -> Int { - switch element { case .node: -1; case .edge(let id): id } - } - - /// Direct translation of GraphElementComparatorByLayoutIndex. These rules - /// also order crossing edges without keeping unrelated empty lane slots. - private func compare(_ lhs: Element, _ rhs: Element) -> Int { - switch (lhs, rhs) { - case (.node, .node): return 0 - case (.edge(let e), .node(let n)): return compare(edge: edges[e], node: n) - case (.node(let n), .edge(let e)): return -compare(edge: edges[e], node: n) - case (.edge(let a), .edge(let b)): - let first = edges[a], second = edges[b] - guard let firstDown = first.down else { return -compare(edge: second, node: first.up) } - guard let secondDown = second.down else { return compare(edge: first, node: second.up) } - if first.up == second.up { - return firstDown < secondDown ? -compare(edge: second, node: firstDown) : compare(edge: first, node: secondDown) - } - return first.up < second.up ? compare(edge: first, node: second.up) : -compare(edge: second, node: first.up) - } - } - - private func compare(edge: Edge, node: Int) -> Int { - let nodeIndex = indices[visible[node]] - guard let down = edge.down else { return indices[visible[edge.up]] - nodeIndex } - let edgeIndex = max(indices[visible[edge.up]], indices[visible[down]]) - return edgeIndex != nodeIndex ? edgeIndex - nodeIndex : edge.up - node - } -} diff --git a/macos/Tests/LitheCoreVerifier/CoreVerification.swift b/macos/Tests/LitheCoreVerifier/CoreVerification.swift index e9307ca847..ce14e23b2b 100644 --- a/macos/Tests/LitheCoreVerifier/CoreVerification.swift +++ b/macos/Tests/LitheCoreVerifier/CoreVerification.swift @@ -10,7 +10,6 @@ struct CoreVerification { verifySharedContractFixtures() verifyDiffParser() verifyVisibilityRules() - verifyGitGraph() verifyWhitespaceModes() verifySearchOptions() print("Core verification passed: shared fixtures, diff, visibility, graph, search options, and whitespace modes") @@ -70,26 +69,6 @@ struct CoreVerification { let operationError: OperationError? } - private struct GitFixture: Decodable { - struct Commit: Decodable { - let hash: String - let parents: [String] - let subject: String - let decorations: String - } - - struct Expected: Decodable { - let rowCount: Int - let mergeRow: Int - let mergeParentCount: Int - let hasMissingParents: Bool - let headLabel: String - } - - let commits: [Commit] - let expected: Expected - } - private static func verifySharedContractFixtures() { let searchURL = URL(fileURLWithPath: "shared/fixtures/search/basic.json") guard let searchData = try? Data(contentsOf: searchURL), @@ -141,31 +120,6 @@ struct CoreVerification { require(actual == fixtureCase.expected, "search fixture case failed: \(fixtureCase.name)") } - let gitURL = URL(fileURLWithPath: "shared/fixtures/git/graph.json") - guard let gitData = try? Data(contentsOf: gitURL), - let gitFixture = try? JSONDecoder().decode(GitFixture.self, from: gitData) else { - require(false, "Git contract fixture could not be decoded") - return - } - let commits = gitFixture.commits.map { commit in - GitCommit( - hash: commit.hash, - shortHash: commit.hash, - parentHashes: commit.parents, - authorName: "Fixture", - authorEmail: "fixture@example.com", - date: "2026/08/02 10:00", - subject: commit.subject, - decorations: commit.decorations - ) - } - let layout = GitGraphLayoutService.layout(commits: commits) - let mergeRow = layout.rows[gitFixture.expected.mergeRow] - require(layout.rows.count == gitFixture.expected.rowCount, "Git fixture row count changed") - require(mergeRow.parentEdges.count == gitFixture.expected.mergeParentCount, "Git fixture merge edge count changed") - require(layout.hasMissingParents == gitFixture.expected.hasMissingParents, "Git fixture missing-parent state changed") - require(mergeRow.labels.contains { $0.title == gitFixture.expected.headLabel }, "Git fixture HEAD label changed") - let commandURL = URL(fileURLWithPath: "shared/fixtures/git/command-response-v1.json") guard let commandData = try? Data(contentsOf: commandURL), let commandFixture = try? JSONDecoder().decode(GitCommandFixture.self, from: commandData) else { @@ -258,23 +212,6 @@ struct CoreVerification { ) } - private static func verifyGitGraph() { - let root = commit(hash: "root", parents: [], subject: "root", decorations: "") - let side = commit(hash: "side", parents: ["root"], subject: "side", decorations: "feature/orders") - let main = commit( - hash: "main", - parents: ["side", "root"], - subject: "merge", - decorations: "HEAD -> main" - ) - let layout = GitGraphLayoutService.layout(commits: [main, side, root]) - require(layout.rows.count == 3, "expected three graph rows") - require(layout.rows[0].isMerge, "expected merge commit") - require(layout.rows[0].parentEdges.count == 2, "expected two merge parent edges") - require(layout.rows[0].parentEdges.allSatisfy { !$0.isMissing }, "merge parents should be present") - require(layout.rows[0].labels.contains { $0.kind == .head }, "HEAD label should be parsed") - } - private static func verifyWhitespaceModes() { require(GitDiffWhitespaceMode.allCases.count == 2, "expected two whitespace modes") require(GitDiffWhitespaceMode.doNotIgnore.title == "Do not ignore", "default whitespace label changed") @@ -301,24 +238,6 @@ struct CoreVerification { require(regularExpression.matches("UserService42", query: "UserService\\d+"), "regex search should match a pattern") } - private static func commit( - hash: String, - parents: [String], - subject: String, - decorations: String - ) -> GitCommit { - GitCommit( - hash: hash, - shortHash: hash, - parentHashes: parents, - authorName: "Test", - authorEmail: "test@example.com", - date: "2026/08/02 10:00", - subject: subject, - decorations: decorations - ) - } - private static func require(_ condition: @autoclosure () -> Bool, _ message: String) { guard condition() else { fputs("Core verification failed: \(message)\n", stderr) diff --git a/macos/Tests/LitheGitGraphVerifier/GitGraphVerification.swift b/macos/Tests/LitheGitGraphVerifier/GitGraphVerification.swift deleted file mode 100644 index d34a212f6e..0000000000 --- a/macos/Tests/LitheGitGraphVerifier/GitGraphVerification.swift +++ /dev/null @@ -1,100 +0,0 @@ -import Foundation -import LitheGitModule - -@main -struct GitGraphVerification { - static func main() { - verifyLinearHistory() - verifyMergeHistory() - verifyMissingParent() - verifyDecorationLabels() - verifyLaneContinuity() - print("GitGraph verification passed: linear, merge, truncated parent, labels, and lane continuity") - } - - /// Compact columns may move; every nonterminal half-edge must meet the - /// corresponding half in the next row, with its identity and color intact. - private static func verifyLaneContinuity() { - let layout = GitGraphLayoutService.layout(commits: [ - commit("H", parents: ["G", "E"]), commit("G", parents: ["F"]), - commit("F", parents: ["D"]), commit("E", parents: ["D"]), - commit("D", parents: ["C"]), commit("C", parents: ["B"]), - commit("B", parents: ["A"]), commit("A", parents: []) - ]) - for (index, row) in layout.rows.enumerated() { - for edge in row.printElements where edge.direction == .down && !edge.isTerminal { - expect(index + 1 < layout.rows.count, "a continuing edge needs a next row") - expect(layout.rows[index + 1].printElements.contains { - $0.edgeID == edge.edgeID && $0.direction == .up - && $0.position == edge.adjacentPosition && $0.adjacentPosition == edge.position - && $0.colorIndex == edge.colorIndex - }, "a compacted edge must join its adjacent half") - } - } - } - - private static func verifyLinearHistory() { - let layout = GitGraphLayoutService.layout(commits: [ - commit("C", parents: ["B"]), - commit("B", parents: ["A"]), - commit("A", parents: []) - ]) - expect(layout.laneCount == 1, "linear history should use one lane") - expect(layout.rows.map { $0.lane } == [0, 0, 0], "linear history lane positions") - expect(!layout.hasMissingParents, "linear history should not report missing parents") - } - - private static func verifyMergeHistory() { - let layout = GitGraphLayoutService.layout(commits: [ - commit("M", parents: ["D", "C"]), - commit("D", parents: ["B"]), - commit("C", parents: ["B"]), - commit("B", parents: []) - ]) - expect(layout.laneCount == 2, "merge history should use two lanes") - expect(layout.rows[0].parentEdges.map { $0.targetLane } == [0, 1], "merge parents should fork") - expect(layout.rows[1].lane == 0 && layout.rows[2].lane == 1, "branch commits should stay on separate lanes") - expect(layout.rows[2].parentEdges.first?.targetLane == 0, "branch should converge into first-parent lane") - } - - private static func verifyMissingParent() { - let layout = GitGraphLayoutService.layout(commits: [ - commit("HEAD", parents: ["OLDER-COMMIT"]) - ]) - expect(layout.hasMissingParents, "truncated history should report missing parent") - expect(layout.rows[0].parentEdges.first?.targetLane == nil, "missing parent should terminate at the row edge") - expect(layout.rows[0].parentEdges.first?.isMissing == true, "missing parent edge should be marked") - } - - private static func verifyDecorationLabels() { - let layout = GitGraphLayoutService.layout(commits: [ - commit("A", parents: [], decorations: "HEAD -> main, origin/main, tag: v1.0") - ]) - let expectedIDs = ["head:HEAD", "branch:main", "remote:origin/main", "tag:v1.0"] - expect(layout.rows[0].labels.map(\.id) == expectedIDs, "decorations should become typed labels") - } - - private static func commit( - _ hash: String, - parents: [String], - decorations: String = "" - ) -> GitCommit { - GitCommit( - hash: hash, - shortHash: String(hash.prefix(7)), - parentHashes: parents, - authorName: "lick", - authorEmail: "lick@example.com", - date: "2026/08/01 12:00", - subject: hash, - decorations: decorations - ) - } - - private static func expect(_ condition: @autoclosure () -> Bool, _ message: String) { - guard condition() else { - fputs("GitGraph verification failed: \(message)\n", stderr) - exit(1) - } - } -} diff --git a/macos/Tests/LitheGitModuleTests/GitGraphLayoutTests.swift b/macos/Tests/LitheGitModuleTests/GitGraphLayoutTests.swift index eed23b4774..7709997b66 100644 --- a/macos/Tests/LitheGitModuleTests/GitGraphLayoutTests.swift +++ b/macos/Tests/LitheGitModuleTests/GitGraphLayoutTests.swift @@ -1,340 +1,122 @@ import Foundation +import LitheGitTestSupport @testable import LitheGitModule import Testing -@Suite("IntelliJ Git graph parity") +/// Layout rules belong to Rust Core (`git.graphProjection`); its tests and +/// `shared/fixtures/git/graph-projection-v1.json` define them. These tests run the real linked +/// Core and assert how the macOS models carry its answer. +@Suite("Git graph through Core") struct GitGraphLayoutTests { - @Test("Current branch background follows every merge parent, not lane or row adjacency") - func currentBranchMembership() { - let refs = [GitReference(fullName: "refs/heads/main", shortName: "main", kind: .local, - peelsToCommit: true, - isCurrent: true, upstreamShortName: nil)] - let commits = [commit("head", ["left", "merged"], "HEAD -> main"), - commit("other", ["base"], "other"), commit("left", ["base"])] - let repository = [commit("merged", ["base"]), commit("base", ["missing"])] - let hashes = GitGraphLayoutService.currentBranchHashes(commits: commits, repositoryCommits: repository, references: refs) - #expect(hashes == ["head", "left", "merged", "base", "missing"]) - #expect(!hashes.contains("other")) - #expect(GitGraphLayoutService.currentBranchHashes(commits: commits, repositoryCommits: repository, references: []).isEmpty) - #expect(GitGraphLayoutService.currentBranchHashes(commits: [commit("detached", [], "HEAD")], - repositoryCommits: [], references: refs).isEmpty) - } - - @Test("DFS indices match pinned IntelliJ fixtures", arguments: ["manyNodes", "oneNode", "notFullGraph", "oneNodeNotFullGraph"]) - func upstreamLayout(_ name: String) throws { - let input = try fixture("layoutBuilder", name, "in") - let expected = try fixture("layoutBuilder", name, "out").split(separator: "\n").map { - Int($0.components(separatedBy: "|-")[0])! - } - let commits = input.split(separator: "\n").map { line in - let parts = line.components(separatedBy: "|-") - return commit(parts[0], parts[1].split(separator: " ").map(String.init)) - } - #expect(GitGraphLayoutService.layout(commits: commits).rows.map(\.layoutIndex) == expected) - } - - @Test("Compact positions and half-edge routing match IntelliJ golden outputs", - arguments: ["oneNode", "manyNodes", "longEdges", "oneUpOneDown1", "oneUpOneDown2"]) - func upstreamPrinting(_ name: String) throws { - let input = try fixture("elementGenerator", name, "in") - var commits: [GitCommit] = [] - var visible = Set<String>() - for line in input.split(separator: "\n") { - let parts = line.components(separatedBy: "|-") - let id = String(parts[0].split(separator: "_")[0]) - visible.insert(id) - var hidden: [GitCommit] = [] - let parents = parts[1].split(separator: " ").map { token -> String in - let fields = token.split(separator: "_") - let target = String(fields[0]) - // Git commits only carry direct edges. A hidden intermediate - // commit recreates the upstream fixture's DOTTED edge naturally. - if fields[1] == "D" { - let hash = "hidden-\(id)-\(target)" - hidden.append(commit(hash, [target])) - return hash - } - return target - } - commits.append(commit(id, parents)) - commits.append(contentsOf: hidden) - } - let options = GitGraphDisplayOptions( - longEdgeSize: name == "oneUpOneDown2" ? 10 : 7, - visiblePartSize: name.hasPrefix("oneUpOneDown") ? 1 : 2, - edgeWithArrowSize: 10 - ) - let layout = GitGraphLayoutService.layout(commits: commits, visibleHashes: visible, options: options) - let expected = try fixture("elementGenerator", name, "out").split(separator: "\n").map { line -> String in - let parts = line.trimmingCharacters(in: .whitespaces).components(separatedBy: "|-") - // The color callback in JetBrains's fixture uses row numbers. - // Compare its verbatim geometry/style/arrow oracle, excluding color. - return parts[0] + "|" + parts[1] - }.sorted() - let actual = layout.rows.enumerated().flatMap { row, value -> [String] in - ["Node|\(row):\(value.lane)"] + value.printElements.map { element in - let direction = element.direction == .down ? "DOWN" : "UP" - let arrow = element.hasArrow ? "_ARROW" : "" - let style = element.isDotted ? "DASHED" : "SOLID" - return "Edge:\(direction)\(arrow):\(style)|\(row):\(element.position):\(element.adjacentPosition)" - } - }.sorted() - #expect(actual == expected) - assertContinuity(layout) - } - - @Test("30-row compact threshold preserves commits and exposes both destinations", arguments: [29, 30, 31]) - func longEdgeBoundary(_ span: Int) throws { - let commits = longEdge(span) - let layout = GitGraphLayoutService.layout(commits: commits) - let arrows = layout.rows.flatMap(\.printElements).filter(\.hasArrow) - #expect(layout.rows.count == commits.count) - if span < 30 { #expect(arrows.isEmpty) } - else { - #expect(arrows.count == 2) - #expect(Set(arrows.compactMap(\.targetHash)) == ["0", String(span)]) - #expect(layout.rows[span / 2].laneCount == 1) - } - assertContinuity(layout) - } - - @Test("Expanded mode keeps the 1,000-row safety threshold", arguments: [999, 1_000]) - func expandedBoundary(_ span: Int) { - let layout = GitGraphLayoutService.layout(commits: longEdge(span), options: .expanded) - #expect(layout.rows[span / 2].laneCount == (span < 1_000 ? 2 : 1)) - #expect(layout.rows.flatMap(\.printElements).filter(\.hasArrow).count == (span < 1_000 ? 2 : 4)) - assertContinuity(layout) - } - - @Test("Filtering bridges hidden ancestors without inventing unloaded parents") - func filterProjection() { - let commits = [commit("a", ["b"]), commit("b", ["c"]), commit("c", ["d"]), commit("d", [])] - let layout = GitGraphLayoutService.layout(commits: commits, visibleHashes: ["a", "d"]) - #expect(layout.rows.map(\.commit.hash) == ["a", "d"]) + @Test("A linear history stays in one lane and keeps its commits and labels") + func linear() throws { + let commits = [commit("C", ["B"], "HEAD -> main"), commit("B", ["A"]), commit("A", [])] + let layout = GitGraphCoreTestSupport.layout(commits: commits) + #expect(layout.rows.map(\.commit.hash) == ["C", "B", "A"]) + #expect(layout.rows.map(\.lane) == [0, 0, 0]) #expect(layout.laneCount == 1) #expect(!layout.hasMissingParents) - #expect(layout.rows.flatMap(\.printElements).allSatisfy { $0.isDotted }) - #expect(layout.rows[0].parentEdges.map(\.parentHash) == ["d"]) + #expect(layout.rows[0].labels.map(\.id) == ["head:HEAD", "branch:main"]) + #expect(layout.rows[0].nodeColorIndex == 3_343_801) + #expect(layout.rows[0].parentEdges.map(\.targetLane) == [0]) assertContinuity(layout) } - @Test("Filtered ancestors retain the unloaded boundary and resolve it after paging") - func filteredMissingParent() throws { - let page = [commit("a", ["b"]), commit("b", ["c"]), commit("unrelated", [])] - let lastRow = GitGraphLayoutService.layout(commits: page, visibleHashes: ["a"]) - #expect(lastRow.hasMissingParents) - #expect(lastRow.rows[0].parentEdges.map(\.parentHash) == ["c"]) - #expect(lastRow.rows[0].parentEdges.allSatisfy { $0.isMissing }) - #expect(lastRow.rows[0].printElements.isEmpty) - - let filtered = GitGraphLayoutService.layout(commits: page, visibleHashes: ["a", "unrelated"]) - #expect(filtered.hasMissingParents) - let prints = filtered.rows.flatMap(\.printElements) - #expect(!prints.isEmpty) - #expect(prints.allSatisfy { $0.isDotted && $0.targetHash == nil }) - #expect(prints.contains { $0.hasArrow && $0.isTerminal }) - assertContinuity(filtered) - - let loaded = page + [commit("c", [])] - let hiddenRoot = GitGraphLayoutService.layout(commits: loaded, visibleHashes: ["a", "unrelated"]) - #expect(!hiddenRoot.hasMissingParents) - #expect(hiddenRoot.rows[0].parentEdges.isEmpty) - let visibleRoot = GitGraphLayoutService.layout(commits: loaded, visibleHashes: ["a", "c"]) - #expect(!visibleRoot.hasMissingParents) - #expect(visibleRoot.rows[0].parentEdges.map(\.parentHash) == ["c"]) - #expect(visibleRoot.rows.flatMap(\.printElements).allSatisfy { $0.isDotted }) - assertContinuity(visibleRoot) - } - - @Test("Missing projection deduplicates hidden merge paths and stops at visible ancestors") - func filteredMissingMergePaths() { - let commits = [commit("a", ["left", "right", "missing"]), commit("peer", ["left"]), - commit("left", ["missing", "missing"]), commit("right", ["missing", "other"]), - commit("unrelated", ["unrelated-missing"])] - let layout = GitGraphLayoutService.layout(commits: commits, visibleHashes: ["a", "peer"]) - #expect(layout.hasMissingParents) - #expect(layout.rows[0].parentEdges.map(\.parentHash) == ["missing", "other"]) - #expect(layout.rows[1].parentEdges.map(\.parentHash) == ["missing"]) - let direct = layout.rows[0].parentEdges.first { $0.parentHash == "missing" } - #expect(layout.rows[0].printElements.filter { $0.edgeID == direct?.id }.allSatisfy { !$0.isDotted }) - - let stopped = GitGraphLayoutService.layout(commits: [commit("a", ["b"]), commit("b", ["c"]), commit("c", ["missing"])], - visibleHashes: ["a", "b"]) - #expect(stopped.rows[0].parentEdges.map(\.parentHash) == ["b"]) - #expect(stopped.rows[0].parentEdges.allSatisfy { !$0.isMissing }) - #expect(stopped.rows[1].parentEdges.map(\.parentHash) == ["missing"]) - let unrelated = GitGraphLayoutService.layout(commits: [commit("a", []), commit("hidden", ["missing"])], visibleHashes: ["a"]) - #expect(!unrelated.hasMissingParents) - } - - @Test("An ended branch gives its column back instead of leaving a hole") - func compactColumns() { - let layout = GitGraphLayoutService.layout(commits: [commit("a", ["b", "c"]), commit("b", []), commit("c", ["d"]), commit("d", [])]) - #expect(layout.rows[1].laneCount == 2) - #expect(layout.rows[2].laneCount == 1) - #expect(layout.rows[2].lane == 0) + @Test("A merge forks into a second lane and converges into the first-parent lane") + func merge() { + let layout = GitGraphCoreTestSupport.layout(commits: [ + commit("M", ["D", "C"]), commit("D", ["B"]), commit("C", ["B"]), commit("B", [])]) + #expect(layout.laneCount == 2) + #expect(layout.rows[0].parentEdges.map(\.targetLane) == [0, 1]) + #expect(layout.rows.map(\.lane) == [0, 0, 1, 0]) + #expect(layout.rows[2].parentEdges.first?.targetLane == 0) + #expect(layout.rows[0].isMerge) assertContinuity(layout) } - @Test("Pagination resolves missing parents without fake navigation targets") + @Test("A truncated parent is marked missing and has no navigation target") func missingParent() { - let head = commit("a", ["b", "b"]) - let page = GitGraphLayoutService.layout(commits: [head]) - #expect(page.hasMissingParents) - #expect(page.rows[0].parentEdges.count == 1) - #expect(page.rows[0].printElements.isEmpty) - #expect(page.rows[0].printElements.allSatisfy { $0.targetHash == nil }) - let full = GitGraphLayoutService.layout(commits: [head, commit("b", [])]) - #expect(!full.hasMissingParents) - #expect(full.rows[0].nodeColorIndex == page.rows[0].nodeColorIndex) - assertContinuity(full) - } - - @Test("Empty filters produce no graph or missing-history notice") - func emptyGraph() { - #expect(GitGraphLayoutService.layout(commits: []).rows.isEmpty) - let layout = GitGraphLayoutService.layout(commits: [commit("a", ["b"])], visibleHashes: []) - #expect(layout.rows.isEmpty) - #expect(layout.laneCount == 0) - #expect(!layout.hasMissingParents) - } - - @Test("5,000 hidden merge boundaries keep only the visible result", arguments: [false, true]) - func filteredMissingParentScaling(_ emptyFilter: Bool) throws { - // Each merge adds a distinct unloaded parent. Copying every suffix's - // full set retained ~12.5 million members for a one-row result. - let count = 5_000 - let history = (0..<count).map { row -> GitCommit in - var parents = ["missing-\(row)"] - if row + 1 < count { parents.insert(String(row + 1), at: 0) } - return commit(String(row), parents) - } - let visible: Set<String> = emptyFilter ? [] : ["0"] - let started = ContinuousClock.now - let layout = GitGraphLayoutService.layout(commits: history, visibleHashes: visible) - print("Filtered missing graph 5000, empty=\(emptyFilter): \(ContinuousClock.now - started)") - if emptyFilter { - #expect(layout.rows.isEmpty) - #expect(!layout.hasMissingParents) - } else { - #expect(layout.rows.count == 1) - let row = try #require(layout.rows.first) - #expect(Set(row.parentEdges.map(\.parentHash)) == Set((0..<count).map { "missing-\($0)" })) - #expect(row.parentEdges.allSatisfy { $0.isMissing }) - #expect(layout.hasMissingParents) - } - } - - @Test("Many visible children reuse a shared hidden chain's boundary") - func sharedHiddenMissingChain() { - let count = 2_500 - let heads = (0..<count).map { commit("head-\($0)", ["hidden-0"]) } - let hidden = (0..<count).map { row -> GitCommit in - let parent = row + 1 < count ? "hidden-\(row + 1)" : "missing" - return commit("hidden-\(row)", [parent]) - } - let layout = GitGraphLayoutService.layout(commits: heads + hidden, visibleHashes: Set(heads.map(\.hash))) - #expect(layout.rows.count == count) + let layout = GitGraphCoreTestSupport.layout(commits: [commit("a", ["b", "b"])]) #expect(layout.hasMissingParents) - #expect(layout.rows.allSatisfy { $0.parentEdges.map(\.parentHash) == ["missing"] }) - assertContinuity(layout) - } - - @Test("Cancellation stops emitting projected missing parents") - @MainActor - func cancelledMissingProjection() async { - let task = Task { - var emitted: [String] = [] - GitGraphMissingParents.project( - commits: [commit("a", ["b"]), commit("b", ["missing-a", "missing-b"])], - byHash: ["a": 0, "b": 1], parents: [[1], []], visible: [0] - ) { _, hash in - emitted.append(hash) - // Cancel at an observable consumer boundary, with no clock or - // scheduler race. Subsequent endpoints must not be published. - withUnsafeCurrentTask { $0?.cancel() } - } - return emitted - } - defer { task.cancel() } - #expect(await task.value == ["missing-a"]) + #expect(layout.rows[0].parentEdges.count == 1) + #expect(layout.rows[0].parentEdges[0].isMissing) + #expect(layout.rows[0].parentEdges[0].targetLane == nil) + #expect(layout.rows[0].printElements.allSatisfy { $0.targetHash == nil }) } - @Test("IDEA reference priority seeds main before newer feature tips and inner branch heads") - func referencePriority() { - let commits = [commit("feature", ["main"], "HEAD -> feature"), - commit("main", ["root"], "refs/heads/main"), commit("root", [])] - let layout = GitGraphLayoutService.layout(commits: commits) - #expect(layout.rows.map(\.layoutIndex) == [2, 1, 1]) - let tagged = [commit("tip", ["tag"]), commit("tag", ["root"], "tag: v1"), commit("root", [])] - #expect(GitGraphLayoutService.layout(commits: tagged).rows.map(\.layoutIndex) == [1, 1, 1]) - let remote = GitReference(fullName: "refs/remotes/upstream/work", shortName: "upstream/work", kind: .remote, - peelsToCommit: true, - isCurrent: false, upstreamShortName: nil) - let tips = [commit("local", ["root"], "main"), commit("remote", ["root"], "upstream/work"), commit("root", [])] - let withRemote = GitGraphLayoutService.layout(commits: tips, references: [remote]) - #expect(withRemote.rows.map(\.layoutIndex) == [2, 1, 1]) - #expect(withRemote.rows[1].labels.first?.kind == .remote) - let origin = [commit("other", ["root"], "refs/remotes/upstream/work"), - commit("preferred", ["root"], "origin/main"), commit("root", [])] - #expect(GitGraphLayoutService.layout(commits: origin).rows.map(\.layoutIndex) == [2, 1, 1]) - } - - @Test("Natural reference names preserve IDEA numeric, zero and case tie-breaks") - func naturalReferenceNames() { - let names = ["feature10", "feature02", "feature2", "Feature2", "feature1", "feature002", "feature2x"] - let sorted = names.sorted { GitGraphHeadOrdering.naturalCompare(Array($0.utf16), Array($1.utf16)) < 0 } - #expect(sorted == ["feature1", "Feature2", "feature2", "feature2x", "feature02", "feature002", "feature10"]) + @Test("Filtering bridges hidden ancestors with dotted edges") + func filtered() { + let commits = [commit("a", ["b"]), commit("b", ["c"]), commit("c", ["d"]), commit("d", [])] + let layout = GitGraphCoreTestSupport.layout(commits: commits, visibleHashes: ["a", "d"]) + #expect(layout.rows.map(\.commit.hash) == ["a", "d"]) + #expect(layout.rows[0].parentEdges.map(\.parentHash) == ["d"]) + let printed: [GitGraphPrintElement] = layout.rows.flatMap { $0.printElements } + #expect(printed.allSatisfy { $0.isDotted }) + assertContinuity(layout) + let none = GitGraphCoreTestSupport.layout(commits: commits, visibleHashes: []) + #expect(none.rows.isEmpty && none.laneCount == 0) } - @Test("Branch scope retains repository head priority and base order") - func repositoryGraphBeforeScope() { + @Test("A branch scope keeps the repository graph's color and base order") + func repositoryContext() { let main = commit("main-tip", ["root"], "origin/main") let side = commit("side", ["root"], "HEAD -> feature") let root = commit("root", []) - let repository = [main, side, root] - let scoped = GitGraphLayoutService.layout(commits: [side, root], repositoryCommits: repository) - let full = GitGraphLayoutService.layout(commits: repository) + let full = GitGraphCoreTestSupport.layout(commits: [main, side, root]) + let scoped = GitGraphCoreTestSupport.layout(commits: [side, root], repositoryCommits: [main, side, root]) #expect(scoped.rows.map(\.layoutIndex) == [2, 1]) - #expect(scoped.rows.map(\.nodeColorIndex) == Array(full.rows.dropFirst()).map(\.nodeColorIndex)) - let reordered = GitGraphLayoutService.layout(commits: [side, main, root], repositoryCommits: repository) + let scopedColors: [Int] = scoped.rows.map { $0.nodeColorIndex } + let fullColors: [Int] = full.rows.dropFirst().map { $0.nodeColorIndex } + #expect(scopedColors == fullColors) + let reordered = GitGraphCoreTestSupport.layout(commits: [side, main, root], repositoryCommits: [main, side, root]) #expect(reordered.rows.map(\.commit.hash) == ["main-tip", "side", "root"]) - assertContinuity(reordered) } - @Test("Incomplete or duplicate repository context falls back without dropping visible commits") - func incompleteRepositoryContext() { - let values = [commit("tip", ["root"]), commit("root", [])] - let expected = GitGraphLayoutService.layout(commits: values) - for context in [[values[1]], [values[0], values[0], values[1]]] { - let layout = GitGraphLayoutService.layout(commits: values, repositoryCommits: context) - #expect(layout.rows == expected.rows) + @Test("Expanded mode keeps a long edge as a full lane; compact mode folds it") + func displayMode() { + var commits: [GitCommit] = [] + for row in 0...39 { + var parents: [String] = [] + if row == 0 { parents = ["1", "39"] } else if row < 39 { parents = [String(row + 1)] } + commits.append(commit(String(row), parents)) } + let compact = GitGraphCoreTestSupport.layout(commits: commits) + let expanded = GitGraphCoreTestSupport.layout(commits: commits, options: .expanded) + #expect(compact.rows[20].laneCount == 1) + #expect(expanded.rows[20].laneCount == 2) + let arrows: [GitGraphPrintElement] = compact.rows.flatMap { $0.printElements } + #expect(arrows.filter { $0.hasArrow }.count == 2) + assertContinuity(compact) + assertContinuity(expanded) + } + + @Test("Current branch ancestry follows every merge parent and never guesses") + func currentBranch() { + let commits = [commit("head", ["left", "merged"], "HEAD -> main"), + commit("other", ["base"], "other"), commit("left", ["base"])] + let repository = [commit("merged", ["base"]), commit("base", ["missing"])] + let layout = GitGraphCoreTestSupport.layout(commits: commits, repositoryCommits: repository, currentBranch: "main") + #expect(layout.currentBranchHashes == ["head", "left", "merged", "base", "missing"]) + #expect(GitGraphCoreTestSupport.layout(commits: commits, repositoryCommits: repository).currentBranchHashes.isEmpty) + #expect(GitGraphCoreTestSupport.layout(commits: [commit("detached", [], "HEAD")], currentBranch: "main") + .currentBranchHashes.isEmpty) } - @Test("Recommended graph width follows weighted edge counts, not the widest row") - func recommendedWidth() { - let layout = GitGraphLayoutService.layout(commits: [commit("a", ["c"]), commit("b", ["c"]), commit("c", [])]) - #expect(layout.recommendedLaneCount == 2) - #expect(GitGraphLayoutService.routingSnapshot(for: layout).recommendedLaneCount == 2) - let compact = GitGraphLayoutService.layout(commits: longEdge(100)) - let expanded = GitGraphLayoutService.layout(commits: longEdge(100), options: .expanded) - #expect(compact.recommendedLaneCount == 1) - #expect(expanded.recommendedLaneCount == 2) - } - - private func longEdge(_ span: Int) -> [GitCommit] { - (0...span).map { row -> GitCommit in - let parents: [String] - if row == span { - parents = [] - } else if row == 0 { - parents = ["1", String(span)] - } else { - parents = [String(row + 1)] - } - return commit(String(row), parents) - } + @Test("The request carries identities, remote names, filter and mode") + func request() throws { + let remote = GitReference(fullName: "refs/remotes/upstream/work", shortName: "upstream/work", kind: .remote, + peelsToCommit: true, isCurrent: false, upstreamShortName: nil) + let request = GitGraphLayoutService.request( + commits: [commit("a", ["b"], "x")], references: [remote], visibleHashes: ["a"], options: .expanded, + currentBranch: "main") + let expected = GitGraphProjectionRequest.Commit(hash: "a", parentHashes: ["b"], decorations: "x") + #expect(request.commits == [expected]) + #expect(request.remoteNames == ["upstream/work"]) + #expect(request.visibleHashes == ["a"]) + #expect(request.displayMode == "expanded") + #expect(request.currentBranch == "main") + let ghost = try GitGraphProjectionResponse.ghost() + #expect(GitGraphLayoutService.layout(commits: [commit("a", [])], response: ghost) == nil) } private func commit(_ hash: String, _ parents: [String], _ decorations: String = "") -> GitCommit { @@ -342,11 +124,6 @@ struct GitGraphLayoutTests { authorEmail: "fixture@example.invalid", date: "2026/09/11", subject: hash, decorations: decorations) } - private func fixture(_ group: String, _ name: String, _ suffix: String) throws -> String { - let root = try #require(Bundle.module.resourceURL) - return try String(contentsOf: root.appendingPathComponent("Fixtures/GitGraphIDEA/\(group)/\(name)_\(suffix).txt"), encoding: .utf8) - } - private func assertContinuity(_ layout: GitGraphLayout) { for (row, value) in layout.rows.enumerated() { for edge in value.printElements where !edge.isTerminal { @@ -362,3 +139,11 @@ struct GitGraphLayoutTests { } } } + +private extension GitGraphProjectionResponse { + static func ghost() throws -> GitGraphProjectionResponse { + // Core never returns a row for a commit the host did not send. + try JSONDecoder().decode(GitGraphProjectionResponse.self, from: Data( + #"{"rows":[{"commitHash":"ghost","lane":0,"laneCount":1,"colorId":0,"layoutIndex":1,"incomingLaneColors":[0],"parentEdges":[],"labels":[],"printElements":[]}],"laneCount":1,"recommendedLaneCount":1,"hasMissingParents":false,"currentBranchHashes":[]}"#.utf8)) + } +} diff --git a/macos/Tests/LitheGitPerformanceTests/GitGraphPerformanceBaselineTests.swift b/macos/Tests/LitheGitPerformanceTests/GitGraphPerformanceBaselineTests.swift index 9c81244177..94ac396dbe 100644 --- a/macos/Tests/LitheGitPerformanceTests/GitGraphPerformanceBaselineTests.swift +++ b/macos/Tests/LitheGitPerformanceTests/GitGraphPerformanceBaselineTests.swift @@ -1,5 +1,6 @@ @testable import Lithe import LitheGitModule +import LitheGitTestSupport import LitheGitPerformanceSupport import AppKit import QuartzCore @@ -33,7 +34,7 @@ struct GitGraphPerformanceBaselineTests { @Test("The 1,000-commit graph preserves the compact routing baseline") func oneThousandCommitLayoutBaseline() { let commits = SyntheticGitGraphFixture.mergeHeavy(commitCount: 1_000) - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) print("Compact graph 1000: \(GitGraphStructureBaseline(layout: layout)), signature=\(GitGraphStructureBaseline.signature(of: layout))") #expect(GitGraphStructureBaseline(layout: layout) == .expected(commitCount: 1_000)) @@ -49,7 +50,7 @@ struct GitGraphPerformanceBaselineTests { func fiveThousandCommitLayoutBaseline() { let commits = SyntheticGitGraphFixture.mergeHeavy(commitCount: 5_000) // Exercise the production path, including the full repository graph. - let layout = GitGraphLayoutService.layout(commits: commits, repositoryCommits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits, repositoryCommits: commits) #expect(SyntheticGitGraphFixture.parentsFollowChildren(in: commits)) print("Compact graph 5000: \(GitGraphStructureBaseline(layout: layout)), signature=\(GitGraphStructureBaseline.signature(of: layout))") @@ -81,7 +82,7 @@ struct GitGraphPerformanceBaselineTests { let viewportRowCount = 40 let rowHeight = GitGraphGeometry.rowHeight let commits = SyntheticGitGraphFixture.mergeHeavy(commitCount: rowCount) - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) let view = GitGraphNSView(frame: NSRect(x: 0, y: 0, width: 120, height: CGFloat(rowCount) * rowHeight)) view.update(snapshot: GitGraphLayoutService.routingSnapshot(for: layout), width: 120, rowHeight: rowHeight) // Keep the complete history, but draw a viewport as AppKit does while @@ -138,7 +139,7 @@ struct GitGraphPerformanceBaselineTests { @Test("The routing snapshot preserves layout topology and ordering") func routingSnapshotPreservesTopology() { let commits = SyntheticGitGraphFixture.mergeHeavy(commitCount: 1_000) - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) let snapshot = GitGraphLayoutService.routingSnapshot(for: layout) #expect(snapshot.laneCount == layout.laneCount) @@ -170,7 +171,7 @@ struct GitGraphPerformanceBaselineTests { decorations: "HEAD -> main" ) ] - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) let snapshot = GitGraphLayoutService.routingSnapshot(for: layout) #expect(snapshot.rows.count == 1) @@ -431,7 +432,7 @@ struct GitGraphPerformanceBaselineTests { @MainActor func nativeGitLogScrollContainerBaseline() { let commits = SyntheticGitGraphFixture.mergeHeavy(commitCount: 5_000) - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) let presentation = GitGraphPresentation( rows: layout.rows, routingSnapshot: GitGraphLayoutService.routingSnapshot(for: layout), @@ -494,7 +495,7 @@ struct GitGraphPerformanceBaselineTests { @MainActor func nativeGitLogCommitRowsFrameBaseline() throws { let commits = SyntheticGitGraphFixture.mergeHeavy(commitCount: 5_000) - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) let rowsView = GitGraphCommitRowsNSView(frame: CGRect( x: 0, y: 0, @@ -648,7 +649,7 @@ struct GitGraphPerformanceBaselineTests { } let commits = SyntheticGitGraphFixture.mergeHeavy(commitCount: 5_000) - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) let presentation = GitGraphPresentation( rows: layout.rows, routingSnapshot: GitGraphLayoutService.routingSnapshot(for: layout), diff --git a/macos/Tests/LitheGitPerformanceVerifier/GitPerformanceVerifier.swift b/macos/Tests/LitheGitPerformanceVerifier/GitPerformanceVerifier.swift index cba403e62d..4ba6e61cb2 100644 --- a/macos/Tests/LitheGitPerformanceVerifier/GitPerformanceVerifier.swift +++ b/macos/Tests/LitheGitPerformanceVerifier/GitPerformanceVerifier.swift @@ -1,5 +1,6 @@ import Foundation import LitheGitModule +import LitheGitTestSupport import LitheGitPerformanceSupport @main @@ -43,7 +44,7 @@ struct GitPerformanceVerifier { var expectedSignature: UInt64? for _ in 0..<warmupCount { - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) try validate( layout: layout, expected: expected, @@ -57,7 +58,7 @@ struct GitPerformanceVerifier { samples.reserveCapacity(sampleCount) for _ in 0..<sampleCount { let start = clock.now - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) let elapsed = milliseconds(clock.now - start) guard elapsed.isFinite, elapsed >= 0 else { throw VerificationError.invalidSample(commitCount: commitCount, milliseconds: elapsed) diff --git a/macos/Tests/LitheGitTestSupport/GitGraphCoreTestSupport.swift b/macos/Tests/LitheGitTestSupport/GitGraphCoreTestSupport.swift new file mode 100644 index 0000000000..d6783a3532 --- /dev/null +++ b/macos/Tests/LitheGitTestSupport/GitGraphCoreTestSupport.swift @@ -0,0 +1,43 @@ +import Foundation +import LitheRustCore +import LitheGitModule + +/// Runs `git.graphProjection` in the real linked Core, so graph tests assert Core's +/// answer and never mirror its layout rules. +package enum GitGraphCoreTestSupport { + private struct Envelope: Encodable { + let id = "graph" + let command = "git.graphProjection" + let payload: GitGraphProjectionRequest + } + private struct Reply: Decodable { let ok: Bool; let data: GitGraphProjectionResponse? } + + package static func response(_ request: GitGraphProjectionRequest) -> GitGraphProjectionResponse? { + guard let data = try? JSONEncoder().encode(Envelope(payload: request)), + let json = String(data: data, encoding: .utf8), + let result = json.withCString({ lithe_bridge_execute_json($0) }) else { return nil } + defer { lithe_bridge_free_string(result) } + guard let reply = try? JSONDecoder().decode(Reply.self, from: Data(String(cString: result).utf8)), + reply.ok else { return nil } + return reply.data + } + + /// The layout Core projects for one loaded window. + package static func layout( + commits: [GitCommit], + references: [GitReference] = [], + repositoryCommits: [GitCommit] = [], + visibleHashes: Set<String>? = nil, + options: GitGraphDisplayOptions = .compact, + currentBranch: String? = nil + ) -> GitGraphLayout { + guard !commits.isEmpty else { return GitGraphLayout(rows: [], laneCount: 0, hasMissingParents: false) } + let request = GitGraphLayoutService.request( + commits: commits, references: references, repositoryCommits: repositoryCommits, + visibleHashes: visibleHashes, options: options, currentBranch: currentBranch) + guard let response = response(request), + let layout = GitGraphLayoutService.layout(commits: commits, response: response) + else { preconditionFailure("Core rejected the graph projection request") } + return layout + } +} diff --git a/macos/Tests/LitheTests/BundledUIFontTests.swift b/macos/Tests/LitheTests/BundledUIFontTests.swift index 419bb58b43..7222232ad6 100644 --- a/macos/Tests/LitheTests/BundledUIFontTests.swift +++ b/macos/Tests/LitheTests/BundledUIFontTests.swift @@ -4,6 +4,7 @@ import CryptoKit import SwiftUI import Testing import LitheGitModule +import LitheGitTestSupport import WebKit @testable import Lithe @@ -154,7 +155,7 @@ struct BundledUIFontTests { authorName: "Author", authorEmail: "author@example.invalid", date: "2026/09/30", subject: subject, decorations: "") } - let rows = GitGraphLayoutService.layout(commits: commits).rows + let rows = GitGraphCoreTestSupport.layout(commits: commits).rows for dark in [false, true] { let view = GitGraphCommitRowsNSView(frame: NSRect(x: 0, y: 0, width: 720, height: CGFloat(rows.count) * 26)) view.appearance = NSAppearance(named: dark ? .darkAqua : .aqua) diff --git a/macos/Tests/LitheTests/GitGraphInteractionTests.swift b/macos/Tests/LitheTests/GitGraphInteractionTests.swift index ea08bd3b57..e2b59d17c5 100644 --- a/macos/Tests/LitheTests/GitGraphInteractionTests.swift +++ b/macos/Tests/LitheTests/GitGraphInteractionTests.swift @@ -3,6 +3,7 @@ import CoreText import Foundation import ObjectiveC @testable import LitheGitModule +import LitheGitTestSupport import SwiftUI @testable import Lithe import Testing @@ -18,7 +19,7 @@ struct GitGraphInteractionTests { func group(_ decorations: String) throws -> GitGraphReferenceGroup { let commit = GitCommit(hash: "tip", shortHash: "tip", parentHashes: [], authorName: "Test", authorEmail: "", date: "", subject: "Subject", decorations: decorations) - let row = try #require(GitGraphLayoutService.layout(commits: [commit]).rows.first) + let row = try #require(GitGraphCoreTestSupport.layout(commits: [commit]).rows.first) return GitGraphReferenceGroup(labels: row.labels, references: [local]) } let tracked = try group("HEAD -> main, refs/remotes/upstream/release, tag: v1") @@ -159,7 +160,7 @@ struct GitGraphInteractionTests { let commit = GitCommit(hash: "tip", shortHash: "tip", parentHashes: [], authorName: "Test", authorEmail: "", date: "2026/09/09", subject: "A commit with a long branch reference", decorations: "HEAD -> main, origin/main, refs/remotes/origin/codex/frontend-preview-with-long-name") - let rows = GitGraphLayoutService.layout(commits: [commit]).rows + let rows = GitGraphCoreTestSupport.layout(commits: [commit]).rows let frame = CGRect(x: 0, y: 0, width: 780, height: GitGraphGeometry.rowHeight) let view = GitGraphCommitRowsNSView(frame: frame) let window = NSWindow(contentRect: frame, styleMask: [.borderless], backing: .buffered, defer: false) @@ -198,7 +199,7 @@ struct GitGraphInteractionTests { @Test("Real history matches IDEA for page, repository context and Normal date order", arguments: ["page", "context", "date"]) func reportedHistoryParity(_ fixture: String) throws { - let layout = GitGraphLayoutService.layout(commits: try reportedCommits(fixture == "date" ? "issue410-date-history" : "issue410-history"), + let layout = GitGraphCoreTestSupport.layout(commits: try reportedCommits(fixture == "date" ? "issue410-date-history" : "issue410-history"), repositoryCommits: fixture == "page" ? [] : try reportedCommits(fixture == "date" ? "issue410-date-context" : "issue410-context")) var actual = ["Width|\(layout.recommendedLaneCount)"] for (index, row) in layout.rows.enumerated() { @@ -231,7 +232,7 @@ struct GitGraphInteractionTests { @Test("Real merge clusters render in date and legacy order in both appearances", arguments: [false, true]) func reportedHistoryRendering(_ dateOrder: Bool) throws { - let layout = GitGraphLayoutService.layout(commits: try reportedCommits(dateOrder ? "issue410-date-history" : "issue410-history"), + let layout = GitGraphCoreTestSupport.layout(commits: try reportedCommits(dateOrder ? "issue410-date-history" : "issue410-history"), repositoryCommits: try reportedCommits(dateOrder ? "issue410-date-context" : "issue410-context")) #expect(layout.rows.count == (dateOrder ? 300 : 200)) let selectedIndex = try #require(layout.rows.firstIndex { $0.commit.hash.hasPrefix("ba3725bb") }) @@ -312,12 +313,12 @@ struct GitGraphInteractionTests { GitCommit(hash: String(index), shortHash: String(index), parentHashes: [], authorName: "", authorEmail: "", date: date, subject: "", decorations: "") } - let rows = GitGraphLayoutService.layout(commits: commits).rows + let rows = GitGraphCoreTestSupport.layout(commits: commits).rows let frame = NSRect(x: 0, y: 0, width: 850, height: CGFloat(rows.count) * GitGraphGeometry.rowHeight) let view = GitGraphCommitRowsNSView(frame: frame) view.update(rows: rows, selectedHash: nil, showDecorations: false, graphWidth: 100, rowHeight: GitGraphGeometry.rowHeight, actions: actions { _ in }) - let layout = GitGraphLayoutService.layout(commits: commits) + let layout = GitGraphCoreTestSupport.layout(commits: commits) let hosting = NSHostingView(rootView: GitGraphView(presentation: presentation(layout), selectedHash: nil, showCommitDecorations: false, actions: actions { _ in }).environment(\.locale, Locale(identifier: "en"))) hosting.frame = frame @@ -423,7 +424,7 @@ struct GitGraphInteractionTests { @Test("Both arrow hit regions navigate to their real visible endpoint") func arrowHitRegions() throws { - let layout = GitGraphLayoutService.layout(commits: commits()) + let layout = GitGraphCoreTestSupport.layout(commits: commits()) let view = GitGraphNSView() view.update(snapshot: GitGraphLayoutService.routingSnapshot(for: layout), width: 60, rowHeight: GitGraphGeometry.rowHeight) var targets = Set<String>() @@ -554,7 +555,7 @@ struct GitGraphInteractionTests { authorName: value.authorName, authorEmail: value.authorEmail, date: value.date, subject: value.subject, decorations: value.decorations) } - return GitGraphLayoutService.layout(commits: history, options: .expanded) + return GitGraphCoreTestSupport.layout(commits: history, options: .expanded) } @Test("Native arrow routing leaves ordinary SwiftUI row clicks selectable") @@ -593,7 +594,7 @@ struct GitGraphInteractionTests { @Test("The hovered row follows a stationary pointer while rows scroll under it") func hoverFollowsThePointerWhenRowsScroll() throws { - let layout = GitGraphLayoutService.layout(commits: commits()) + let layout = GitGraphCoreTestSupport.layout(commits: commits()) let scroll = GitGraphScrollView.makeScrollView( presentation: presentation(layout), selectedHash: nil, showCommitDecorations: true, canLoadMore: false, isLoadingMore: false, @@ -631,7 +632,7 @@ struct GitGraphInteractionTests { @Test("Arrow activation selects and scrolls to parent, then back to child") func bidirectionalNavigation() throws { - let layout = GitGraphLayoutService.layout(commits: commits()) + let layout = GitGraphCoreTestSupport.layout(commits: commits()) var selection: String? let scroll = GitGraphScrollView.makeScrollView( presentation: presentation(layout), selectedHash: nil, showCommitDecorations: true, @@ -661,7 +662,7 @@ struct GitGraphInteractionTests { @Test("Production SwiftUI arrow buttons deliver clicks to both destinations") func swiftUIArrowButtons() async throws { - let layout = GitGraphLayoutService.layout(commits: commits()) + let layout = GitGraphCoreTestSupport.layout(commits: commits()) var targets: [String] = [] var callbacks = actions { _ in } callbacks.onNavigateHash = { targets.append($0) } @@ -699,7 +700,7 @@ struct GitGraphInteractionTests { func renderSurfaces() throws { for expanded in [false, true] { for dark in [false, true] { - let layout = GitGraphLayoutService.layout(commits: commits(), options: expanded ? .expanded : .compact) + let layout = GitGraphCoreTestSupport.layout(commits: commits(), options: expanded ? .expanded : .compact) let document = GitGraphScrollDocumentView() document.appearance = NSAppearance(named: dark ? .darkAqua : .aqua) document.update(presentation: presentation(layout), selectedHash: "0", showCommitDecorations: true, @@ -725,7 +726,7 @@ struct GitGraphInteractionTests { @Test("Text follows local graph width and leaves diagonal boundary clearance") func compactTextWidth() { - let layout = GitGraphLayoutService.layout(commits: commits()) + let layout = GitGraphCoreTestSupport.layout(commits: commits()) let narrow = GitGraphGeometry.rowWidth(layout.rows[20], recommendedLaneCount: 0) let arrow = GitGraphGeometry.rowWidth(layout.rows[1], recommendedLaneCount: 0) #expect(narrow < arrow) @@ -747,7 +748,7 @@ struct GitGraphInteractionTests { #expect(offset >= minimum) #expect(offset >= floor(GitGraphGeometry.rowWidth(row, recommendedLaneCount: 0)) + 2) } - let compact = GitGraphLayoutService.layout(commits: commits()).rows[20] + let compact = GitGraphCoreTestSupport.layout(commits: commits()).rows[20] #expect(GitGraphGeometry.titleOffset(compact, recommendedLaneCount: 0) == minimum) } @@ -756,7 +757,7 @@ struct GitGraphInteractionTests { let commit = GitCommit(hash: "merge", shortHash: "merge", parentHashes: ["left", "right"], authorName: "MMMMMMMM", authorEmail: "test@example.invalid", date: "MMMMMMMM", subject: "MMMMMMMM", decorations: "") - let layout = GitGraphLayoutService.layout(commits: [commit]) + let layout = GitGraphCoreTestSupport.layout(commits: [commit]) let row = try #require(layout.rows.first) let frame = NSRect(x: 0, y: 0, width: 850, height: GitGraphGeometry.rowHeight) let native = GitGraphCommitRowsNSView(frame: frame) @@ -804,8 +805,8 @@ struct GitGraphInteractionTests { @Test("Native history scrolling loads pages automatically and stops on failure or exhaustion") func automaticHistoryPaging() async throws { let all = try reportedCommits("issue410-date-history") - let initial = presentation(GitGraphLayoutService.layout(commits: Array(all.prefix(50)))) - let expanded = presentation(GitGraphLayoutService.layout(commits: Array(all.prefix(100)))) + let initial = presentation(GitGraphCoreTestSupport.layout(commits: Array(all.prefix(50)))) + let expanded = presentation(GitGraphCoreTestSupport.layout(commits: Array(all.prefix(100)))) var requests = 0 let callbacks = actions { _ in } let scroll = GitGraphScrollView.makeScrollView(presentation: initial, @@ -869,7 +870,7 @@ struct GitGraphInteractionTests { @Test("The reserved footer row is never blank: it offers the next page, shows progress, and goes away with the history") func footerRowIsNeverBlankWhileOlderHistoryExists() throws { let all = try reportedCommits("issue410-date-history") - let page = presentation(GitGraphLayoutService.layout(commits: Array(all.prefix(50)))) + let page = presentation(GitGraphCoreTestSupport.layout(commits: Array(all.prefix(50)))) let callbacks = actions { _ in } var requests = 0 let scroll = GitGraphScrollView.makeScrollView(presentation: page, @@ -917,8 +918,8 @@ struct GitGraphInteractionTests { @Test("Background history refresh retains the visible commit and pixel inset while explicit navigation still wins") func backgroundHistoryRefreshAnchorsVisibleCommitInsteadOfSelectedCommit() throws { let all = try reportedCommits("issue410-date-history") - let initial = presentation(GitGraphLayoutService.layout(commits: Array(all[1..<201]))) - let refreshed = presentation(GitGraphLayoutService.layout(commits: Array(all.prefix(200)))) + let initial = presentation(GitGraphCoreTestSupport.layout(commits: Array(all[1..<201]))) + let refreshed = presentation(GitGraphCoreTestSupport.layout(commits: Array(all.prefix(200)))) let callbacks = actions { _ in } let selected = initial.rows[150].commit.hash let scroll = GitGraphScrollView.makeScrollView(presentation: initial, selectedHash: selected, @@ -957,7 +958,7 @@ struct GitGraphInteractionTests { @Test("Continuous native viewport resizing retains document, scroll and multiple selections") func continuousViewportResize() throws { - let layout = GitGraphLayoutService.layout(commits: try reportedCommits("issue410-date-history")) + let layout = GitGraphCoreTestSupport.layout(commits: try reportedCommits("issue410-date-history")) let data = presentation(layout) var clicked: [(String, NSEvent.ModifierFlags)] = [] var callbacks = actions { _ in } @@ -1057,7 +1058,7 @@ struct GitGraphInteractionTests { @Test("The production split handle continuously resizes Git Log with a diff above it") func dragGitLogWithDiff() async throws { - let data = presentation(GitGraphLayoutService.layout(commits: try reportedCommits("issue410-date-history"))) + let data = presentation(GitGraphCoreTestSupport.layout(commits: try reportedCommits("issue410-date-history"))) let diff = (0..<1_200).map { index in DiffRow(oldLine: index + 1, newLine: index + 1, left: "let value = \(index)", right: nil, kind: .context, sequence: index) @@ -1165,7 +1166,7 @@ struct GitGraphInteractionTests { @Test("Git Log viewport resize comparison with 300 commits") func viewportResizeComparison() throws { - let layout = GitGraphLayoutService.layout(commits: try reportedCommits("issue410-date-history")) + let layout = GitGraphCoreTestSupport.layout(commits: try reportedCommits("issue410-date-history")) let data = presentation(layout) let callbacks = actions { _ in } let legacy = NSHostingView(rootView: ScrollView { diff --git a/rust/lithe-core/src/git/graph_tests.rs b/rust/lithe-core/src/git/graph_tests.rs index 4a10889b5c..0fca1cec18 100644 --- a/rust/lithe-core/src/git/graph_tests.rs +++ b/rust/lithe-core/src/git/graph_tests.rs @@ -706,7 +706,7 @@ fn natural_reference_names_keep_numeric_zero_and_case_tie_breaks() { } #[test] -fn color_ids_are_java_string_hash_codes_of_the_principal_reference() { +fn color_ids_hash_the_principal_reference_name() { let id = |decorations: &str| color_id(&parse_labels(decorations, &HashSet::new())); assert_eq!(id("main"), 3_343_801); assert_eq!(id("master"), -1_081_267_614); diff --git a/scripts/architecture/language-specifics-baseline.json b/scripts/architecture/language-specifics-baseline.json index 18e8072719..1495b4b746 100644 --- a/scripts/architecture/language-specifics-baseline.json +++ b/scripts/architecture/language-specifics-baseline.json @@ -485,9 +485,6 @@ "windows/tauri/src/features/git/hooks/use-git-blame.test.ts": {"words":2}, "windows/tauri/src/features/git/services/working-tree-diff-refresh.test.ts": {"words":9}, "windows/tauri/src/features/git/stores/git-blame.store.test.ts": {"words":5}, - "windows/tauri/src/features/git/utils/git-graph-colors.test.ts": {"words":1}, - "windows/tauri/src/features/git/utils/git-graph-colors.ts": {"words":2}, - "windows/tauri/src/features/git/utils/git-graph-layout.test.ts": {"words":6}, "windows/tauri/src/features/git/utils/monaco-diff-hunk-actions.test.ts": {"words":19}, "windows/tauri/src/features/host-api/ide-capabilities.test.ts": {"words":44}, "windows/tauri/src/features/host-api/ide-capabilities.ts": {"words":99,"nameComparisons":5}, diff --git a/scripts/git-graph/verify-git-graph.sh b/scripts/git-graph/verify-git-graph.sh index d52d227128..32c734b4f6 100755 --- a/scripts/git-graph/verify-git-graph.sh +++ b/scripts/git-graph/verify-git-graph.sh @@ -4,8 +4,8 @@ set -euo pipefail ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)" cd "$ROOT_DIR" -swift run --quiet LitheGitGraphVerifier - +# Layout rules are verified in Rust Core (`cargo test -p lithe-core --lib git::graph`) +# and in the macOS graph tests; this script checks the fixture repository shape. FIXTURE_DIR="$(scripts/git-graph/create-git-graph-fixture.sh)" MERGE_LINE="$(git -C "$FIXTURE_DIR" log --all --merges --format='%H %P' -1)" MERGE_PARENT_COUNT="$(print -r -- "$MERGE_LINE" | awk '{ print NF - 1 }')" diff --git a/scripts/macos/perf/test-git-performance-baseline.sh b/scripts/macos/perf/test-git-performance-baseline.sh index 4882ad6c09..d5afbe88a9 100755 --- a/scripts/macos/perf/test-git-performance-baseline.sh +++ b/scripts/macos/perf/test-git-performance-baseline.sh @@ -41,6 +41,15 @@ if ! /usr/bin/xcrun ld -help 2>&1 | /usr/bin/grep -q -- '-no_warn_duplicate_libr SWIFT_BUILD_ARGS+=(-Xswiftc "-ld-path=$ROOT_DIR/scripts/macos/build/ld-macos13-compat.sh") fi +# The graph layout is Rust Core's; the verifier measures the same linked Core call. +case "$(uname -m)" in + arm64) RUST_TARGET="aarch64-apple-darwin" ;; + x86_64) RUST_TARGET="x86_64-apple-darwin" ;; + *) print -u2 -- "Unsupported host architecture: $(uname -m)"; exit 1 ;; +esac +RUST_LIBRARY="$(scripts/rust-core/build-rust-core.sh --release --target "$RUST_TARGET")" +SWIFT_BUILD_ARGS+=(-Xlinker -force_load -Xlinker "$RUST_LIBRARY") + # Build only the verifier product so Release mode does not compile unrelated # app test targets whose testing hooks intentionally exist only in Debug. The # Node runner supplies a local process-tree deadline before the CI timeout. diff --git a/shared/platform-feature-matrix/features/git-history.json b/shared/platform-feature-matrix/features/git-history.json index 134d8486d0..cb6ae1a82a 100644 --- a/shared/platform-feature-matrix/features/git-history.json +++ b/shared/platform-feature-matrix/features/git-history.json @@ -7,7 +7,6 @@ "evidence": [ "macos/Sources/Lithe/Views/Git", "macos/Sources/LitheGitModule/Services/GitGraphLayoutService.swift", - "macos/Sources/LitheGitModule/Services/GitGraphHeadOrdering.swift", "macos/Sources/Lithe/Views/Git/GitGraphColor.swift", "macos/Tests/LitheTests/GitReferenceRowsBuilderTests.swift", "macos/Tests/LitheTests/LitheSearchFieldStyleTests.swift", @@ -44,6 +43,10 @@ "macos/Tests/LitheTests/GitCoreContractBridgeTests.swift", "shared/fixtures/git/history-window-v1.json", "rust/lithe-core/src/git/history_window.rs", + "shared/fixtures/git/graph-projection-v1.json", + "rust/lithe-core/src/git/graph.rs", + "macos/Sources/LitheGitModule/Models/GitGraphProjectionModels.swift", + "macos/Tests/LitheGitTestSupport/GitGraphCoreTestSupport.swift", "macos/Sources/LitheGitModule/Models/GitCorePlans.swift" ], "implementationStatus": "implemented", @@ -56,9 +59,7 @@ "windows/tauri/src/ui/scroll-container-wheel.integration.test.ts", ".agents/notes/implemented/bug-fix/2026-10-08-windows-git-log-wheel-animation.md", "windows/tauri/src/features/git", - "windows/tauri/src/features/git/utils/git-graph-layout.ts", "windows/tauri/src/features/git/utils/git-graph-colors.ts", - "windows/tauri/src/features/git/utils/git-graph-layout.test.ts", "windows/tauri/src/features/git/components/log/git-commit-details.tsx", "windows/tauri/src/features/git/components/log/git-commit-details.test.tsx", "windows/tauri/src/features/git/hooks/use-git-diff-actions.test.tsx", @@ -100,7 +101,6 @@ "windows/tauri/src/features/git/components/log/git-commit-table-keyboard-menu.test.tsx", "windows/tauri/src/features/git/api/git-tags-api.test.ts", "windows/tauri/src-tauri/src/platform.rs", - "windows/tauri/src/features/git/utils/git-graph-filter-projection.ts", "windows/tauri/src/features/git/components/log/git-graph-row.test.ts", "windows/tauri/src/features/git/components/log/git-commit-table.filter.test.tsx", "windows/tauri/src/features/git/components/log/git-commit-table.toolbar.test.tsx", @@ -139,6 +139,10 @@ "shared/fixtures/git/history-window-v1.json", "rust/lithe-core/src/git/history_window.rs", "windows/tauri/src/features/git/api/git-history-window-api.ts", + "shared/fixtures/git/graph-projection-v1.json", + "rust/lithe-core/src/git/graph.rs", + "windows/tauri/src/features/git/api/git-graph-projection-api.ts", + "windows/tauri/src/test-utils/git-graph-projection-stub.ts", "windows/tauri/src/features/git/hooks/use-git-log-controller.ts" ], "implementationStatus": "implemented", From a19dc46a3360b60b9322c405e1c752416ba791b6 Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Thu, 5 Nov 2026 07:17:44 -0800 Subject: [PATCH 4/6] =?UTF-8?q?feat(core):=20#1662=20=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E8=BD=AE=20=E6=B5=8B=E8=AF=95=E5=8E=86=E5=8F=B2=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E5=90=88=E5=B9=B6=EF=BC=88RUN-10=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 build.mergeTestOutcomes:宿主给出历史/本次结果 ID 与覆盖范围(精确 ID + ID 前缀),Core 只比较字符串,输出稳定顺序的合并条目;空范围不覆盖任何结果,空前缀拒绝。 - 新增共享 fixture test-outcome-merge-v1.json。 - macOS LanguageTestService 删除自有合并算法,coverage 转长度前缀 ID 前缀后调用 Core。 - Windows maven.store 删除自有合并算法,Java 嵌套类(Outer$Inner)在 Maven 适配层转成前缀后调用 Core;测试替身补齐新命令。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- .../Execution/TestRunOutcomeContracts.swift | 51 ++++ .../Services/LanguageTestService.swift | 32 ++- rust/lithe-core/src/build/mod.rs | 2 + .../src/build/test_outcome_merge.rs | 145 ++++++++++ rust/lithe-core/src/protocol/command.rs | 3 + rust/lithe-core/src/runtime/dispatcher.rs | 6 + shared/contracts/rust-core-api.md | 16 ++ .../fixtures/build/test-outcome-merge-v1.json | 264 ++++++++++++++++++ .../features/run-java-test.json | 11 +- .../features/maven/stores/maven.store.test.ts | 32 ++- .../src/features/maven/stores/maven.store.ts | 56 ++-- .../run/api/test-outcome-merge-api.ts | 26 ++ 12 files changed, 601 insertions(+), 43 deletions(-) create mode 100644 rust/lithe-core/src/build/test_outcome_merge.rs create mode 100644 shared/fixtures/build/test-outcome-merge-v1.json create mode 100644 windows/tauri/src/features/run/api/test-outcome-merge-api.ts diff --git a/macos/Sources/LitheCoreContracts/Execution/TestRunOutcomeContracts.swift b/macos/Sources/LitheCoreContracts/Execution/TestRunOutcomeContracts.swift index e710167159..8a9a61a042 100644 --- a/macos/Sources/LitheCoreContracts/Execution/TestRunOutcomeContracts.swift +++ b/macos/Sources/LitheCoreContracts/Execution/TestRunOutcomeContracts.swift @@ -46,8 +46,35 @@ public struct TestRunVerdict: Codable, Equatable, Sendable { public let exitCode: Int32? } +/// What a run replaces in the stored test history: exact result ids and id +/// prefixes. The provider adapter builds it; Core only compares strings. +public struct TestOutcomeMergeScope: Codable, Equatable, Sendable { + public var ids: [String] + public var prefixes: [String] + + public init(ids: [String] = [], prefixes: [String] = []) { + self.ids = ids + self.prefixes = prefixes + } +} + +/// One merged result: its position in the `previous` or `incoming` input. +public struct TestOutcomeMergeEntry: Codable, Equatable, Sendable { + public enum Source: String, Codable, Sendable { case previous, incoming } + public let source: Source + public let index: Int +} + /// Reduces a finished test run to the verdict both platforms show. public protocol TestRunOutcomeResolving: Sendable { + /// `build.mergeTestOutcomes`: which stored and which reported results + /// make up the new history, in display order. + func mergeTestOutcomes( + previous: [String], + incoming: [String], + scope: TestOutcomeMergeScope + ) throws -> [TestOutcomeMergeEntry] + func resolveTestRunOutcome( termination: TestRunTermination, scope: TestRunScopeKind, @@ -83,6 +110,30 @@ public extension TestRunOutcomeCoreCommandExecuting { } } +public extension TestRunOutcomeCoreCommandExecuting { + func mergeTestOutcomes( + previous: [String], + incoming: [String], + scope: TestOutcomeMergeScope + ) throws -> [TestOutcomeMergeEntry] { + let response: MergeTestOutcomesResponse = try executeTestRunOutcomeCommand( + "build.mergeTestOutcomes", + payload: MergeTestOutcomesPayload(previous: previous, incoming: incoming, scope: scope) + ) + return response.entries + } +} + +private struct MergeTestOutcomesPayload: Encodable { + let previous: [String] + let incoming: [String] + let scope: TestOutcomeMergeScope +} + +private struct MergeTestOutcomesResponse: Decodable { + let entries: [TestOutcomeMergeEntry] +} + private struct ResolveTestRunOutcomeTermination: Encodable { let kind: String let exitCode: Int32? diff --git a/macos/Sources/LitheExecutionModule/Services/LanguageTestService.swift b/macos/Sources/LitheExecutionModule/Services/LanguageTestService.swift index 129de0ec48..f04ea8e66c 100644 --- a/macos/Sources/LitheExecutionModule/Services/LanguageTestService.swift +++ b/macos/Sources/LitheExecutionModule/Services/LanguageTestService.swift @@ -302,18 +302,20 @@ package final class LanguageTestService: ObservableObject { resultsWorkspaceURL = workspaceURL.standardizedFileURL // Only the backend can say that a whole suite/project completed. // Legacy reports without coverage replace their exact returned cases. - let keys = Set(result.reports.flatMap(\.tests).map(BuildTestCaseKey.init)) + // Core merges by id; this adapter only names the ids and prefixes. + let previous = testOutcomesByProviderID[providerID] ?? [] let coverage = result.reports.flatMap { $0.coverage ?? [] } - var outcomes = testOutcomesByProviderID[providerID] ?? [] - outcomes.removeAll { outcome in - keys.contains(BuildTestCaseKey(outcome)) - || coverage.contains { scope in - scope.project == outcome.project - && (scope.suite == nil || scope.suite == outcome.suite) - && (scope.testCase == nil || scope.testCase == outcome.name) - } + let merged = try outcomeResolver.mergeTestOutcomes( + previous: previous.map(\.id), + incoming: report.tests.map(\.id), + scope: TestOutcomeMergeScope( + ids: report.tests.map(\.id), + prefixes: coverage.map(Self.coveragePrefix) + ) + ) + testOutcomesByProviderID[providerID] = merged.map { + $0.source == .previous ? previous[$0.index] : report.tests[$0.index] } - testOutcomesByProviderID[providerID] = outcomes + report.tests applyVerdict( termination: .exited(result.exitCode), scope: scope, @@ -330,6 +332,16 @@ package final class LanguageTestService: ObservableObject { } } + /// A coverage scope is a prefix of the ids it completed: a project, one of + /// its suites, or (with a case name) exactly one test. `TestCase.id` is + /// length-prefixed per part, so a shorter scope never matches another name. + private static func coveragePrefix(_ scope: BuildTestResults.Coverage) -> String { + // A case name is only meaningful inside a suite. + [scope.project, scope.suite, scope.suite == nil ? nil : scope.testCase] + .compactMap { $0.map { "\($0.utf8.count):" + $0 } } + .joined() + } + package func sourceURL(for test: BuildTestResults.TestCase) -> URL? { guard let root = resultsWorkspaceURL, let path = test.path, !path.hasPrefix("/"), !path.contains("\\"), diff --git a/rust/lithe-core/src/build/mod.rs b/rust/lithe-core/src/build/mod.rs index 1aafd0ac12..91c0524ddd 100644 --- a/rust/lithe-core/src/build/mod.rs +++ b/rust/lithe-core/src/build/mod.rs @@ -37,6 +37,7 @@ mod stored_options; mod template; mod test_discovery; mod test_outcome; +mod test_outcome_merge; pub(crate) use commands::*; pub(crate) use invocation::host_runtime_version_arguments; @@ -48,3 +49,4 @@ pub(crate) use project_options::project_options_command; pub(crate) use run_start::run_decode_start_command; pub(crate) use stored_options::resolve_stored_options_command; pub(crate) use test_outcome::resolve_test_run_outcome; +pub(crate) use test_outcome_merge::merge_test_outcomes; diff --git a/rust/lithe-core/src/build/test_outcome_merge.rs b/rust/lithe-core/src/build/test_outcome_merge.rs new file mode 100644 index 0000000000..62d600da60 --- /dev/null +++ b/rust/lithe-core/src/build/test_outcome_merge.rs @@ -0,0 +1,145 @@ +//! Merging a run's test results into the stored history +//! (`build.mergeTestOutcomes`). +//! +//! Hosts keep the last known result of every test. A run only speaks for the +//! tests it covered, so the history keeps every other result. The covered set +//! is stated by the host: exact identifiers and identifier prefixes. Core +//! compares strings only; how a tool names nested suites or how a host builds +//! identifiers is decided by the provider adapter that builds the scope. + +use crate::protocol::{CoreError, ErrorCode}; +use serde::{Deserialize, Serialize}; +use std::collections::HashSet; + +/// What the run replaces. A result is covered when its identifier equals one +/// of `ids` or starts with one of `prefixes`. An empty scope covers nothing. +#[derive(Debug, Default, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub(crate) struct TestOutcomeScope { + #[serde(default)] + pub(crate) ids: Vec<String>, + #[serde(default)] + pub(crate) prefixes: Vec<String>, +} + +/// Input of `build.mergeTestOutcomes`. Results are passed as identifiers; the +/// host keeps the payloads and maps the answer back by position. +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub(crate) struct MergeTestOutcomesRequest { + /// Identifiers of the stored history, in display order. + #[serde(default)] + pub(crate) previous: Vec<String>, + /// Identifiers the run reported, in report order. + #[serde(default)] + pub(crate) incoming: Vec<String>, + #[serde(default)] + pub(crate) scope: TestOutcomeScope, +} + +/// Which input list a merged entry comes from. +#[derive(Debug, Clone, Copy, Serialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub(crate) enum TestOutcomeSource { + Previous, + Incoming, +} + +/// One merged entry: the position in the `previous` or `incoming` input. +#[derive(Debug, Clone, Copy, Serialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub(crate) struct MergedTestOutcome { + pub(crate) source: TestOutcomeSource, + pub(crate) index: usize, +} + +/// Output of `build.mergeTestOutcomes`. +#[derive(Debug, Serialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub(crate) struct MergedTestOutcomes { + pub(crate) entries: Vec<MergedTestOutcome>, +} + +/// Merges one run into the history. +/// +/// Stored results the scope covers are dropped, the others stay in place. The +/// run's results follow, but only those inside the scope: a run cannot +/// overwrite what it did not claim. When an identifier repeats, the later +/// entry wins and takes the later position. +pub(crate) fn merge_test_outcomes( + request: MergeTestOutcomesRequest, +) -> Result<MergedTestOutcomes, CoreError> { + if request.scope.prefixes.iter().any(String::is_empty) { + return Err(CoreError::new( + ErrorCode::InvalidRequest, + "A test outcome scope prefix must not be empty.", + )); + } + let ids: HashSet<&str> = request.scope.ids.iter().map(String::as_str).collect(); + let covered = |id: &str| { + ids.contains(id) + || request + .scope + .prefixes + .iter() + .any(|prefix| id.starts_with(prefix.as_str())) + }; + let candidates = request + .previous + .iter() + .enumerate() + .filter(|(_, id)| !covered(id)) + .map(|(index, id)| (TestOutcomeSource::Previous, index, id)) + .chain( + request + .incoming + .iter() + .enumerate() + .filter(|(_, id)| covered(id)) + .map(|(index, id)| (TestOutcomeSource::Incoming, index, id)), + ) + .collect::<Vec<_>>(); + // Walk backwards so the last occurrence of an identifier is the one kept. + let mut seen = HashSet::new(); + let mut entries = candidates + .iter() + .rev() + .filter(|(_, _, id)| seen.insert(id.as_str())) + .map(|&(source, index, _)| MergedTestOutcome { source, index }) + .collect::<Vec<_>>(); + entries.reverse(); + Ok(MergedTestOutcomes { entries }) +} + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::Value; + + // The shared fixture is the cross-platform contract: both hosts build the + // same scope and must keep the same history. + #[test] + fn shared_fixture_cases_merge_to_their_expected_history() { + let fixture: Value = serde_json::from_str(include_str!( + "../../../../shared/fixtures/build/test-outcome-merge-v1.json" + )) + .unwrap(); + let cases = fixture["cases"].as_array().unwrap(); + assert!(!cases.is_empty()); + for case in cases { + let name = case["name"].as_str().unwrap(); + let request: MergeTestOutcomesRequest = + serde_json::from_value(case["request"].clone()).unwrap(); + let actual = serde_json::to_value(merge_test_outcomes(request).unwrap()).unwrap(); + assert_eq!(actual, case["expected"], "{name}"); + } + for case in fixture["rejected"].as_array().unwrap() { + let name = case["name"].as_str().unwrap(); + let rejected = + serde_json::from_value::<MergeTestOutcomesRequest>(case["request"].clone()) + .map_err(|_| ()) + .and_then(|request| merge_test_outcomes(request).map_err(|_| ())); + assert!(rejected.is_err(), "{name}"); + } + } +} diff --git a/rust/lithe-core/src/protocol/command.rs b/rust/lithe-core/src/protocol/command.rs index d53fa0a943..c1e8b0d2b3 100644 --- a/rust/lithe-core/src/protocol/command.rs +++ b/rust/lithe-core/src/protocol/command.rs @@ -258,6 +258,8 @@ pub enum CoreCommand { BuildLanguageImport, /// Reduces a test run's termination and decoded summary to one verdict (`build.resolveTestRunOutcome`). BuildResolveTestRunOutcome, + /// Merges a run's test results into the stored history inside the host-stated scope (`build.mergeTestOutcomes`). + BuildMergeTestOutcomes, /// Detects VCS roots and registered providers of a workspace (`vcs.detectRoots`). VcsDetectRoots, /// Assigns workspace paths to detected VCS roots (`vcs.ownerOf`). @@ -953,6 +955,7 @@ impl CoreCommand { "build.syncFingerprint" => Some(Self::BuildSyncFingerprint), "build.languageImport" => Some(Self::BuildLanguageImport), "build.resolveTestRunOutcome" => Some(Self::BuildResolveTestRunOutcome), + "build.mergeTestOutcomes" => Some(Self::BuildMergeTestOutcomes), "vcs.detectRoots" => Some(Self::VcsDetectRoots), "vcs.ownerOf" => Some(Self::VcsOwnerOf), "vcs.decodeReply" => Some(Self::VcsDecodeReply), diff --git a/rust/lithe-core/src/runtime/dispatcher.rs b/rust/lithe-core/src/runtime/dispatcher.rs index e7f1ece858..9f7deeca48 100644 --- a/rust/lithe-core/src/runtime/dispatcher.rs +++ b/rust/lithe-core/src/runtime/dispatcher.rs @@ -607,6 +607,12 @@ fn execute_parsed(mut parsed: CoreRequest) -> CoreResponse { "Invalid test run outcome request", crate::build::resolve_test_run_outcome, ), + CoreCommand::BuildMergeTestOutcomes => reducer_response( + id, + parsed.payload, + "Invalid test outcome merge request", + crate::build::merge_test_outcomes, + ), CoreCommand::VcsDetectRoots => { plugin_response(id, parsed.payload, crate::vcs::vcs_detect_roots_command) } diff --git a/shared/contracts/rust-core-api.md b/shared/contracts/rust-core-api.md index bfbfa3ec41..b9c4e7b363 100644 --- a/shared/contracts/rust-core-api.md +++ b/shared/contracts/rust-core-api.md @@ -1585,6 +1585,7 @@ package manager owns the download and Lithe does not infer bytes from logs. | `build.syncFingerprint` | Digest the files a build model depends on, to tell whether it is stale | | `build.languageImport` | Map a build system's options to the Java language server's Maven or Gradle project import | | `build.resolveTestRunOutcome` | Reduce a test run's termination, selected scope and decoded summary to one tool-neutral verdict | +| `build.mergeTestOutcomes` | Merge a run's test result ids into the stored history inside the host-stated id/prefix scope | | `vcs.detectRoots` | Find the VCS roots of a workspace from static markers, with registered providers, ambiguous directories, and applied mappings | | `vcs.ownerOf` | Assign workspace paths to the detected root that owns each | | `vcs.decodeReply` | Validate a VCS provider's reply and return the normalized result | @@ -6478,6 +6479,21 @@ zero exit with decoded results but no executed test is not a pass. Counts that exceed `total` are `InvalidRequest`. No tool or selector syntax is interpreted. Hosts localize the outcome. Cases: `shared/fixtures/build/test-run-outcome-v1.json`. +### Test history merge + +`build.mergeTestOutcomes` takes `{ previous, incoming, scope }`: `previous` and +`incoming` are lists of result identifiers (strings) in display and report order, +and `scope` is `{ ids?, prefixes? }`, the identifiers the run replaces. A result is +covered when its id equals one of `ids` or starts with one of `prefixes`; an empty +scope covers nothing and an empty prefix is `InvalidRequest`. It returns +`{ entries: [{ source, index }] }` with `source` `previous` or `incoming` and +`index` the position in that input: covered history entries are dropped, the +others stay in place, then the run's covered results follow. Incoming results +outside the scope are discarded, and for a repeated id the later entry wins. +Core compares strings only: hosts keep the result payloads, and the provider +adapter builds the scope (for example turning Java nested classes `Outer$Inner` +into the prefix `Outer$`). Cases: `shared/fixtures/build/test-outcome-merge-v1.json`. + ### Variable and disassembly paging `debug.planVariablePage { variablesReference, namedVariables?, indexedVariables?, pageSize }` diff --git a/shared/fixtures/build/test-outcome-merge-v1.json b/shared/fixtures/build/test-outcome-merge-v1.json new file mode 100644 index 0000000000..8fdcbd31dd --- /dev/null +++ b/shared/fixtures/build/test-outcome-merge-v1.json @@ -0,0 +1,264 @@ +{ + "version": 1, + "description": "build.mergeTestOutcomes: the run's results replace the history only inside the scope the host states (exact ids and id prefixes). Hosts turn their own naming rules, such as Java nested classes, into prefixes before calling Core. Entries point at positions in `previous` or `incoming`.", + "cases": [ + { + "name": "method run replaces only that method's result", + "request": { + "previous": [ + "A#x", + "A#y", + "A$N#x", + "B#z" + ], + "incoming": [ + "A#x" + ], + "scope": { + "ids": [ + "A#x" + ] + } + }, + "expected": { + "entries": [ + { + "source": "previous", + "index": 1 + }, + { + "source": "previous", + "index": 2 + }, + { + "source": "previous", + "index": 3 + }, + { + "source": "incoming", + "index": 0 + } + ] + } + }, + { + "name": "class run replaces the class and its nested classes", + "request": { + "previous": [ + "A#x", + "A#y", + "A$N#x", + "B#z" + ], + "incoming": [ + "A#x", + "A$N#w" + ], + "scope": { + "prefixes": [ + "A#", + "A$" + ] + } + }, + "expected": { + "entries": [ + { + "source": "previous", + "index": 3 + }, + { + "source": "incoming", + "index": 0 + }, + { + "source": "incoming", + "index": 1 + } + ] + } + }, + { + "name": "a test seen for the first time is appended", + "request": { + "previous": [ + "A#x" + ], + "incoming": [ + "A#x", + "A#new" + ], + "scope": { + "prefixes": [ + "A#" + ] + } + }, + "expected": { + "entries": [ + { + "source": "incoming", + "index": 0 + }, + { + "source": "incoming", + "index": 1 + } + ] + } + }, + { + "name": "results outside the scope are kept and the run's out-of-scope results are dropped", + "request": { + "previous": [ + "A#x", + "B#z" + ], + "incoming": [ + "A#x", + "B#z" + ], + "scope": { + "ids": [ + "A#x" + ] + } + }, + "expected": { + "entries": [ + { + "source": "previous", + "index": 1 + }, + { + "source": "incoming", + "index": 0 + } + ] + } + }, + { + "name": "a repeated identifier keeps the later entry", + "request": { + "previous": [ + "A#x", + "A#x", + "B#z" + ], + "incoming": [ + "A#y", + "A#y" + ], + "scope": { + "ids": [ + "A#y" + ] + } + }, + "expected": { + "entries": [ + { + "source": "previous", + "index": 1 + }, + { + "source": "previous", + "index": 2 + }, + { + "source": "incoming", + "index": 1 + } + ] + } + }, + { + "name": "a covered stored result is replaced by the run's result", + "request": { + "previous": [ + "A#x" + ], + "incoming": [ + "A#x" + ], + "scope": { + "ids": [ + "A#x" + ] + } + }, + "expected": { + "entries": [ + { + "source": "incoming", + "index": 0 + } + ] + } + }, + { + "name": "an empty scope keeps the history and discards the run", + "request": { + "previous": [ + "A#x", + "B#z" + ], + "incoming": [ + "A#x", + "C#q" + ], + "scope": {} + }, + "expected": { + "entries": [ + { + "source": "previous", + "index": 0 + }, + { + "source": "previous", + "index": 1 + } + ] + } + }, + { + "name": "empty history takes the covered results", + "request": { + "previous": [], + "incoming": [ + "A#x" + ], + "scope": { + "ids": [ + "A#x" + ] + } + }, + "expected": { + "entries": [ + { + "source": "incoming", + "index": 0 + } + ] + } + } + ], + "rejected": [ + { + "name": "an empty prefix would cover everything", + "request": { + "previous": [ + "A#x" + ], + "incoming": [], + "scope": { + "prefixes": [ + "" + ] + } + } + } + ] +} diff --git a/shared/platform-feature-matrix/features/run-java-test.json b/shared/platform-feature-matrix/features/run-java-test.json index d7c6fbd2ac..9d556da079 100644 --- a/shared/platform-feature-matrix/features/run-java-test.json +++ b/shared/platform-feature-matrix/features/run-java-test.json @@ -35,7 +35,9 @@ "rust/lithe-core/src/build/test_outcome.rs", "macos/Sources/LitheCoreContracts/Execution/TestRunOutcomeContracts.swift", "macos/Tests/LitheExecutionModuleTests/LinkedCoreTestRunOutcome.swift", - "shared/fixtures/build/test-run-outcome-v1.json" + "shared/fixtures/build/test-run-outcome-v1.json", + "rust/lithe-core/src/build/test_outcome_merge.rs", + "shared/fixtures/build/test-outcome-merge-v1.json" ], "implementationStatus": "implemented", "verificationStatus": "pending" @@ -48,12 +50,15 @@ "windows/tauri/src/features/run/components/run-output-text.tsx", "rust/lithe-core/src/build/test_outcome.rs", "windows/tauri/src/features/run/api/test-run-outcome-api.ts", - "shared/fixtures/build/test-run-outcome-v1.json" + "windows/tauri/src/features/run/api/test-outcome-merge-api.ts", + "shared/fixtures/build/test-run-outcome-v1.json", + "rust/lithe-core/src/build/test_outcome_merge.rs", + "shared/fixtures/build/test-outcome-merge-v1.json" ], "implementationStatus": "implemented", "verificationStatus": "pending" }, "owner": "Run", - "verification": "阶段 D 协议 9 增量通过 350 项 macOS、1368 项 Core/集成计时、当前 SDK E2E 及 Maven 3.9.16/JDK 26 组合;完整发行 UI/JDT、正式 SDK/插件锁定和 Windows 实机仍 pending。运行 main、单测试和测试类,验证参数、输出、失败状态和终端策略。 Windows Run 运行输出使用 Geist Mono 显示 ====、==>、=>、!=、>=,确认禁用连字后逐字符显示且复制文本与原始输出一致;检查有输出与空态、ANSI 颜色、自动换行切换及横向滚动。 macOS Tests 顶部核对 41pt 无图标/计数标题、统一底线、运行名称标签的活动/非活动状态;运行中和完成后关闭标签均清理本次运行,保留发现列表并可重新运行。 核对第二行刷新、重跑、停止、清空的 IDEA 原始 16pt 明暗 SVG 与 22pt 按钮悬停范围。 Tests 详情无重复标题/文字 Run 按钮、工具栏右侧无运行状态;第二行首个 Run/Rerun 图标按选中提供方与精确作用域切换,运行中禁用,Stop 常驻;切换测试后运行当前选择,Java 单项 Debug 入口保留。 Tests 布局核对左侧报告状态树(通过/失败/跳过和组折叠)、顶部单行结果摘要、IDEA 控制台及右侧导航/换行/滚动/打印/清空动作;右侧 Details 复用共享收缩条与分隔容器,展开保留作用域、命令和失败定位。控制台左右工具栏均验证明暗主题、背景与原生文本身份。 第二行核对刷新紧挨垃圾桶左侧,两者继续执行发现刷新和输出清空。 Test 的 Performance 展开采集本次进程树 CPU 与 Resident Memory(含构建启动器和测试子进程),复用 Debug 图表及共享折叠条;收起/隐藏停止采集,重跑不混旧数据,结束保留历史,Details 继续显示原有作用域、命令与失败定位。 Stop 等图标禁用时使用 IDEA 灰度,只有可用停止动作保留红色;Performance 收起再展开后时间轴继续保持进程年龄。 Test 右侧 Performance/Details 共用一个可收缩区域,顶部两个标签切换;核对11pt常规标题和Islands文字色。Java选择本次启动器后代中的JUnit/Surefire/Gradle测试JVM,实时CPU/堆曲线,多个worker切换。开始/停止JFR录制、Show Results查看JDK热点方法和分配报告,结束/重跑/关闭正确取消及清理。非Java测试继续用明确标注的CPU/RSS;缺失worker或工具明确提示,不采样Maven/Gradle启动器。 macOS:Run、Debug、Test 共用 OutputTextView/LitheConsoleStyle 默认字体、行高和日志等级色;纯文本及 Maven/Spring ANSI 日志的 INFO 标签均为绿色、WARN 黄色、ERROR 红色,正文及其他 ANSI 片段保留;检查明暗主题、复制、折叠与源码链接。 Test Performance 录制和 Show Results 核对明暗主题、原始录制 SVG、禁用灰度不叠加透明度;Show Results 复用 Commit 的共享 LitheActionButtonStyle,核对28pt可见高度、3pt外留白、13pt常规字、透明/白色背景和独立禁用文字/边框,录制结束后可打开结果。 Show Results 结果窗口使用共享 LitheCenteredPopup 原生标题栏与对话框背景/底部关闭动作,验证 Esc、关闭按钮、系统关闭、重复打开、父窗口关闭及明暗主题,内容保持共享 OutputTextView 的复制和横纵滚动。 Test 结果摘要下方移除普通横线,核对3pt半圆端状态条:失败/错误红色优先于通过绿色;无结果、运行准备和全部跳过不画,重跑清空旧状态。深浅主题使用 ProgressBar 专用色,保持摘要文字和控制台工具栏不变。 调整面板宽度时状态条右端始终停在控制台右侧工具栏左边,不覆盖工具栏及其分隔线。 非Maven无结构化报告时核对成功、失败、取消和超时摘要与状态条;Gradle内置测试通过--no-daemon保持worker属于本次进程树,真实集成先启动兼容常驻daemon,再确认发现与采样的worker身份及独立清理。 Test左侧结果树:根/方法名13pt常规文字、共享Tree文字色;原始16pt明暗SVG覆盖未运行/通过/断言失败/执行错误/跳过和展开箭头,errors保留Error图标而非Failed;核对24pt行高、19pt缩进、12pt两侧留白、折叠、选中/失焦/hover及长名称省略,明暗主题不重染SVG。 结果摘要核对IDEA连续文案(失败、通过、忽略)、中英文单复数、13ptRegular、Label专用失败/警告色、灰色总数和16pt状态图标,覆盖通过但含忽略和全部忽略,不造耗时。结果树类/目录行双击名称展开或折叠,单击选择、箭头点击不变,叶子双击不折叠、不运行。 Test发现列表在首次运行、刷新和重跑等待结果时按工作区/文件/类/方法区分16pt图标,文件复用共享分类;明暗SVG不缺失,结果生成后状态图标优先,保留共享字体、行高、选中与双击展开。 Test未运行且无结构化结果时不显示摘要空态行,仅保留共享控制台的Run a test to see its output提示;运行中及无报告的成功、失败、取消、超时仍显示摘要。 Maven编译失败产生零计数报告、部分测试通过但整体非零退出时,保留Failed/Timed Out文字、错误图标和红色状态条;Gradle同时启用fork编译和测试时,Performance仅发现带Gradle Test Executor身份的worker,不采样通用Gradle Worker Daemon。 回归验证单测→workspace/file→顶栏Run/Debug仍保留新scope;共享testcase-durations-v1.json贯穿Rust报告解析、聚合、通用build.decodeTestResults与Swift呈现,覆盖不同方法耗时、重复调用、部分缺失、非法/负值/超大值及零值;实际Windows UI尚未验收。 回归普通配置仍运行时选择测试,顶栏Run只运行当前测试;单方法JDT启动标签为logsIn()时暂停/继续仍关联所选scope。合成结果树的渲染、选择与默认选中共用节点,报告类/方法可重跑;无语义源码关联的报告节点明确禁用Debug,不猜测源码路径。 macOS边界回归:A处于running/paused时切换测试B,实际注册Debug动作必须准备B;保持同一目标时才重启。混合Java/Node/Python项目只在当前运行的provider组展示报告结果、状态和耗时;关闭或清空带真实方法结果的运行后恢复工作区、文件和未执行测试入口,同时保留编辑器标记历史,并可重新选择文件/工作区运行。 Review 修正:macOS 结果服务、Tests 呈现及 Java 行标记直接消费 BuildTestResults;保留上游摘要与调用次数,耗时只读规范报告,名称不解析括号或参数后缀。非 Maven fixture 覆盖来源定位、独立重跑引用、清空引用及多报告汇总;旧 Windows className/method 字段与通用 suite/case 的行标记 fixture 必须一致。 准备任务使用 buildSystems 4 的 preparation.purpose/sourceRoles,由插件声明内部任务 ID,宿主按当前模型匹配唯一任务;覆盖缺失用途、缺失角色、角色冲突、未知源码根、临时 Profile、取消及工作区变化。真实 Maven 自定义过滤资源经生产 macOS 会话与 Core 执行,插件包清单不变;Windows 产品准入仍关闭。 通用报告按语言提供者隔离编辑器历史,混合结果保留精确源码节点与全部无源码报告项,不因部分 JDT 匹配而丢弃其余用例;源码执行标识原样保留。 RUN-03:测试结束的最终判定由 Core build.resolveTestRunOutcome 归约(超时/取消不声明测试结果,已报告的失败优先于退出码,非零退出优先于空结果,退出码 0 但没有执行任何选中测试判为失败:显式套件/用例为“没有测试匹配所选范围”,项目/工作区为“没有找到任何测试”)。macOS LanguageTestService 与 Windows maven.store 均改为调用该命令,不再各自按退出码判定,两端共用 shared/fixtures/build/test-run-outcome-v1.json;Core 不含 Maven/JUnit 语义。", + "verification": "阶段 D 协议 9 增量通过 350 项 macOS、1368 项 Core/集成计时、当前 SDK E2E 及 Maven 3.9.16/JDK 26 组合;完整发行 UI/JDT、正式 SDK/插件锁定和 Windows 实机仍 pending。运行 main、单测试和测试类,验证参数、输出、失败状态和终端策略。 Windows Run 运行输出使用 Geist Mono 显示 ====、==>、=>、!=、>=,确认禁用连字后逐字符显示且复制文本与原始输出一致;检查有输出与空态、ANSI 颜色、自动换行切换及横向滚动。 macOS Tests 顶部核对 41pt 无图标/计数标题、统一底线、运行名称标签的活动/非活动状态;运行中和完成后关闭标签均清理本次运行,保留发现列表并可重新运行。 核对第二行刷新、重跑、停止、清空的 IDEA 原始 16pt 明暗 SVG 与 22pt 按钮悬停范围。 Tests 详情无重复标题/文字 Run 按钮、工具栏右侧无运行状态;第二行首个 Run/Rerun 图标按选中提供方与精确作用域切换,运行中禁用,Stop 常驻;切换测试后运行当前选择,Java 单项 Debug 入口保留。 Tests 布局核对左侧报告状态树(通过/失败/跳过和组折叠)、顶部单行结果摘要、IDEA 控制台及右侧导航/换行/滚动/打印/清空动作;右侧 Details 复用共享收缩条与分隔容器,展开保留作用域、命令和失败定位。控制台左右工具栏均验证明暗主题、背景与原生文本身份。 第二行核对刷新紧挨垃圾桶左侧,两者继续执行发现刷新和输出清空。 Test 的 Performance 展开采集本次进程树 CPU 与 Resident Memory(含构建启动器和测试子进程),复用 Debug 图表及共享折叠条;收起/隐藏停止采集,重跑不混旧数据,结束保留历史,Details 继续显示原有作用域、命令与失败定位。 Stop 等图标禁用时使用 IDEA 灰度,只有可用停止动作保留红色;Performance 收起再展开后时间轴继续保持进程年龄。 Test 右侧 Performance/Details 共用一个可收缩区域,顶部两个标签切换;核对11pt常规标题和Islands文字色。Java选择本次启动器后代中的JUnit/Surefire/Gradle测试JVM,实时CPU/堆曲线,多个worker切换。开始/停止JFR录制、Show Results查看JDK热点方法和分配报告,结束/重跑/关闭正确取消及清理。非Java测试继续用明确标注的CPU/RSS;缺失worker或工具明确提示,不采样Maven/Gradle启动器。 macOS:Run、Debug、Test 共用 OutputTextView/LitheConsoleStyle 默认字体、行高和日志等级色;纯文本及 Maven/Spring ANSI 日志的 INFO 标签均为绿色、WARN 黄色、ERROR 红色,正文及其他 ANSI 片段保留;检查明暗主题、复制、折叠与源码链接。 Test Performance 录制和 Show Results 核对明暗主题、原始录制 SVG、禁用灰度不叠加透明度;Show Results 复用 Commit 的共享 LitheActionButtonStyle,核对28pt可见高度、3pt外留白、13pt常规字、透明/白色背景和独立禁用文字/边框,录制结束后可打开结果。 Show Results 结果窗口使用共享 LitheCenteredPopup 原生标题栏与对话框背景/底部关闭动作,验证 Esc、关闭按钮、系统关闭、重复打开、父窗口关闭及明暗主题,内容保持共享 OutputTextView 的复制和横纵滚动。 Test 结果摘要下方移除普通横线,核对3pt半圆端状态条:失败/错误红色优先于通过绿色;无结果、运行准备和全部跳过不画,重跑清空旧状态。深浅主题使用 ProgressBar 专用色,保持摘要文字和控制台工具栏不变。 调整面板宽度时状态条右端始终停在控制台右侧工具栏左边,不覆盖工具栏及其分隔线。 非Maven无结构化报告时核对成功、失败、取消和超时摘要与状态条;Gradle内置测试通过--no-daemon保持worker属于本次进程树,真实集成先启动兼容常驻daemon,再确认发现与采样的worker身份及独立清理。 Test左侧结果树:根/方法名13pt常规文字、共享Tree文字色;原始16pt明暗SVG覆盖未运行/通过/断言失败/执行错误/跳过和展开箭头,errors保留Error图标而非Failed;核对24pt行高、19pt缩进、12pt两侧留白、折叠、选中/失焦/hover及长名称省略,明暗主题不重染SVG。 结果摘要核对IDEA连续文案(失败、通过、忽略)、中英文单复数、13ptRegular、Label专用失败/警告色、灰色总数和16pt状态图标,覆盖通过但含忽略和全部忽略,不造耗时。结果树类/目录行双击名称展开或折叠,单击选择、箭头点击不变,叶子双击不折叠、不运行。 Test发现列表在首次运行、刷新和重跑等待结果时按工作区/文件/类/方法区分16pt图标,文件复用共享分类;明暗SVG不缺失,结果生成后状态图标优先,保留共享字体、行高、选中与双击展开。 Test未运行且无结构化结果时不显示摘要空态行,仅保留共享控制台的Run a test to see its output提示;运行中及无报告的成功、失败、取消、超时仍显示摘要。 Maven编译失败产生零计数报告、部分测试通过但整体非零退出时,保留Failed/Timed Out文字、错误图标和红色状态条;Gradle同时启用fork编译和测试时,Performance仅发现带Gradle Test Executor身份的worker,不采样通用Gradle Worker Daemon。 回归验证单测→workspace/file→顶栏Run/Debug仍保留新scope;共享testcase-durations-v1.json贯穿Rust报告解析、聚合、通用build.decodeTestResults与Swift呈现,覆盖不同方法耗时、重复调用、部分缺失、非法/负值/超大值及零值;实际Windows UI尚未验收。 回归普通配置仍运行时选择测试,顶栏Run只运行当前测试;单方法JDT启动标签为logsIn()时暂停/继续仍关联所选scope。合成结果树的渲染、选择与默认选中共用节点,报告类/方法可重跑;无语义源码关联的报告节点明确禁用Debug,不猜测源码路径。 macOS边界回归:A处于running/paused时切换测试B,实际注册Debug动作必须准备B;保持同一目标时才重启。混合Java/Node/Python项目只在当前运行的provider组展示报告结果、状态和耗时;关闭或清空带真实方法结果的运行后恢复工作区、文件和未执行测试入口,同时保留编辑器标记历史,并可重新选择文件/工作区运行。 Review 修正:macOS 结果服务、Tests 呈现及 Java 行标记直接消费 BuildTestResults;保留上游摘要与调用次数,耗时只读规范报告,名称不解析括号或参数后缀。非 Maven fixture 覆盖来源定位、独立重跑引用、清空引用及多报告汇总;旧 Windows className/method 字段与通用 suite/case 的行标记 fixture 必须一致。 准备任务使用 buildSystems 4 的 preparation.purpose/sourceRoles,由插件声明内部任务 ID,宿主按当前模型匹配唯一任务;覆盖缺失用途、缺失角色、角色冲突、未知源码根、临时 Profile、取消及工作区变化。真实 Maven 自定义过滤资源经生产 macOS 会话与 Core 执行,插件包清单不变;Windows 产品准入仍关闭。 通用报告按语言提供者隔离编辑器历史,混合结果保留精确源码节点与全部无源码报告项,不因部分 JDT 匹配而丢弃其余用例;源码执行标识原样保留。 RUN-03:测试结束的最终判定由 Core build.resolveTestRunOutcome 归约(超时/取消不声明测试结果,已报告的失败优先于退出码,非零退出优先于空结果,退出码 0 但没有执行任何选中测试判为失败:显式套件/用例为“没有测试匹配所选范围”,项目/工作区为“没有找到任何测试”)。macOS LanguageTestService 与 Windows maven.store 均改为调用该命令,不再各自按退出码判定,两端共用 shared/fixtures/build/test-run-outcome-v1.json;Core 不含 Maven/JUnit 语义。RUN-10:测试历史的覆盖合并由 Core build.mergeTestOutcomes 完成(宿主给出被替换的结果 ID 和 ID 前缀,Core 只比较字符串;保留未覆盖的结果,覆盖范围外的新结果被丢弃,重复 ID 后者胜出)。macOS 把后端 coverage 转成长度前缀 ID 的前缀;Windows Maven 适配层把 Java 的 Outer$Inner 嵌套类转成 `Outer#` 与 `Outer$` 两个前缀,方法运行只给出精确 ID;两端共用 shared/fixtures/build/test-outcome-merge-v1.json。", "notes": "Java 启动资源准备新增公开 Provider 任务约定,等待保存、当前模型和成功状态后才交给 JDT;旧 Core 资源规划仅为未携带当前回执的 Windows 调用保留。单次覆盖不写 Build 默认值,失败/取消/ABA/工作区切换必须拒绝启动;本机实际资源过滤和原生取消回归通过;整合 preview 后 344 项计时通过,后续最低运行时新增 CI、完整 UI/JDT 和 Windows 实机仍待验证。 协议 9 测试链路已删除 macOS Maven CLI/报告 adapter,JDT 标识原样传给后端;规范报告按项目隔离并声明覆盖范围,整类重跑清除旧方法、单方法保留兄弟项,参数化调用的完整安全耗时相加。350 项原生回归和真实 Maven Provider 通过;最低运行时新增 CI、完整 UI/JDT、正式发行和 Windows 保持 pending。 阶段 D:macOS Maven 测试已走协议 9,JDT 原样给出语义标识,Build Provider 按当前工程/选项执行并返回规范报告。旧宿主 Maven 测试命令、报告扫描和 RustJavaMavenOperations 的 Maven 方法已删除。报告重跑保留后端和工程身份;同名模块结果/耗时隔离,PID 来自宿主受管 Provider 会话。保存、重跑、取消、过期输出、模型/配置 ABA 与测试 Debug 准备均保留身份。 顶栏保留并重跑完整测试scope,工作区/文件/类方法切换不会回退旧单测。方法耗时由Core读取Surefire XML的time并通过可选durationMillis传递,参数化调用累加,任一缺失/非法/溢出则隐藏;控制台整次摘要不作为方法耗时。通用Maven构建结果保留同一字段,Windows契约允许可选值。 顶栏测试动作优先于底层普通配置重启,普通配置运行样式不会串到测试目标。合成结果节点进入统一选择集合;保留JDT发现节点的源码关联,无源码报告节点禁用Debug。 当前报告与provider绑定,Tests列表不使用编辑器历史testOutcomes回填;顶栏Debug先校验当前测试目标再决定重启。" } diff --git a/windows/tauri/src/features/maven/stores/maven.store.test.ts b/windows/tauri/src/features/maven/stores/maven.store.test.ts index 3a86c5339c..6e0975f5fe 100644 --- a/windows/tauri/src/features/maven/stores/maven.store.test.ts +++ b/windows/tauri/src/features/maven/stores/maven.store.test.ts @@ -206,6 +206,25 @@ const resolveTestRunOutcome = mock( }, ); +// Stands in for Core's history merge; its own cases live in the shared fixture. +const mergeTestOutcomes = mock( + async (request: { + previous: readonly string[]; + incoming: readonly string[]; + scope: { ids?: readonly string[]; prefixes?: readonly string[] }; + }) => { + const covered = (id: string) => + (request.scope.ids ?? []).includes(id) || + (request.scope.prefixes ?? []).some((prefix) => id.startsWith(prefix)); + return { + entries: [ + ...request.previous.flatMap((id, index) => (covered(id) ? [] : [{ source: "previous" as const, index }])), + ...request.incoming.flatMap((id, index) => (covered(id) ? [{ source: "incoming" as const, index }] : [])), + ], + }; + }, +); + const dependencies = { createMavenPomWatchOperations, createMavenDependencyOutput, @@ -216,6 +235,7 @@ const dependencies = { parseMavenTestResults, readMavenDependencies, removeMavenDependencyOutput, + mergeTestOutcomes, resolveTestRunOutcome, resolveEffectiveMavenExecutable, resolveMavenLaunch, @@ -231,6 +251,7 @@ const dependencies = { } satisfies MavenStoreDependencies; beforeEach(() => { + mergeTestOutcomes.mockClear(); updateJavaMavenConfiguration.mockReset(); updateJavaMavenConfiguration.mockResolvedValue({ kind: "noSession" }); resolveJavaTestClass.mockReset(); @@ -1777,8 +1798,8 @@ describe("Maven test outcomes for editor Run markers", () => { expect(store.getState().activeTestRun?.selector).toBe("com.example.CalculatorTest$Nested#adds"); const sessionId = store.getState().activeSessionId; store.getState().actions.finishProcess(sessionId!, 1); - await Promise.resolve(); - await Promise.resolve(); + await waitFor(() => mergeTestOutcomes.mock.calls.length > 0); + await waitFor(() => store.getState().testResults !== null); expect(reportRequests).toEqual([ { @@ -1842,9 +1863,7 @@ describe("Maven test outcomes for editor Run markers", () => { try { await store.getState().actions.runTestMethod(testFile, "adds"); store.getState().actions.finishProcess(store.getState().activeSessionId!, 0); - // The parser mock resolves immediately; flush its registered completion. - await Promise.resolve(); - await Promise.resolve(); + await waitFor(() => store.getState().testResults !== null); expect(store.getState().testOutcomes).toEqual([otherFailure, nestedFailure, passed]); } finally { await store.getState().actions.stop(); @@ -1862,8 +1881,7 @@ describe("Maven test outcomes for editor Run markers", () => { await store.getState().actions.runTestClass(testFile); store.getState().actions.finishProcess(store.getState().activeSessionId!, 0); - await Promise.resolve(); - await Promise.resolve(); + await waitFor(() => store.getState().testResults !== null); expect(store.getState().testOutcomes).toEqual(previous); }); diff --git a/windows/tauri/src/features/maven/stores/maven.store.ts b/windows/tauri/src/features/maven/stores/maven.store.ts index 853d40dd0a..1c739cbac4 100644 --- a/windows/tauri/src/features/maven/stores/maven.store.ts +++ b/windows/tauri/src/features/maven/stores/maven.store.ts @@ -5,6 +5,7 @@ import { workspaceRuntimeRegistry } from "@/features/workspace/runtime/workspace import { frontendTrace } from "@/utils/frontend-trace"; import { createTranslator } from "@/i18n/locale"; import { useSettingsStore } from "@/features/settings/stores/settings.store"; +import { mergeTestOutcomes } from "@/features/run/api/test-outcome-merge-api"; import { resolveTestRunOutcome } from "@/features/run/api/test-run-outcome-api"; import { createMavenDependencyPlan, @@ -78,6 +79,7 @@ export interface MavenStoreDependencies { parseMavenDiagnostics: typeof parseMavenDiagnostics; readMavenDependencies: typeof readMavenDependencies; parseMavenTestResults: typeof parseMavenTestResults; + mergeTestOutcomes: typeof mergeTestOutcomes; resolveTestRunOutcome: typeof resolveTestRunOutcome; removeMavenDependencyOutput: typeof removeMavenDependencyOutput; resolveEffectiveMavenExecutable: typeof resolveEffectiveMavenExecutable; @@ -102,6 +104,7 @@ const defaultMavenStoreDependencies: MavenStoreDependencies = { parseMavenDiagnostics, readMavenDependencies, parseMavenTestResults, + mergeTestOutcomes, resolveTestRunOutcome, removeMavenDependencyOutput, resolveEffectiveMavenExecutable, @@ -386,24 +389,31 @@ export function mavenTestReportsRequest( }; } -/** A method run replaces only that method; class runs replace the class and nested classes. */ -export function mergeMavenTestOutcomes( +const mavenTestOutcomeId = (testCase: MavenTestCase) => `${testCase.className}#${testCase.method}`; + +/** + * Merges a Maven run into the stored outcomes through Core. This adapter owns + * the Java naming: a method run covers exactly that method of the ran classes; + * a class run covers the class and its binary-named nested classes + * (`Outer$Inner`), which Core only sees as the prefixes `Outer#` and `Outer$`. + */ +export async function mergeMavenTestOutcomes( + merge: MavenStoreDependencies["mergeTestOutcomes"], previous: readonly MavenTestCase[], ranClasses: readonly string[], cases: readonly MavenTestCase[], requestedMethod?: string, -): MavenTestCase[] { - const ran = (className: string) => - ranClasses.some( - (selected) => className === selected || className.startsWith(`${selected}$`), - ); - return [ - ...previous.filter((testCase) => requestedMethod - ? !ranClasses.includes(testCase.className) || testCase.method !== requestedMethod - : !ran(testCase.className)), - ...cases.filter((testCase) => !requestedMethod || - (ranClasses.includes(testCase.className) && testCase.method === requestedMethod)), - ]; +): Promise<MavenTestCase[]> { + const { entries } = await merge({ + previous: previous.map(mavenTestOutcomeId), + incoming: cases.map(mavenTestOutcomeId), + scope: requestedMethod + ? { ids: ranClasses.map((className) => `${className}#${requestedMethod}`) } + : { prefixes: ranClasses.flatMap((className) => [`${className}#`, `${className}$`]) }, + }); + return entries.map((entry) => + entry.source === "previous" ? previous[entry.index] : cases[entry.index], + ); } function mavenTestGoals(selector: string): string[] { @@ -1415,16 +1425,16 @@ export const createMavenStore = ( void (reports ? dependencies.parseMavenTestResults(root, output, reports) : dependencies.parseMavenTestResults(root, output)) - .then((testResults) => { + .then(async (testResults) => { if (diagnosticsRevision === revision && get().root === root && reports) { - set({ - testOutcomes: mergeMavenTestOutcomes( - get().testOutcomes, - reports.classes, - testResults.testCases ?? [], - testRun.selector.split("#")[1], - ), - }); + const testOutcomes = await mergeMavenTestOutcomes( + dependencies.mergeTestOutcomes, + get().testOutcomes, + reports.classes, + testResults.testCases ?? [], + testRun.selector.split("#")[1], + ); + if (diagnosticsRevision === revision && get().root === root) set({ testOutcomes }); } if (diagnosticsRevision !== revision || get().root !== root) return; set({ testResults }); diff --git a/windows/tauri/src/features/run/api/test-outcome-merge-api.ts b/windows/tauri/src/features/run/api/test-outcome-merge-api.ts new file mode 100644 index 0000000000..72f7936ffc --- /dev/null +++ b/windows/tauri/src/features/run/api/test-outcome-merge-api.ts @@ -0,0 +1,26 @@ +import { invoke } from "@/platform/tauri-core"; + +/** What a run replaces in the stored history: exact result ids and id prefixes. */ +export interface TestOutcomeMergeScope { + ids?: readonly string[]; + prefixes?: readonly string[]; +} + +export interface MergedTestOutcome { + source: "previous" | "incoming"; + /** Position in the `previous` or `incoming` list sent to Core. */ + index: number; +} + +/** + * Merges a run's results into the stored history inside the scope the + * provider adapter states (`build.mergeTestOutcomes`). Core compares ids + * only; the caller keeps the payloads and maps the entries back. + */ +export function mergeTestOutcomes(request: { + previous: readonly string[]; + incoming: readonly string[]; + scope: TestOutcomeMergeScope; +}): Promise<{ entries: MergedTestOutcome[] }> { + return invoke<{ entries: MergedTestOutcome[] }>("build.mergeTestOutcomes", request); +} From bbfcf963a3ccf61a921dc000b2a1e6713da693da Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Thu, 5 Nov 2026 07:20:16 -0800 Subject: [PATCH 5/6] =?UTF-8?q?fix(macos):=20#1662=20RUN-10=20coverage=20?= =?UTF-8?q?=E7=BC=BA=20suite=20=E7=9A=84=20case=20=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=8B=92=E7=BB=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 契约与 Core 解码已禁止只有 case、没有 suite 的 coverage,生产方不会产出。macOS 解码层同样拒绝这种组合,覆盖前缀不再把它降级成 project 前缀,避免删多历史结果;补解码拒绝测试。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- .../Execution/BuildSystemContracts.swift | 14 ++++++++++++++ .../Services/LanguageTestService.swift | 4 ++-- .../ExecutionModuleTests.swift | 9 +++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/macos/Sources/LitheCoreContracts/Execution/BuildSystemContracts.swift b/macos/Sources/LitheCoreContracts/Execution/BuildSystemContracts.swift index 183195a1de..153b9a8235 100644 --- a/macos/Sources/LitheCoreContracts/Execution/BuildSystemContracts.swift +++ b/macos/Sources/LitheCoreContracts/Execution/BuildSystemContracts.swift @@ -1027,6 +1027,20 @@ package struct BuildTestResults: Equatable, Sendable, Decodable { package let suite: String? package let testCase: String? private enum CodingKeys: String, CodingKey { case project, suite; case testCase = "case" } + + /// The contract forbids a case without its suite (Core rejects it too), + /// so a scope that names one is malformed rather than guessed at. + package init(from decoder: Decoder) throws { + let values = try decoder.container(keyedBy: CodingKeys.self) + project = try values.decode(String.self, forKey: .project) + suite = try values.decodeIfPresent(String.self, forKey: .suite) + testCase = try values.decodeIfPresent(String.self, forKey: .testCase) + if testCase != nil, suite == nil { + throw DecodingError.dataCorruptedError( + forKey: .testCase, in: values, + debugDescription: "A coverage case requires its suite.") + } + } } package let coverage: [Coverage]? package struct TestCase: Equatable, Identifiable, Sendable, Codable { diff --git a/macos/Sources/LitheExecutionModule/Services/LanguageTestService.swift b/macos/Sources/LitheExecutionModule/Services/LanguageTestService.swift index f04ea8e66c..f9d1c52a04 100644 --- a/macos/Sources/LitheExecutionModule/Services/LanguageTestService.swift +++ b/macos/Sources/LitheExecutionModule/Services/LanguageTestService.swift @@ -336,8 +336,8 @@ package final class LanguageTestService: ObservableObject { /// its suites, or (with a case name) exactly one test. `TestCase.id` is /// length-prefixed per part, so a shorter scope never matches another name. private static func coveragePrefix(_ scope: BuildTestResults.Coverage) -> String { - // A case name is only meaningful inside a suite. - [scope.project, scope.suite, scope.suite == nil ? nil : scope.testCase] + // Decoding rejects a case without its suite, so levels are contiguous. + [scope.project, scope.suite, scope.testCase] .compactMap { $0.map { "\($0.utf8.count):" + $0 } } .joined() } diff --git a/macos/Tests/LitheExecutionModuleTests/ExecutionModuleTests.swift b/macos/Tests/LitheExecutionModuleTests/ExecutionModuleTests.swift index 9ea249e931..53cbedb730 100644 --- a/macos/Tests/LitheExecutionModuleTests/ExecutionModuleTests.swift +++ b/macos/Tests/LitheExecutionModuleTests/ExecutionModuleTests.swift @@ -448,6 +448,15 @@ struct ExecutionModuleTests { #expect(service.testOutcomes(for: "java").map(\.project) == ["b"]) } + @Test + func coverageNamingACaseWithoutItsSuiteIsRejectedAndNeverWidenedToTheProject() throws { + let json = try JSONSerialization.data(withJSONObject: [ + "tests": [], "summary": ["total": 0, "passed": 0, "failed": 0, "errors": 0, "skipped": 0], + "success": true, "coverage": [["project": "a", "case": "kept"]], + ] as [String: Any]) + #expect(throws: DecodingError.self) { try JSONDecoder().decode(BuildTestResults.self, from: json) } + } + @Test func backendTestsIgnoreCancelledRequestsThatReturnAfterReplacement() async throws { let service = LanguageTestService(outcomeResolver: LinkedCoreTestRunOutcome(), executableResolver: TestExecutableResolver(), processFactory: { TestStreamingProcess() }) From a5c86ae715ff4c08f7406bc6ac3856817c7a7475 Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Thu, 5 Nov 2026 18:29:24 -0800 Subject: [PATCH 6/6] =?UTF-8?q?fix(scripts):=20#1662=20=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E8=BE=B9=E7=95=8C=E6=A3=80=E6=9F=A5=E4=B8=8D=E5=86=8D=E8=A6=81?= =?UTF-8?q?=E6=B1=82=E7=BB=88=E7=AB=AF=E6=A8=A1=E5=9D=97=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E8=A7=A3=E6=9E=90=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WS-16(#1768)已把终端文件链接解析下沉到 Core(terminal.parseLinkTarget), macOS 删除了 TerminalLinkResolver,但 verify-module-boundaries.sh 仍要求 LitheTerminalModule 里有这个类型,导致脚本在 preview 上失败。去掉这一项, 保留旧文件不得回到可执行 target 的检查。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- scripts/architecture/verify-module-boundaries.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/architecture/verify-module-boundaries.sh b/scripts/architecture/verify-module-boundaries.sh index e208d10dc9..9a44bb721d 100755 --- a/scripts/architecture/verify-module-boundaries.sh +++ b/scripts/architecture/verify-module-boundaries.sh @@ -78,7 +78,8 @@ for legacy_terminal_file in \ fi done -for terminal_type in TerminalFeatureModel TerminalSession TerminalTransport TerminalLinkResolver; do +# Link parsing lives in Rust Core (`terminal.parseLinkTarget`); the module keeps no parser of its own. +for terminal_type in TerminalFeatureModel TerminalSession TerminalTransport; do rg -q "(class|protocol|enum) ${terminal_type}" macos/Sources/LitheTerminalModule || { print -u2 "Terminal module is missing real implementation: ${terminal_type}" exit 1