fix(ui): one trail length for the bar, the store and /api/flow (#1976) (#2001)

The trail store saves up to 64 hops, /api/flow read at most 24, the
in-memory trail had no limit, and /api/nodes answers 60 ids per request.
So "Read as flow" failed on any walk of 25 or more hops, including trails
the store had just saved, and a cold load of a 61-64 hop link never got its
names back.

/api/flow now reads up to the store's MAX_TRAIL_HOPS. The trail keeps the
same 64 hops, dropping the oldest on push and on hydrate. resolveTrailNames
asks /api/nodes in batches of 60 and merges the answers.


(cherry picked from commit 4da454022d)

Co-authored-by: danusha2345 <ewidusoc498@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-09-27 12:28:04 +00:00
committed by GitHub
parent 6c414cc830
commit d1df89e17d
5 changed files with 73 additions and 10 deletions
+3 -2
View File
@@ -49,6 +49,9 @@ import {
} from '../../graph/dynamic-boundary-report';
import { highlightLines, type HighlightResult } from '../highlight';
import { badRequest, intParam } from './respond';
// Hops accepted from a trail: the same cap the trail store saves under, so a
// trail that can be saved can also be read as a flow (#1976).
import { MAX_TRAIL_HOPS } from './trail-store';
import { findIndexedFile, hasDriftedOnDisk, splitLines, toRequestPath } from './source';
import { resolveProjectFile } from '../security';
import {
@@ -80,8 +83,6 @@ const HIGHLIGHT_LEAD_MAX = 200;
/** Distinct paths returned. The header's flow picker is a short list or nothing. */
export const MAX_FLOWS = 4;
/** Hops accepted from a trail. The trail bar itself is not much longer than this. */
const MAX_TRAIL_HOPS = 24;
// =============================================================================
// Wire shapes