@@ -88,8 +88,7 @@ class CiStaging extends Document {
8888 required String checkRun,
8989 required String conclusion,
9090 }) async {
91- final changeCrumb = '${slug .owner }_${slug .name }_$sha ' ;
92- final logCrumb = 'markConclusion(${changeCrumb }_$stage , $checkRun , $conclusion )' ;
91+ final logCrumb = 'markConclusion(${slug .owner }_${slug .name }_${sha }_$stage , $checkRun , $conclusion )' ;
9392
9493 // Marking needs to happen while in a transaction to ensure `remaining` is
9594 // updated correctly. For that to happen correctly; we need to perform a
@@ -111,10 +110,8 @@ class CiStaging extends Document {
111110
112111 var remaining = - 1 ;
113112 var failed = - 1 ;
114- var total = - 1 ;
115113 bool valid = false ;
116114 String ? checkRunGuard;
117- String ? recordedConclusion;
118115
119116 late final Document doc;
120117
@@ -149,15 +146,9 @@ class CiStaging extends Document {
149146 }
150147 failed = maybeFailed;
151148
152- final maybeTotal = int .tryParse (fields[kTotalField]? .integerValue ?? '' );
153- if (maybeTotal == null ) {
154- throw '$logCrumb : missing field "$kTotalField " for $transaction / ${doc .fields }' ;
155- }
156- total = maybeTotal;
157-
158149 // We will have check_runs scheduled after the engine was built successfully, so missing the checkRun field
159150 // is an OK response to have. All fields should have been written at creation time.
160- recordedConclusion = fields[checkRun]? .stringValue;
151+ final recordedConclusion = fields[checkRun]? .stringValue;
161152 if (recordedConclusion == null ) {
162153 log.info ('$logCrumb : $checkRun not present in doc for $transaction / $doc ' );
163154 await docRes.rollback (RollbackRequest (transaction: transaction), kDatabase);
@@ -166,8 +157,6 @@ class CiStaging extends Document {
166157 remaining: remaining,
167158 checkRunGuard: null ,
168159 failed: failed,
169- summary: 'Check run "$checkRun " not present in $stage CI stage' ,
170- details: 'Change $changeCrumb ' ,
171160 );
172161 }
173162
@@ -218,7 +207,7 @@ class CiStaging extends Document {
218207 fields[checkRun] = Value (stringValue: conclusion);
219208 fields[kRemainingField] = Value (integerValue: '$remaining ' );
220209 fields[kFailedField] = Value (integerValue: '$failed ' );
221- } on DetailedApiRequestError catch (e, stack ) {
210+ } on DetailedApiRequestError catch (e) {
222211 if (e.status == 404 ) {
223212 // An attempt to read a document not in firestore should not be retried.
224213 log.info ('$logCrumb : staging document not found for $transaction ' );
@@ -228,15 +217,6 @@ class CiStaging extends Document {
228217 remaining: - 1 ,
229218 checkRunGuard: null ,
230219 failed: failed,
231- summary: 'Internal server error' ,
232- details: '''
233- Staging document not found for CI stage "$stage " for $changeCrumb . Got 404 from
234- Firestore.
235-
236- Error:
237- ${e .toString ()}
238- $stack
239- ''' ,
240220 );
241221 }
242222 // All other errors should bubble up and be retried.
@@ -259,15 +239,6 @@ $stack
259239 remaining: remaining,
260240 checkRunGuard: checkRunGuard,
261241 failed: failed,
262- summary: valid ? 'All tests passed' : 'Not a valid state transition for $checkRun ' ,
263- details: valid
264- ? '''
265- For CI stage $stage :
266- Total check runs scheduled: $total
267- Pending: $remaining
268- Failed: $failed
269- '''
270- : 'Attempted to transition the state of check run $checkRun from "$recordedConclusion " to "$conclusion ".' ,
271242 );
272243 }
273244
@@ -372,16 +343,12 @@ class StagingConclusion {
372343 final int remaining;
373344 final String ? checkRunGuard;
374345 final int failed;
375- final String summary;
376- final String details;
377346
378347 const StagingConclusion ({
379348 required this .result,
380349 required this .remaining,
381350 required this .checkRunGuard,
382351 required this .failed,
383- required this .summary,
384- required this .details,
385352 });
386353
387354 bool get isOk => result == StagingConclusionResult .ok;
@@ -399,21 +366,8 @@ class StagingConclusion {
399366 other.result == result &&
400367 other.remaining == remaining &&
401368 other.checkRunGuard == checkRunGuard &&
402- other.failed == failed &&
403- other.summary == summary &&
404- other.details == details);
405-
406- @override
407- int get hashCode => Object .hashAll ([
408- result,
409- remaining,
410- checkRunGuard,
411- failed,
412- summary,
413- details,
414- ]);
369+ other.failed == failed);
415370
416371 @override
417- String toString () =>
418- 'StagingConclusion("$result ", "$remaining ", "$checkRunGuard ", "$failed ", "$summary ", "$details ")' ;
372+ int get hashCode => Object .hashAll ([result, remaining, checkRunGuard, failed]);
419373}
0 commit comments