Sync: keep the remembered sign-in when the provider is merely down, and say why SYNC NOW found the machine offline
ci / desktop nightly (push) Canceled after 0s
ci / api image (push) Canceled after 0s
ci / android head (push) Canceled after 4m10s
ci / build and test (push) Canceled after 4m12s

This commit is contained in:
jaap-jan committed 2026-10-07 11:11:09 +02:00
1 parent 5b32c76c95
commit 509937c4b8
5 files changed
+89 -6

No files matched your search

@@ -9702,6 +9702,42 @@ public sealed partial class ShellFlowTests : IAsyncLifetime
resumeAttempts.ShouldBe(attempted);
}
/// <remarks>
/// The machine this was found on: the identity provider restarted, discovery answered 502 for a
/// moment, and that was read as a refusal — so the remembered sign-in was deleted and the machine
/// stayed OFFLINE long after the server was back, with SYNC NOW saying nothing about why.
/// </remarks>
[Fact]
public async Task AProviderThatIsDown_KeepsTheSignInAndComesBackOnline()
{
await UnlockedAsync();
await shell.Vault!.SyncOnOpenAsync(Token);
await shell.LockCommand.ExecuteAsync(null);
resumeFailure = new OidcException(
"Discovery at 'https://id.example/.well-known/openid-configuration' returned 502.");
var relaunch = Relaunch(resume: ResumeAsync);
await using var _ = relaunch.ConfigureAwait(false);
await relaunch.StartAsync(Token);
relaunch.Passphrase = Passphrase;
await relaunch.UnlockCommand.ExecuteAsync(null);
await relaunch.Vault!.SyncCommand.ExecuteAsync(null);
relaunch.IsOnline.ShouldBeFalse();
relaunch.Vault.Status.ShouldContain("returned 502", Case.Insensitive,
"SYNC NOW must say why it is offline, not just that it is");
// The provider comes back, and the next pass resumes with the token it still has.
resumeFailure = null;
await relaunch.Vault.SyncOnOpenAsync(Token);
relaunch.IsOnline.ShouldBeTrue();
resumedWith.ShouldBe("refresh-token-1");
}
/// <remarks>
/// The pass that runs when the vault opens used to be skipped in the application and nowhere else: the
/// loop is started from inside the unlock command, so the busy flag it yields to was raised by the