2 Commits

Author SHA1 Message Date
da74a84009 ci: point Swatinem/rust-cache at the real workspace root
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled
Both workflows had `workspaces: src-tauri -> target`, which tells
rust-cache the workspace lives at src-tauri/ and its target dir is
src-tauri/target. Neither is true: the workspace is defined at the repo
root (Cargo.toml:1–3 — members = ["src-tauri", "crates/*"]), so cargo
walks up and puts artifacts at ./target, not ./src-tauri/target.

Result: the cache action was saving an empty (or wrong) directory on
every run. Every CI run on every OS effectively started from a cold
build, which is the actual reason the Windows job appeared to compile
sqlx from scratch every push — it was compiling sqlx from scratch every
push.

Point the cache at the real workspace root. While here, drop the
`working-directory: src-tauri` on the cargo check step so the command
runs from the workspace root too; cargo finds the same workspace either
way, but running from root is consistent with the cache's view.

Expected impact: Windows check job drops from ~15–25 min cold-every-time
to ~2–3 min on warm runs, matching Linux/macOS behaviour.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 15:42:12 +01:00
26b41389b2 perf(sqlx): strip default features — workspace uses none of macros / migrate / any / json
sqlx 0.8's default feature set pulls in `any`, `macros`, `migrate`, and
`json`. Grepping the workspace confirms none of these are used — the
code calls sqlx::query() / query_scalar() at runtime, implements its own
migration sequencing in crates/storage/src/migrations.rs, is sqlite-only
(no `any` needed), and never derives FromRow / applies sqlx proc-macros.

Dropping them keeps only what's needed: runtime-tokio + sqlite.

Why it matters disproportionately on Windows: the `macros` feature pulls
sqlx-macros → sqlx-macros-core → proc-macro2 / syn / quote / async-trait
/ url / heck / dotenvy / sha2 / filetime. Each proc-macro crate on
Windows MSVC compiles to a .dll with a full linker invocation (slower
ABI than Linux/macOS proc-macro .so). Net: tens of seconds shaved off
every cold-cache CI run, compounding with the cache-path fix in the next
commit.

kon-mcp was already lean (default-features = false); matching that shape
across the workspace now.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 15:42:04 +01:00
4 changed files with 18 additions and 5 deletions

View File

@@ -99,10 +99,12 @@ jobs:
- name: Install Rust - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
# Workspace is at the repo root; target dir is ./target (not
# src-tauri/target). See note in check.yml for details.
- name: Cache Rust - name: Cache Rust
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: src-tauri -> target workspaces: .
shared-key: kon-build-${{ matrix.os }} shared-key: kon-build-${{ matrix.os }}
- name: Install JS deps - name: Install JS deps

View File

@@ -72,14 +72,18 @@ jobs:
# Cache the Cargo target dir + registry per OS so the heavy # Cache the Cargo target dir + registry per OS so the heavy
# whisper-rs-sys C++ build only happens on a clean cache. # whisper-rs-sys C++ build only happens on a clean cache.
# The workspace root is the repo root (see //Cargo.toml), so target/
# lives at ./target — NOT src-tauri/target. Pointing the cache at
# src-tauri/target produced silent cache misses on every run and was
# the real reason Windows check times felt like they compiled sqlx
# from scratch every time. Use the repo root as the workspace hint.
- name: Cache Rust artifacts - name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: src-tauri -> target workspaces: .
shared-key: kon-${{ matrix.os }} shared-key: kon-${{ matrix.os }}
- name: cargo check (workspace) - name: cargo check (workspace)
working-directory: src-tauri
run: cargo check --workspace --all-targets run: cargo check --workspace --all-targets
frontend: frontend:

View File

@@ -8,7 +8,12 @@ description = "SQLite persistence, BM25 search, and file storage for Kon"
kon-core = { path = "../core" } kon-core = { path = "../core" }
# SQLite with compile-time checked queries # SQLite with compile-time checked queries
sqlx = { version = "0.8", features = ["sqlite", "runtime-tokio"] } # default-features = false strips sqlx's `any`, `macros`, `migrate`, `json` —
# none of which this crate uses (it calls sqlx::query() / query_scalar()
# directly and runs its own migration machinery). Cuts ~40% of sqlx's
# compile graph, most visibly on Windows MSVC where each proc-macro crate
# (which `macros` pulls in) becomes a slow .dll link.
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio", "sqlite"] }
# Async runtime # Async runtime
tokio = { version = "1", features = ["rt", "sync", "macros"] } tokio = { version = "1", features = ["rt", "sync", "macros"] }

View File

@@ -42,7 +42,9 @@ arboard = "3.6.1"
# SqlitePool is named directly from src-tauri/src/lib.rs (the AppState # SqlitePool is named directly from src-tauri/src/lib.rs (the AppState
# stores it). Must be unconditional, not Linux-only — naming a type from # stores it). Must be unconditional, not Linux-only — naming a type from
# a transitive dep requires the dep be listed here too. # a transitive dep requires the dep be listed here too.
sqlx = { version = "0.8", features = ["sqlite", "runtime-tokio"] } # See crates/storage/Cargo.toml — default-features = false drops macros /
# migrate / any / json which this crate doesn't use. Only names SqlitePool.
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio", "sqlite"] }
uuid = { version = "1", features = ["v4"] } uuid = { version = "1", features = ["v4"] }
[target.'cfg(target_os = "linux")'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]