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
1 change: 1 addition & 0 deletions .github/coverage/pinned-surface
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ module src/session/delegated.rs The value that ties a delegated sign-in atte
module src/session/renewal.rs The generation a rejection is answered against and the moment a renewal is due. A defect here is twenty renewals where 0034 fixes one, or a session signed out because a network dropped rather than because a server refused it.
module src/session/password.rs 0030's password: the one reading that spends it, the account name kept as it was typed, and the closure that refuses an answer missing one of the three facts 0005 says a session holds. A defect here is a credential readable twice or printable, or a session built around a token a server never sent.
module src/session/quick_connect.rs 0031's cadence for asking about a Quick Connect exchange, its four endings, and which of the two values the server issued crosses to the client. A defect here is a backoff nobody decided on a route where the answer arrives from a person, a denial reported as a failure, or the value the core presents handed out beside the code.
module src/session/mid_playback.rs 0005's sequence for a token that dies mid-playback: what a rejected position report does, and what each renewal outcome does to the queue and to the one report the success branch makes. A defect here discards a person's positions because their token expired, sends the position reached during a renewal twice, or signs a session out because a connection dropped rather than because a server refused it.
module src/session/sign_out.rs 0114's two acts: what each of them takes away, the order that puts the local half of a sign-out before the request to the server, how work in flight ends, and what a removal that could not be completed reports. A defect here leaves a token in memory on a device somebody handed over, empties a library on an ordinary evening act, or tells an operator their data is gone when it is not.
module src/session/device.rs The device identity, whose identifier is one part of the cache key 0041 derives and one half of the key a server puts a live session under, so a defect here reaches two other surfaces on this list.
module src/lifecycle/mod.rs 0115's creation, its capability answer, its stop bound and the lifetime a call is judged against.
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ const _: () = {
any_thread::<session::renewal::WhatTheOutcomeDoes>();
any_thread::<session::renewal::Renewals>();
any_thread::<session::renewal::RenewalSchedule>();
any_thread::<session::mid_playback::WhatARejectedReportDoes>();
any_thread::<session::mid_playback::WhatTheOutcomeDoesToPlayback>();
any_thread::<measurement::Measurement<'static>>();
any_thread::<diagnostics::Diagnostics<'static>>();
any_thread::<diagnostics::redaction::Treatment>();
Expand Down
2 changes: 2 additions & 0 deletions src/lifecycle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ use crate::diagnostics::DiagnosticsSink;
use crate::diagnostics::redaction::FieldName;
use crate::failure::Failure;
use crate::session::SecretStore;
use crate::session::mid_playback;

/// The two seconds a stop is bounded by where a client sets nothing.
///
Expand Down Expand Up @@ -507,6 +508,7 @@ pub const fn every_field_name_the_core_emits() -> &'static [FieldName] {
envelope::ENTRY_KIND,
envelope::CHECK,
envelope::VERSION_FOUND,
mid_playback::POSITIONS_HELD,
]
}

Expand Down
45 changes: 42 additions & 3 deletions src/playback/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ use crate::server::write_queue::{Target, WhatIsAsserted, WhatTheEnqueueDid, Writ

/// What occasioned a report.
///
/// Two occasions and no third. 0057 fixes that a report is made on each of the
/// five events the moment it happens, and on the interval while something is
/// playing, and it names nothing else that produces one.
/// Three occasions and no fourth. 0057 fixes that a report is made on each of
/// the five events the moment it happens, and on the interval while something
/// is playing, and it names nothing else that produces one. THE THIRD IS
/// 0005'S AND NOT 0057'S: the success branch of a renewal mid-playback reports
/// the current position, which is one more occasion for the same assertion
/// rather than a change to the cadence, and `crate::session::mid_playback` is
/// where it is made.
///
/// It is carried on the report rather than discarded so that whatever delivers
/// the report can tell a stop from a tick, which #10's table separates by path.
Expand All @@ -88,6 +92,11 @@ pub enum ReportedOn {
Event(ReportsWithoutWaiting),
/// The interval said a report was due.
TheInterval,
/// A renewal succeeded mid-playback, and 0005 says the current position is
/// reported then. It is the third occasion because 0005 adds it, in the
/// section that names #35, rather than 0057; what it asserts and how the
/// queue coalesces it are unchanged.
AfterARenewal,
}

/// What one report asserts: where playback of one item is.
Expand Down Expand Up @@ -254,6 +263,36 @@ impl Reporting {
self.interval = self.interval.after_a_report_at(now);
WhatObservingDid::Reported(what_the_queue_did)
}

/// A renewal succeeded mid-playback: report where playback is now.
///
/// 0005 says the success branch drains the queue in order and reports the
/// current position, and this is that report, through the queue like every
/// other. That is what makes it one report rather than two: the entry the
/// rejection left at the head is replaced in place by 0047's coalescing,
/// keeping its place in the order, so the drain resumes exactly where it
/// stopped and the position reached during the renewal arrives once.
/// `crate::session::mid_playback` is the caller, and it is the whole of
/// #35's sequence rather than this one call.
///
/// The interval is left where it was, as it is for a seek: nothing about
/// the cadence changed, and a report that moved it would make the next
/// interval report due ten seconds after the renewal rather than ten
/// seconds after the last report the cadence made.
pub fn report_after_a_renewal(
&mut self,
position: AdmittedPosition,
queue: &mut WriteQueue<PositionReport>,
) -> WhatTheEnqueueDid {
queue.enqueue(
self.target.clone(),
WhatIsAsserted::PlaybackPosition,
PositionReport {
position: position.position(),
reported_on: ReportedOn::AfterARenewal,
},
)
}
}

#[cfg(test)]
Expand Down
Loading
Loading