Skip to content

Logs: each write to notes, folders and spaces says what it changed - #1926

Merged
vmillet-dev merged 1 commit into
dev/1.3.3from
logs-writes
Dec 6, 2026
Merged

vmillet-dev merged 1 commit into
dev/1.3.3from
logs-writes

Conversation

@vmillet-dev

Copy link
Copy Markdown
Owner

Closes #1923. Stacked on #1925 (Sensitive): its base is logs-sensitive until that one is merged.

What changes

  • One line at info per write of the core, once it has written, under its module: engine::notes, engine::folders, engine::spaces, engine::attachments. It says what was done, the ids touched (whole; a batch names ten, then counts the rest), the note's kind, and the parts changed, with what was written in them through Sensitive.
    • notes: created, updated (the parts the patch sets), converted, duplicated, revision restored, to the trash, restored, purged, trash emptied, moved and moved back, tagged, untagged, a tag taken off and put back, pinned, prioritised, fields kept, global fields set, tags renamed or deleted, samples seeded;
    • folders: created, renamed, recoloured, moved and moved back, deleted, notes filed and filed back, moved into a folder, board laid out or arranged;
    • spaces: created, renamed, pinned, deleted; attachments: a file or an image attached, deleted, saved to a path.
  • A drawing's body is its scene, a JSON nobody reads: said by its size alone, in every build.
  • engine::logged (listed, written) and engine::notes::logged (patched, holding) format the lines; each function writes its own.
  • The function keeps its shape: let x = engine.write(…)?; log::info!(…); Ok(x). A write that fails logs nothing more than its call's line.
  • The wiki's logs page has a section « What the core wrote ».

What the session played earlier now reads, in a debug build:

INFO  [main] ui::action: #8 Notes::Editor::Save
INFO  [db]   engine::notes: updated 3f2a91c0-… (note): content « sudo systemctl restart api »
DEBUG [db]   ui::backend: db #8 notes::update 1 ms ok

and in a release, content ‹26 chars›.

Checks run

  • cargo fmt --all --check, cargo clippy -p engine -p ui -p app --all-targets --all-features -- -D warnings.
  • cargo test -p engine: all pass, with commands::logged new: two tests hear a note's writes (created, updated, converted, fields kept, duplicated, tagged, to the trash) and a space's, a folder's and an attachment's, find their ids, kinds and parts, and no typed sentinel (the switch is off in a test).
  • cargo test -p ui --lib: 1 582 passed, 4 ignored; state::logged_tests still passes with every new line heard.
  • node scripts/architecture-links.mjs.

Generated by Claude Code

@vmillet-dev vmillet-dev added the refactor Restructuring without behaviour change label Dec 6, 2026 — with Claude
Base automatically changed from logs-sensitive to dev/1.3.3 December 6, 2026 11:16
Each service function that writes notes, tags, fields, attachments, folders
or spaces logs one line at info once it has written: what it did, the ids it
touched, the note's kind and the parts it changed, what was written in them
through Sensitive.

Closes #1923

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BbVs5syDjY1sDvi7chZYW8
@vmillet-dev
vmillet-dev merged commit 77e8520 into dev/1.3.3 Dec 6, 2026
11 of 18 checks passed
@vmillet-dev
vmillet-dev deleted the logs-writes branch December 6, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructuring without behaviour change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants