Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions apple/TablePro/Core/Sync/Approvals/SyncApprovalsModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ internal struct SyncApprovalFailure: Equatable {
let message: String
}

// The Team Library changes that wait for the person on this Mac. The count is the engine's own, so the status line and
// the Welcome window say the same; the list is read only while something waits.
// The Team Library changes that wait for the person on this Mac. The count is the engine's until the list is read, then
// the records listed, so the status line, the Welcome window and the sheet say the same; the list is read only while
// something waits.
@MainActor
internal final class SyncApprovalsModel: ObservableObject {
static let shared = SyncApprovalsModel()
Expand Down Expand Up @@ -103,9 +104,11 @@ internal final class SyncApprovalsModel: ObservableObject {
return
}
guard started == generation else { return }
// A personal row an earlier build left waits only until the core's next pass settles it, and a TablePro Sync one
// holds values the server could have written (core ADR 0114, Approvals), so none is offered.
show(waiting: count, records: read.filter { $0.record.scope.hasPrefix("team_") })
// A personal row an earlier build left stays until a pass settles it, later when its store cannot be read, and a
// TablePro Sync one holds values the server could have written (core ADR 0114, Approvals). None is offered or
// counted.
let team = read.filter { $0.record.scope.hasPrefix("team_") }
show(waiting: team.count, records: team)
}

// `record` is the copy the sheet showed, never one read since: its digest makes the core refuse a decision on values a
Expand Down
22 changes: 20 additions & 2 deletions apple/TablePro/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -83227,6 +83227,9 @@
},
"End-to-end encryption needs a sign-in to your TablePro account. This Mac keeps its data." : {

},
"End-to-end encryption protects everything TablePro Sync carries and Team Library's passwords. Your plan includes neither, so this Mac needs no keys." : {

},
"End-to-end encryption protects the passwords TablePro Sync and Team Library carry. Your plan includes neither, so this Mac needs no keys." : {

Expand Down Expand Up @@ -192682,6 +192685,9 @@
},
"Shows the setting to fix" : {

},
"Shows the Team Library changes that wait for your approval" : {

},
"Shows the Team Library items you and a teammate both changed" : {

Expand Down Expand Up @@ -221620,6 +221626,9 @@
},
"The server named an address the tunnel cannot forward to." : {

},
"The server needs an update before it can sync this Mac's library. Your data stays on this Mac." : {

},
"The server no longer knows this license key." : {
"localizations" : {
Expand Down Expand Up @@ -225314,6 +225323,9 @@
},
"These changes are not uploaded yet and are lost if you discard them: %@." : {

},
"These changes came from your team. They can change where a Team Library connection signs in, its Safe Mode, or its AI policy, so nothing here applies on this Mac until you approve it." : {

},
"These changes drop %@, the account this connection uses." : {
"localizations" : {
Expand Down Expand Up @@ -229782,10 +229794,10 @@
"This Mac can't remove “%@”" : {

},
"This Mac can't sync with iCloud one last time before it moves, so changes made on your other devices since its last sync with iCloud don't come along, and items they deleted since then stay on this Mac. Everything on this Mac moves, and nothing here is lost." : {
"This Mac can't reset your keys while it's locked. Sign out, then sign in again to reset them." : {

},
"This Mac can't reset your keys while it's locked. Sign out, then sign in again to reset them." : {
"This Mac can't sync with iCloud one last time before it moves, so changes made on your other devices since its last sync with iCloud don't come along, and items they deleted since then stay on this Mac. Everything on this Mac moves, and nothing here is lost." : {

},
"This Mac can't sync with iCloud one last time before it moves, so changes made on your other devices since its last sync with iCloud don't come along. Everything on this Mac moves, and nothing here is lost." : {
Expand Down Expand Up @@ -229975,6 +229987,9 @@
}
}
}
},
"This Mac's data goes up to your TablePro account end-to-end encrypted. The server can't read your connections, saved queries, settings, passwords or query history." : {

},
"This Mac's data goes up to your TablePro account, end-to-end encrypted." : {

Expand Down Expand Up @@ -252397,6 +252412,9 @@
}
}
}
},
"Your team changed Team Library connections. Review the changes before they apply on this Mac." : {

},
"Your team doesn't sync passwords, so teammates enter their own." : {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct SyncApprovalsModelTests {
#expect(model.records == records)
}

@Test("A personal row an earlier build left is never offered, so only Team Library records can be approved")
@Test("A personal row an earlier build left is never offered or counted, so only Team Library records can be approved")
func personalRowsAreNotListed() async {
let team = SyncApprovalFixture.changedConnection()
let engine = FakeSyncApprovalEngine([SyncApprovalFixture.personalConnection(), team])
Expand All @@ -49,10 +49,23 @@ struct SyncApprovalsModelTests {
await model.refresh()

#expect(model.records == [team])
#expect(model.waiting == 1)
await model.approveAll(model.records)
#expect(engine.decided == ["\(SyncApprovalFixture.changedID) approve"])
}

@Test("Only personal rows an earlier build left: nothing waits, so no link offers a review with nothing in it")
func onlyPersonalRowsCountNothing() async {
let engine = FakeSyncApprovalEngine([SyncApprovalFixture.personalConnection()])
let model = Self.model(engine)

await model.refresh()

#expect(model.waiting == 0)
#expect(model.records.isEmpty)
#expect(model.hasRead)
}

@Test("Nothing waiting reads no list, and an engine not open yet shows nothing")
func nothingWaitingReadsNothing() async {
let engine = FakeSyncApprovalEngine()
Expand Down
Loading