oficina / base Public

Spend no minute on a set-up abandoned while fetching its assertion

Fable's second re-review, nit 2: a set-up that stopped counting while
the kit fetched its assertion returned without giving back its attempt,
so the next automatic set-up waited up to a minute. That path now
abandons as the others do; a proof that simply failed while the run
still counts keeps the minute, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 006a191c3bb1962f641b38b431a93fcab421508e parent c38cd5d
2 files changed, +20 −2
  • native/apple/Sources/BaseKit/Session/AskSetup.swift +4 −2
  • native/apple/Tests/BaseKitTests/AskSetupTests.swift +16 −0
diff --git a/native/apple/Sources/BaseKit/Session/AskSetup.swift b/native/apple/Sources/BaseKit/Session/AskSetup.swift
index a216c93..d9c9068 100644
--- a/native/apple/Sources/BaseKit/Session/AskSetup.swift
+++ b/native/apple/Sources/BaseKit/Session/AskSetup.swift
@@ -112,8 +112,10 @@ import RastrilloApple
proof = try await assertion(equipo)
} catch {
// CancellationError (the sign-in moved under it) and any other
- // failure to get a proof: nothing to show; next time.
- return false
+ // failure to get a proof: nothing to show; next time. Abandoned
+ // meanwhile (the account went, a pause, an invalidation): it
+ // spends no minute either.
+ return live() ? false : abandon()
}
guard live() else { return abandon() }
do {
diff --git a/native/apple/Tests/BaseKitTests/AskSetupTests.swift b/native/apple/Tests/BaseKitTests/AskSetupTests.swift
index 200e366..94b676b 100644
--- a/native/apple/Tests/BaseKitTests/AskSetupTests.swift
+++ b/native/apple/Tests/BaseKitTests/AskSetupTests.swift
@@ -159,4 +159,20 @@ import XCTest
XCTAssertEqual(ask.disconnected, true)
XCTAssertEqual(AskActions.note(ask.phase).way, .here("ask.connect.button"), "Set up shows")
}
+
+ /// Fable's second re-review, nit 2: abandoned while fetching the
+ /// assertion (the account went), the run spends no minute.
+ func testAnAbandonedAssertionSpendsNoMinute() async {
+ let (setup, ask, _) = await make([state("connect"), json(200, #"{"state":"ready"}"#), state("ready"), .hang])
+ var current = true
+ setup.isCurrent = { current }
+ failNext = CancellationError()
+ current = false
+ _ = await setup.runIfNeeded()
+ current = true
+ let again = await setup.runIfNeeded()
+ XCTAssertTrue(again, "tried again at once")
+ XCTAssertEqual(audiences.count, 2)
+ ask.pause()
+ }
}