feat(app): open a recorded run visit from its URL

`/runs/:id/stage/:key?visit=N` now selects that stage's N-th recorded
visit in the run detail Timeline, matching the web client's stage-local
visit ordering. A stage key without a visit opens the latest recorded
visit, an out-of-range index clamps to the last one, and a stage with no
recorded visit selects only its Graph node instead of inventing a visit.

Route plumbing carries the query end to end: boot seeds the router from
path and query, the parser reads path plus query, and restore keeps `?`
a query separator instead of percent-encoding it. That also repairs the
existing `?action=decide` and `/runs?pipeline=` URLs.

The Graph node click and the stage route share one sequence-ordered
resolver, so both open the same latest visit.
This commit is contained in:
2026-10-22 10:48:36 +01:00
parent 7aa7007aee
commit f57d8eeb76
12 changed files with 623 additions and 18 deletions
+8 -3
View File
@@ -82,10 +82,13 @@ class _PipelinesAppState extends State<PipelinesApp> {
);
// A malformed or unknown boot path renders Pipelines, so make the address
// bar agree with the rendered destination instead of showing a dead link.
final initial = AppRoute.parse(_provider.value.uri.path);
if (_provider.value.uri.path != initial.path) {
// The comparison includes the query: `?visit=N` is part of the route, while
// a dropped or unknown query is canonicalised away.
final location = routeLocation(_provider.value.uri);
final initial = AppRoute.parse(location);
if (location != initial.path) {
_provider.routerReportsNewRouteInformation(
RouteInformation(uri: Uri(path: initial.path)),
RouteInformation(uri: Uri.parse(initial.path)),
type: RouteInformationReportingType.neglect,
);
}
@@ -208,6 +211,8 @@ class _PipelinesAppState extends State<PipelinesApp> {
session: _session,
server: widget.server,
initialRunId: route.runId,
initialStageKey: route.stageKey,
initialVisit: route.visit,
listRefreshToken: _runsRefresh,
notifications: _notifications,
onRunSelected: (id) => _delegate.goTo(AppRoute.run(id)),