atagen

macltok

public
Star0
Watch0

Commit 2819830aef32

tarball

atagen <boss@atagen.co>2026-10-26 08:44 UTC

4 files changed+35-1
engine: log each command and room open phase at debug

A device trace of the wedge after the first room opens had no macltok lines at all, so nothing said which command or open phase stopped. Labels stop at the variant path, so message content and upload bytes never reach a log.
Modified file: src/engine/executor.rs+21 additions
@@ -94,3 +94,24 @@ pub(crate) async fn derive<T: Send + 'static>(work: impl FnOnce() -> T + Send +
9494 pub(crate) async fn derive<T>(work: impl FnOnce() -> T) -> T {
9595 work()
9696 }
97+
98+/// a command's variant path such as `Room(Open`, cut off before any content reaches a log
99+pub(crate) fn label(command: &impl std::fmt::Debug) -> String {
100+ use std::fmt::Write;
101+
102+ struct Label(String);
103+ impl Write for Label {
104+ fn write_str(&mut self, text: &str) -> std::fmt::Result {
105+ for character in text.chars() {
106+ if !(character.is_alphanumeric() || character == '_' || character == '(') {
107+ return Err(std::fmt::Error);
108+ }
109+ self.0.push(character);
110+ }
111+ Ok(())
112+ }
113+ }
114+ let mut label = Label(String::new());
115+ let _ = write!(label, "{command:?}");
116+ label.0.trim_end_matches('(').to_owned()
117+}
Modified file: src/engine/mod.rs+1 additions
@@ -751,6 +751,7 @@ impl Engine {
751751
752752 /// hands back the shutdown request's responder, which is answered once we've stopped
753753 async fn dispatch(&mut self, Request { command, reply }: Request) -> Option<Responder> {
754+ tracing::debug!(command = %executor::label(&command), "engine command");
754755 let client = self.client.clone();
755756 match command {
756757 Command::Lifecycle(LifecycleCommand::Shutdown) => return Some(reply),
Modified file: src/engine/room.rs+11 additions−1 deletions
@@ -5,7 +5,7 @@ use matrix_sdk_ui::timeline::{RoomExt, Timeline, TimelineFocus, TimelineReadRece
55 use ruma::OwnedRoomId;
66 use tokio::sync::mpsc;
77
8-use super::executor::{AbortHandle, JoinError, TaskSet, is_panic, resume_unwind};
8+use super::executor::{AbortHandle, JoinError, TaskSet, is_panic, label, resume_unwind};
99 use super::repair::{Completion, Outcome, RepairController};
1010 use super::timeline::{SessionContext, TaskGuard, TimelineSession};
1111 use crate::{
@@ -73,6 +73,7 @@ impl RoomActor {
7373 }
7474
7575 async fn serve(&mut self) {
76+ tracing::debug!(room_id = %self.room_id, "building the room timeline");
7677 let timeline = match build_timeline(
7778 &self.room,
7879 TimelineFocus::Live {
@@ -84,6 +85,7 @@ impl RoomActor {
8485 Ok(timeline) => timeline,
8586 Err(error) => return self.refuse_everything(error).await,
8687 };
88+ tracing::debug!(room_id = %self.room_id, "starting the room timeline session");
8789 let Ok(room_timeline) = TimelineSession::start(
8890 TimelineId::Room(self.room_id.clone()),
8991 timeline,
@@ -104,7 +106,9 @@ impl RoomActor {
104106 work: TaskSet::new(),
105107 };
106108 let mut repair = RepairController::new(self.room.clone(), self.context.clone());
109+ tracing::debug!(room_id = %self.room_id, "starting recent history");
107110 repair.start_recent().await;
111+ tracing::debug!(room_id = %self.room_id, "room opened");
108112 for reply in self.opening.drain(..) {
109113 reply.done(Ok(()));
110114 }
@@ -217,10 +221,16 @@ impl RoomActor {
217221 Some(ActorRequest::Close(reply)) => return Some(reply),
218222 Some(ActorRequest::Open(reply)) => reply.done(timelines.room.resync().await),
219223 Some(ActorRequest::Execute(command, reply)) => {
224+ let label = label(&command);
225+ tracing::debug!(room_id = %self.room_id, command = %label, "room command");
220226 timelines.execute(command, reply, &self.room).await;
227+ tracing::debug!(room_id = %self.room_id, command = %label, "room command handed off");
221228 }
222229 Some(ActorRequest::Repair(command, reply)) => {
230+ let label = label(&command);
231+ tracing::debug!(room_id = %self.room_id, command = %label, "room repair command");
223232 repair.execute(command, reply).await;
233+ tracing::debug!(room_id = %self.room_id, command = %label, "room repair command handed off");
224234 }
225235 },
226236 completion = repair.next_completion(), if repair.is_running() => {
Modified file: src/engine/timeline.rs+2 additions
@@ -500,10 +500,12 @@ async fn run_pagination(
500500 if events.send(history(HistoryState::Loading)).await.is_err() {
501501 return;
502502 }
503+ tracing::debug!(?timeline_id, limit, "paginating backwards");
503504 let result = timeline
504505 .paginate_backwards(limit.max(1))
505506 .await
506507 .map_err(timeline_error);
508+ tracing::debug!(?timeline_id, ?result, "paginated backwards");
507509 let state = match &result {
508510 Ok(true) => HistoryState::StartReached,
509511 Ok(false) => HistoryState::Idle,