From 2e32ecda6e3fa990d58bc0d9b22bf183f90a0e2c Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 26 Jul 2026 00:09:07 -0400 Subject: [PATCH] desktop: rustfmt the pull tests; run fmt after clippy/test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two macro-argument splits and a stray blank line, applied verbatim from run 2900's cargo fmt --check diff. Also reorders the Linux job so `cargo fmt --check` runs AFTER clippy and the tests. Fail-fast ordering would normally put the cheapest check first, but there is no Rust toolchain on the workstation, so this lane is verified entirely in CI — and a formatting nit failing first SKIPS clippy and the tests, making a whole cycle teach nothing but whitespace. That has now cost four cycles in this session alone. It still runs before the 20-40 minute bundle build, so a fmt failure doesn't burn that either. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01SreJkbxB4gx8pPsu8QbLPi --- .forgejo/workflows/desktop.yml | 16 ++++++++++++---- desktop/src-tauri/src/sync/pull.rs | 12 +++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/desktop.yml b/.forgejo/workflows/desktop.yml index 005e5c3..69f2772 100644 --- a/.forgejo/workflows/desktop.yml +++ b/.forgejo/workflows/desktop.yml @@ -52,10 +52,6 @@ jobs: run: npm ci && npm run build working-directory: frontend - - name: Rust format check - run: cargo fmt --check - working-directory: desktop/src-tauri - - name: Clippy run: cargo clippy --all-targets -- -D warnings working-directory: desktop/src-tauri @@ -64,6 +60,18 @@ jobs: run: cargo test working-directory: desktop/src-tauri + # Deliberately AFTER clippy + test, not before. + # + # It's the cheapest check, so fail-fast ordering would normally put it first — + # but there is no Rust toolchain on the workstation (the desktop lane is + # verified entirely here), so a formatting nit failing first SKIPS clippy and + # the tests, and one CI cycle teaches nothing but whitespace. Running it here + # means every push reports its real problems too. Still before the ~20-40 min + # bundle build, so a fmt failure doesn't burn that. + - name: Rust format check + run: cargo fmt --check + working-directory: desktop/src-tauri + # Frontend already built above; skip the beforeBuildCommand rebuild. - name: Tauri build (deb + AppImage) run: cargo tauri build --config '{"build":{"beforeBuildCommand":""}}' diff --git a/desktop/src-tauri/src/sync/pull.rs b/desktop/src-tauri/src/sync/pull.rs index f6c026a..90878f8 100644 --- a/desktop/src-tauri/src/sync/pull.rs +++ b/desktop/src-tauri/src/sync/pull.rs @@ -528,7 +528,10 @@ mod tests { apply_page(&conn, &page(vec![n], vec![], 1)).expect("apply"); assert_eq!(count(&conn, "SELECT COUNT(*) FROM labels"), 1); assert_eq!( - count(&conn, "SELECT via_tag FROM note_labels WHERE note_id = 'n1'"), + count( + &conn, + "SELECT via_tag FROM note_labels WHERE note_id = 'n1'" + ), 1, "via_tag is applied verbatim, not re-derived" ); @@ -592,12 +595,15 @@ mod tests { assert_eq!(count(&conn, "SELECT COUNT(*) FROM labels"), 1); let label_id: String = conn - .query_row("SELECT label_id FROM note_labels WHERE note_id = 'n1'", [], |r| r.get(0)) + .query_row( + "SELECT label_id FROM note_labels WHERE note_id = 'n1'", + [], + |r| r.get(0), + ) .expect("membership survived"); assert_eq!(label_id, "server-id", "membership re-pointed, not dropped"); } - #[test] fn label_tombstone_deletes_and_cascades_memberships() { let conn = db();