Skip to content

Logs: each action of the person logged by name, in one place - #1901

Open
vmillet-dev wants to merge 1 commit into
logs-levelsfrom
logs-actions
Open

vmillet-dev wants to merge 1 commit into
logs-levelsfrom
logs-actions

Conversation

@vmillet-dev

Copy link
Copy Markdown
Owner

Closes #1843

Stacked on #1900 (the log levels): its base is logs-levels so that this diff is this ticket alone. Merge #1898, then #1900; this pull request then targets dev/1.3.3.

One place logs each action. AppState::act takes a number from the backend (Backend::next_action, from 1 in the session), logs the action, then applies it. The frame's loop, the tray and a second launch call act; apply logs nothing, because one action may apply another (Menu::Quit applies Global::Quit). Each line looks like this:

2026-12-04 18:59:48.419 INFO  [main] ui::action: #11 Http::OpenRequest

The name comes from the variants alone. Action::name reads them through strum::IntoStaticStr: the area, the variant, and for a variant that carries what is asked of a part of the area, that part's variant too. Examples: Notes::Editor::Close, Notes::Editor::Fields::Keep, Http::Runner::Start, Menu::Preferences::Apply, App::Window::…. The line never holds a payload or an id (the owner chose the name alone). A new variant is logged without anyone writing a line for it.

Typing goes to trace. Actions sent at each key typed, or by the screen itself as it shows a card, are logged at trace through the one list FREQUENT, kept beside name: a search, the palette's text, a request's draft, a variable row, the current passphrase typed, the fields' preview, a drawing's picture, a sheet evaluated, a JSON explored. The info lines then read as what the person did. Three journeys run with their logs kept (03, 05, 09) show that no action floods at info. The most frequent are Notes::Editor::Save (28, one per blur or closing), Http::Send (27) and Notes::Canvas::StepBack (13).

Dependency. strum 0.27.2 is declared once in [workspace.dependencies] with derive (D33). It was already compiled with derive through croner, so Cargo.lock gains no crate and no version. Its licence is MIT. cargo-deny is not installed here, so security-cargo.yml will be the check on this pull request.

Tests

  • each_action_is_logged_once_by_name_numbered_in_order (real core, temporary library): one action of each area, plus a carrier, is found under ui::action, in order, numbered without a gap. Palette::Type is at trace.
  • what_an_action_carries_is_never_logged: actions carrying a title (a duplicate), a checklist item, a body (a save), a field value (Fields::Keep) and a URL (Http::Edit), each a sentinel. None of the sentinels is in any line logged during the test, at any level, on any thread.
  • Every action a state test applies through Held::apply must have a name made only of ::-separated alphanumeric parts. The 1,578 ui tests ran with that check.
  • The crate's tests now share one logger, testing::listen. The preferences test that set its own logger uses it, since a test binary can hold only one logger.

Docs. The wiki's logs page gets a new section, « What the person did »: where an action is logged, what its name holds, the trace list, and how to read a session's numbers. interface.md's « Drawing, state and actions » points to act.

Checks run (Linux)

  • cargo test -p ui --lib: 1,578 pass, 4 ignored.
  • Journeys 03, 05 and 09 under Xvfb, all green. The driver was patched locally to keep their logs, and that patch was reverted before the commit.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo fmt --all --check, node --test "scripts/*.test.mjs" (77 pass).

Generated by Claude Code

AppState::act numbers each action of the session, logs it at info under
ui::action (#412 Notes::Editor::Close), then applies it: the frame's
loop, the tray and a second launch call it; apply, which one action may
call again, logs nothing. The name is the variants alone, read by
strum::IntoStaticStr, a carrier variant adding its part's own; never the
payload, nor an id. What is sent at each key typed, or by the screen as
it shows a card, is at trace by one list beside the name. The number is
the backend's, for the calls to the core to read.

The crate's tests share one logger (testing::listen); every action a
state test applies through Held must have a name.

Closes #1843

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BbVs5tCyTr9AasGra3Zzg3

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants