needsNewUpload static method
Whether a build in state can only be fixed by uploading another one.
The single definition of terminal-versus-transient, and the reason it
is here rather than inside the encoder: 'VALID', 'FAILED' and
'INVALID' are compared as string literals in about eleven places in
app_store.dart and cli.dart, and three of those are this same rule
written out again. Putting it on the vocabulary means the next change is
a deletion of those three rather than a reconciliation with a fourth.
True for failed and invalid, which are Apple refusing the binary, and for any expired build — including a valid one, which is the case a "will waiting help" phrasing flattens: expiry is terminal reached from a healthy state, and answering it the same way as a healthy build hides it. Null when the state is unknown or absent, on the same terms as every other derived answer here.
Implementation
static bool? needsNewUpload(ProcessingState? state, {required bool expired}) {
if (expired) {
return true;
}
return switch (state) {
valid || processing => false,
failed || invalid => true,
unknown || null => null,
};
}