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
4 changes: 2 additions & 2 deletions lib/core/models/available_servers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class SelectionHistory {
);

/// Timestamp of one `user_failures` entry, or null if it has none we can
/// read. lantern-box v0.0.104 changed each entry from a bare RFC3339 string
/// read. lantern-box v0.0.101 changed each entry from a bare RFC3339 string
/// to a `{"at": ..., "kind": ...}` object; both are accepted so this parses
/// against either version, matching Go's `UserFailure.UnmarshalJSON`.
/// Unreadable entries are dropped rather than thrown on: one entry in the
Expand All @@ -285,7 +285,7 @@ class SelectionHistory {
if (lastOutcomeAt != null)
"last_outcome_at": lastOutcomeAt!.toIso8601String(),
"consecutive_failures": consecutiveFailures,
// Bare timestamps, i.e. the pre-v0.0.104 shape, which Go still accepts.
// Bare timestamps, i.e. the pre-v0.0.101 shape, which Go still accepts.
// Nothing sends this back to Go today; emitting the object form would mean
// inventing a `kind` we never parsed.
if (userFailures.isNotEmpty)
Expand Down
4 changes: 2 additions & 2 deletions test/core/models/available_servers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ void main() {
});

group('user_failures deserialization', () {
// lantern-box v0.0.104 changed each entry from a bare RFC3339 timestamp to
// lantern-box v0.0.101 changed each entry from a bare RFC3339 timestamp to
// a {"at": ..., "kind": ...} object. Both have to parse: the object form is
// what current lantern-box sends, the string form is what a client paired
// with a pre-v0.0.104 one would see.
// with a pre-v0.0.101 one would see.
test('parses the object form', () {
final history = SelectionHistory.fromJson({
'last_success_delay_ms': 2556,
Expand Down
Loading