Merge branch 'pipelines/run-20261112-1047-notify-only-on-unexpected-run-failures-64a9'
This commit is contained in:
@@ -65,6 +65,9 @@ AttentionKind? attentionKindOf(dynamic status) {
|
||||
/// onto a waiting run must not hide a genuine human decision.
|
||||
AttentionKind? attentionKindForRun(JsonMap run) {
|
||||
final kind = attentionKindOf(run['status']);
|
||||
if (kind == AttentionKind.failed && _word(run['failure_kind']) == 'expected') {
|
||||
return null;
|
||||
}
|
||||
if (kind != AttentionKind.decision) return kind;
|
||||
if (_positive(run['export_pending_sequence'])) return null;
|
||||
return kind;
|
||||
@@ -77,7 +80,10 @@ String attentionKey(int runId, AttentionKind kind) => '$runId:${kind.wireName}';
|
||||
/// shows the server's own diagnostic when it recorded one.
|
||||
String attentionDetail(AttentionKind kind, JsonMap run) {
|
||||
if (kind == AttentionKind.decision) return 'Waiting for your decision';
|
||||
final diagnostic = '${run['diagnostic'] ?? ''}'.trim();
|
||||
final failureReason = '${run['failure_reason'] ?? ''}'.trim();
|
||||
final diagnostic = failureReason.isNotEmpty
|
||||
? failureReason
|
||||
: '${run['diagnostic'] ?? ''}'.trim();
|
||||
return diagnostic.isNotEmpty ? diagnostic : 'Run failed';
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,9 @@ JsonMap _mergeRunFields(JsonMap current, JsonMap frame) {
|
||||
for (final key in ['outcome', 'current_stage', 'created_at', 'finished_at']) {
|
||||
if (!_blank(frame[key])) merged[key] = frame[key];
|
||||
}
|
||||
for (final key in ['failure_kind', 'failure_reason']) {
|
||||
if (frame[key] != null) merged[key] = frame[key];
|
||||
}
|
||||
// Snapshot and terminal frames carry the measured size; others omit it.
|
||||
if (frame['size_bytes'] is num) merged['size_bytes'] = frame['size_bytes'];
|
||||
final oldExport = _positiveInt(current['export_pending_sequence']);
|
||||
@@ -168,6 +171,8 @@ JsonMap? newRunSummaryFromFrame(JsonMap frame) {
|
||||
'finished_at': frame['finished_at'] ?? '',
|
||||
'outcome': frame['outcome'] ?? '',
|
||||
'current_stage': frame['current_stage'] ?? '',
|
||||
'failure_kind': frame['failure_kind'] ?? '',
|
||||
'failure_reason': frame['failure_reason'] ?? '',
|
||||
'resource_wait': frame['resource_wait'],
|
||||
'cancel_requested': frame['cancel_requested'] == true,
|
||||
'cleanup_unconfirmed': frame['cleanup_unconfirmed'] == true,
|
||||
|
||||
@@ -98,6 +98,12 @@ void main() {
|
||||
),
|
||||
AttentionKind.failed,
|
||||
);
|
||||
expect(
|
||||
attentionKindForRun(
|
||||
run({'status': 'failed', 'failure_kind': 'expected'}),
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
@@ -151,6 +157,26 @@ void main() {
|
||||
attentionDetail(AttentionKind.failed, run({'diagnostic': null})),
|
||||
'Run failed',
|
||||
);
|
||||
expect(
|
||||
attentionDetail(
|
||||
AttentionKind.failed,
|
||||
run({
|
||||
'diagnostic': 'generic diagnostic',
|
||||
'failure_reason': 'Provider authentication failed',
|
||||
}),
|
||||
),
|
||||
'Provider authentication failed',
|
||||
);
|
||||
expect(
|
||||
attentionDetail(
|
||||
AttentionKind.failed,
|
||||
run({
|
||||
'diagnostic': 'generic diagnostic',
|
||||
'failure_reason': ' ',
|
||||
}),
|
||||
),
|
||||
'generic diagnostic',
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user