Skip to content

Logs: a test fails when typed text reaches a log line - #1918

Merged
vmillet-dev merged 2 commits into
dev/1.3.3from
logs-sentinel
Dec 6, 2026
Merged

vmillet-dev merged 2 commits into
dev/1.3.3from
logs-sentinel

Conversation

@vmillet-dev

@vmillet-dev vmillet-dev commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Closes #1846, last of the milestone.

What changes

  • state::logged_tests::nothing_typed_reaches_a_line_logged_over_a_session (crates/ui): a session on the real core, every line of our crates heard at trace. Each text typed holds a sentinel (zq7x-…, lower case as a tag is kept):

    • the gate: a library's phrase, then another library's, then the first's again;
    • a space and a folder, renamed; a snippet (title, source, body with a {{field}}, tag), its field's value (kept, then filled on copy), an attachment's file name; a Note, a list's item, a Calcul line (evaluated);
    • a search, a move into the folder, a tag on a selection, a duplicate, a delete and its undo, the trash's search;
    • a request sent to a server on this machine: URL, header, JSON body, variable, an after script's console.log, an environment and its value;
    • a tool's input; another library created (the request left unsaved), then back to the first.

    A line holding a sentinel fails the test, which lists each such line with its level and target. The test also checks the session reached each area: the actions and the calls it expects are in the log.

  • testing::listen hears every crate of the workspace (platform, text, richtext, drawing, i18n, brand beside ui and engine).

  • What it found: nothing on the session's path. Reading the log lines on the way found one {error:?} of an AppError (apply_notes.rs, « The drawings were not listed »): a derived Debug prints the detail, which reaches the log only through for_log. Fixed. The fixed line is held by state::refused_tests::drawings_that_cannot_be_listed_are_logged_by_their_code (a Note open, the library closed under it): Sonar counted it uncovered.

  • The wiki's logs page names the test as the rule's guard; devnotes-security-review's checklist asks for a step in it for a new place where a person types.

Where it is, and why not in crates/app

The ticket placed it in crates/app, which sees the logger. But a session can only be driven there through the whole window, from outside ui, whose state and actions are private to it. In ui, the test applies the same actions the window sends, on the same core, through the same Backend, and hears every line before any formatting. The application's logger only adds the time, the level, the thread and the target, and its file (the ring of #1845) keeps lines already logged: a sentinel absent from the lines is absent from the terminal and from the file. The panic hook's report, place and thread only, is held by logging::tests::a_panic_is_reported_by_its_place_and_never_by_its_message.

The after script cannot run in ui's tests (the host is the application relaunched, which a test binary is not): the send goes, the script fails, and that failure's line is checked like the others.

Red on a line that logs a payload

Once, not kept: Action::log writing "#{number} {name} {self:?}". The test fails:

typed text in the log:
INFO ui::action: #2 Notes::CreateSpace Notes(CreateSpace("zq7x-space"))
INFO ui::action: #4 Notes::CreateFolder Notes(CreateFolder { space_id: "10fe89ff-…", parent_id: None, name: "zq7x-folder" })
INFO ui::action: #6 Notes::Editor::Save Notes(Editor(Save { session: 1, edit: Edit { title: Some("zq7x-title"), source: Some("zq7x-source"), body: Some(Content("psql zq7x-body {{zq7x_user}}")), tags: Some(["zq7x-tag"]), …
INFO ui::action: #7 Notes::Editor::Fields::Keep Notes(Editor(Fields(Keep({"zq7x_user": "zq7x-value"}))))
INFO ui::action: #8 Notes::Editor::Attachment::Dropped Notes(Editor(Attachment(Dropped(["/tmp/.tmpPJ7wfR/zq7x-file.txt"]))))
INFO ui::action: #10 Notes::Fill::Submit Notes(Fill(Submit({"zq7x_user": "zq7x-value"})))
…
TRACE ui::action: #22 Notes::Search Notes(Search("zq7x-search"))
INFO ui::action: #26 Notes::Batch::Tag Notes(Batch(Tag("zq7x-batch")))

Checks run

  • cargo test -p ui --lib drawings_that_cannot_be_listed (Windows), cargo clippy -p ui --all-targets --all-features -- -D warnings, cargo fmt --all --check after the coverage test.
  • cargo test -p ui --lib: 1 581 passed, 4 ignored (the new test included; testing::listen now hears every crate of ours, and every other test still passes).
  • cargo clippy -p ui --all-targets --all-features -- -D warnings, cargo fmt --all --check, node scripts/architecture-links.mjs.
  • The red run above, once, then Action::log restored.

Generated by Claude Code

@vmillet-dev vmillet-dev added the test Test suites: coverage, structure, reliability label Dec 5, 2026 — with Claude
state::logged_tests drives a session through the actions a person sends,
on the real core, with a sentinel in every text typed: the gate's
phrases, a space, a folder, four kinds of note, a field's value, an
attachment's name, a search, a tag, a request's URL, header, body,
variable, script and environment, a tool's input, another library and
back. Every line of the workspace's crates is heard at trace; a line
holding a sentinel fails the test, which names it.

The drawings' listing logged an AppError with {:?}, its detail included:
it goes through for_log now. The wiki's logs page and the security
review's checklist name the test as the rule's guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BbVs5tCyTr9AasGra3Zzg3
Base automatically changed from app-name-docs to dev/1.3.3 December 5, 2026 12:17
@vmillet-dev
vmillet-dev merged commit 8f0e624 into dev/1.3.3 Dec 6, 2026
11 checks passed
@vmillet-dev
vmillet-dev deleted the logs-sentinel branch December 6, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Test suites: coverage, structure, reliability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants