Files
pipelines/app/lib/features/runs/actions/cancel_wording.dart
T
alan faa5866410 feat(app): add deliberate run cancellation action
Port the browser's canCancel rule and cancel_run request into a native
Material/Cupertino confirmation. Opening the prompt or choosing Keep sends
nothing; a refusal stays visible with the server's words and the run is
re-read so the owner always receives server truth. Includes eligibility,
double-submit, disposal and narrow 2x-text tests plus R2b evidence.
2026-10-21 14:41:33 +01:00

24 lines
1017 B
Dart

import 'package:flutter/widgets.dart';
/// The browser client's cancel wording, kept verbatim.
const cancelActionLabel = 'Cancel run';
const cancelDialogMessage = 'This asks the server to stop the active run.';
const cancelConfirmLabel = 'Cancel run';
const cancelKeepLabel = 'Keep';
/// Stable test/semantics keys shared by the action and its prompt.
const cancelActionKey = ValueKey<String>('cancel-run-action');
const cancelKeepKey = ValueKey<String>('cancel-run-keep');
const cancelConfirmKey = ValueKey<String>('cancel-run-confirm');
const cancelErrorKey = ValueKey<String>('cancel-run-error');
/// The cancel dialog's title: `Cancel run {id}?`.
String cancelDialogTitle(num runId) => 'Cancel run $runId?';
/// The server's refusal, verbatim. Only a blank error gets a generic sentence
/// so the prompt never claims a cancellation that did not happen.
String describeCancelError(Object error) {
final message = '$error'.trim();
return message.isEmpty ? 'The server did not cancel the run.' : message;
}