feat(app): start a pipeline from the detail view

Native Run action opens the web's prompt/workspace/notify dialog, sends the exact run_pipeline body against the pinned resolved version with one request key per confirmed attempt, keeps refusals in the dialog, reconciles a lost reply by key, and opens only the server-named run through the existing run route with one fresh Runs list read.

Adds a shared failure-reason helper so operators never see Dart runtime prefixes, and records the slice boundary in notes/P3-run.md.
This commit is contained in:
2026-10-22 02:07:49 +01:00
parent 92706a290e
commit 53a8f668ca
24 changed files with 2644 additions and 19 deletions
+17
View File
@@ -57,6 +57,10 @@ class _PipelinesAppState extends State<PipelinesApp> {
/// locally, so the next list reply is the only source of the new pipeline.
int _pipelinesRefresh = 0;
/// Advances when a launch was accepted. The Runs destination re-reads its
/// list once; the run itself is then opened from its route.
int _runsRefresh = 0;
@override
void initState() {
super.initState();
@@ -145,6 +149,17 @@ class _PipelinesAppState extends State<PipelinesApp> {
setState(() => _pipelinesRefresh++);
}
/// Opens the run id an accepted launch named and invalidates the Runs list.
///
/// The order is deliberate: the list token is already advanced when the Runs
/// screen mounts for the first time, so it performs one fresh `list_runs`
/// read and then opens the route's run. No row is inserted locally.
void _runStarted(int id) {
if (!mounted) return;
setState(() => _runsRefresh++);
_delegate.goTo(AppRoute.run(id));
}
Widget _buildShell(BuildContext context, AppRoute route) => AdaptiveShell(
cupertino: _cupertino,
destination: _destinationOf(route.kind),
@@ -156,11 +171,13 @@ class _PipelinesAppState extends State<PipelinesApp> {
session: _session,
server: widget.server,
refreshToken: _pipelinesRefresh,
onRunStarted: _runStarted,
),
AppDestination.runs: (_) => RunsDestination(
session: _session,
server: widget.server,
initialRunId: route.runId,
listRefreshToken: _runsRefresh,
onRunSelected: (id) => _delegate.goTo(AppRoute.run(id)),
onBack: () => _delegate.goTo(AppRoute.runs),
),
@@ -18,6 +18,7 @@ class PipelinesDestination extends StatelessWidget {
required this.session,
required this.server,
this.refreshToken = 0,
this.onRunStarted,
});
final AppSession session;
@@ -28,6 +29,9 @@ class PipelinesDestination extends StatelessWidget {
/// accepted; the rows still come only from the server's next reply.
final int refreshToken;
/// Receives the run id an accepted launch named; the shell opens that route.
final ValueChanged<int>? onRunStarted;
@override
Widget build(BuildContext context) => AnimatedBuilder(
animation: session,
@@ -62,6 +66,7 @@ class PipelinesDestination extends StatelessWidget {
Widget _pipelinesScreen() => PipelinesScreen(
gateway: session.gateway,
embedded: true,
onRunStarted: onRunStarted,
// A reconnect or an accepted template create both advance this counter;
// either change re-reads through the mounted controller.
syncToken: session.connectionEpoch + refreshToken,
@@ -20,6 +20,7 @@ class RunsDestination extends StatelessWidget {
this.initialRunId,
this.onRunSelected,
this.onBack,
this.listRefreshToken = 0,
});
final AppSession session;
@@ -28,6 +29,10 @@ class RunsDestination extends StatelessWidget {
final ValueChanged<int>? onRunSelected;
final VoidCallback? onBack;
/// Advances when a launch was accepted elsewhere. The mounted Runs screen
/// re-reads its list once; no row is inserted locally.
final int listRefreshToken;
@override
Widget build(BuildContext context) => AnimatedBuilder(
animation: session,
@@ -64,6 +69,7 @@ class RunsDestination extends StatelessWidget {
gateway: session.gateway,
initialRunId: initialRunId,
syncToken: session.connectionEpoch,
listRefreshToken: listRefreshToken,
onRunSelected: onRunSelected,
onBack: onBack,
);