diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28096056..949bc02b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: # Install pnpm at the exact version pinned in package.json's # `packageManager` field so local and CI environments match. - name: Install pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4 with: version: 11.8.0 run_install: false @@ -69,7 +69,7 @@ jobs: uses: actions/checkout@v4 - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable # Tauri v2 on Linux links against WebKit2GTK, GTK, libsoup and related # system libraries. The build-script crates (glib-sys, gtk-sys, @@ -100,7 +100,7 @@ jobs: run: sudo apt-get install -y sccache mold clang - name: Cache cargo - uses: Swatinem/rust-cache@v2 + uses: Swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2 with: workspaces: apps/desktop/src-tauri @@ -124,10 +124,10 @@ jobs: uses: actions/checkout@v4 - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable - name: Cache cargo - uses: Swatinem/rust-cache@v2 + uses: Swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2 with: workspaces: apps/desktop/src-tauri key: windows @@ -165,7 +165,7 @@ jobs: uses: actions/checkout@v4 - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: targets: ${{ matrix.target }} @@ -180,7 +180,7 @@ jobs: echo "CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$TOOLCHAIN/aarch64-linux-android21-clang" >> "$GITHUB_ENV" - name: Cache cargo - uses: Swatinem/rust-cache@v2 + uses: Swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2 with: workspaces: apps/desktop/src-tauri key: ${{ matrix.target }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9a787e9d..5afcaeeb 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: uses: actions/checkout@v4 - name: Install pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4 with: version: 11.8.0 run_install: false @@ -58,7 +58,7 @@ jobs: cache: pnpm - name: Install Rust stable - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable - name: Install Tauri Linux system dependencies run: | @@ -93,7 +93,7 @@ jobs: - name: Build (Rust only) if: matrix.language == 'rust' - run: cargo build --manifest-path apps/desktop/src-tauri/Cargo.toml --lib + run: cargo build --locked --manifest-path apps/desktop/src-tauri/Cargo.toml --lib - name: Perform CodeQL analysis uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 78e77859..73463af2 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -17,8 +17,10 @@ on: - cron: "0 2 * * *" workflow_dispatch: +# Least privilege: `check` only reads; the write grants live on the two jobs +# that publish the rolling prerelease. permissions: - contents: write + contents: read jobs: # ───────────────────────────── Check for changes ──────────────────────── @@ -59,6 +61,9 @@ jobs: # ───────────────────────────── Desktop (Linux / macOS / Windows) ──────── desktop: name: ${{ matrix.label }} + # tauri-action creates/overwrites the nightly prerelease. + permissions: + contents: write needs: check if: needs.check.outputs.should-build == 'true' strategy: @@ -86,7 +91,7 @@ jobs: ref: main - name: Install pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4 with: version: 11.8.0 run_install: false @@ -98,7 +103,7 @@ jobs: cache: pnpm - name: Install Rust stable - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} @@ -123,7 +128,7 @@ jobs: patchelf - name: Cache cargo - uses: swatinem/rust-cache@v2 + uses: swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2 with: workspaces: apps/desktop/src-tauri @@ -131,7 +136,7 @@ jobs: run: pnpm install --frozen-lockfile - name: Build and publish - uses: tauri-apps/tauri-action@v0.6.2 + uses: tauri-apps/tauri-action@1ddc7b49b13c3038297360482fcb3e058764d7c9 # v0.6.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} @@ -178,6 +183,9 @@ jobs: name: Android needs: check if: needs.check.outputs.should-build == 'true' && vars.ANDROID_RELEASE_ENABLED == 'true' + # Uploads the APK to the nightly prerelease via `gh release upload`. + permissions: + contents: write runs-on: ubuntu-latest steps: @@ -187,7 +195,7 @@ jobs: ref: main - name: Install pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4 with: version: 11.8.0 run_install: false @@ -199,7 +207,7 @@ jobs: cache: pnpm - name: Install Rust stable - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android @@ -239,7 +247,7 @@ jobs: done - name: Cache cargo - uses: swatinem/rust-cache@v2 + uses: swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2 with: workspaces: apps/desktop/src-tauri key: android diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a8e27c8..515b716c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,9 +30,10 @@ on: workflow_dispatch: # `contents: write` is needed by tauri-action to create the GitHub Release and -# by the Android job to `gh release upload` assets to it. +# by the Android job to `gh release upload` assets to it — so it is granted on +# those two jobs, not workflow-wide. permissions: - contents: write + contents: read jobs: # ───────────────────────────── Desktop (Linux / macOS / Windows) ──────── @@ -41,6 +42,9 @@ jobs: # only uploads workflow artifacts (`tagName` is empty so no release is made). desktop: name: ${{ matrix.label }} + # tauri-action drafts the release and uploads bundles on tag pushes. + permissions: + contents: write strategy: fail-fast: false matrix: @@ -71,7 +75,7 @@ jobs: run: node scripts/version.mjs --check --tag "${{ github.ref_name }}" - name: Install pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4 with: version: 11.8.0 run_install: false @@ -83,7 +87,7 @@ jobs: cache: pnpm - name: Install Rust stable - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: # macOS builds target both architectures; other platforms build natively. targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} @@ -109,7 +113,7 @@ jobs: patchelf - name: Cache cargo - uses: swatinem/rust-cache@v2 + uses: swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2 with: workspaces: apps/desktop/src-tauri @@ -120,7 +124,7 @@ jobs: # Pinned to v0.6.2 (released 2026-03-14). The @v1 major alias does not # resolve in GitHub Actions (tauri-apps/tauri-action#1311), so we pin to # an explicit, vetted tag instead of a floating major version. - uses: tauri-apps/tauri-action@v0.6.2 + uses: tauri-apps/tauri-action@1ddc7b49b13c3038297360482fcb3e058764d7c9 # v0.6.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Signs the updater artifacts. The app only accepts an update signed @@ -200,6 +204,9 @@ jobs: # point building an unsigned release bundle for distribution, and failing # loudly here is better than shipping an unsigned artifact by accident. if: ${{ vars.ANDROID_RELEASE_ENABLED == 'true' }} + # Uploads the APK to the release via `gh release upload`. + permissions: + contents: write runs-on: ubuntu-latest steps: @@ -213,7 +220,7 @@ jobs: run: node scripts/version.mjs --check --tag "${{ github.ref_name }}" - name: Install pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4 with: version: 11.8.0 run_install: false @@ -225,7 +232,7 @@ jobs: cache: pnpm - name: Install Rust stable - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: # All four Android ABIs Tauri builds by default. targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android @@ -275,7 +282,7 @@ jobs: done - name: Cache cargo - uses: swatinem/rust-cache@v2 + uses: swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2 with: workspaces: apps/desktop/src-tauri key: android @@ -357,7 +364,7 @@ jobs: sudo udevadm trigger --name-match=kvm - name: Smoke-test minified Android release - uses: reactivecircus/android-emulator-runner@v2 + uses: reactivecircus/android-emulator-runner@4c44018e59b437e86cdfc41da381398f93ed8808 # v2 with: api-level: 35 target: google_apis diff --git a/.gitignore b/.gitignore index b9e681c3..13331d56 100644 --- a/.gitignore +++ b/.gitignore @@ -67,5 +67,4 @@ ehthumbs.db temp/ tmp/ tools/keyring-migration-probe/target/ -tools/keyring-migration-probe/Cargo.lock .zvec-grep diff --git a/apps/desktop/src/extensions/bootstrap.ts b/apps/desktop/src/extensions/bootstrap.ts index aa229f08..282b47a8 100644 --- a/apps/desktop/src/extensions/bootstrap.ts +++ b/apps/desktop/src/extensions/bootstrap.ts @@ -106,7 +106,13 @@ export function bootstrapExtensions(options: BootstrapOptions = {}): ExtensionBo const failedManifests: BootstrapEntry[] = []; const disposeAll = (disposables: Disposable[]): Disposable[] => { - for (const disposable of disposables) disposable.dispose(); + for (const disposable of disposables) { + // Dispose may settle async, but this rollback helper is synchronous — + // report failures and keep unwinding rather than dropping the promise. + void Promise.resolve(disposable.dispose()).catch((error: unknown) => { + console.error("[extensions] Failed to dispose a bootstrap resource.", error); + }); + } return []; }; diff --git a/apps/desktop/src/journal/AddFieldRow.tsx b/apps/desktop/src/journal/AddFieldRow.tsx index ae0daea2..c1bd5367 100644 --- a/apps/desktop/src/journal/AddFieldRow.tsx +++ b/apps/desktop/src/journal/AddFieldRow.tsx @@ -50,16 +50,15 @@ export function AddFieldRow({ available, existingKeys, onAdd, readOnly = false } // Validity is the model's to decide; this only turns the code into words. const check = typed === "" ? null : validateFieldDefinition({ id: key, label: "x", type: "text" }); - const problem = - typed === "" || matched - ? null - : existingKeys.includes(key) - ? `"${key}" is already on this entry.` - : check?.definition - ? null - : check?.diagnostics[0]?.code === "journal_field_reserved" - ? `"${key}" is already used by the app itself. Try another name.` - : "Give this a name using letters or numbers."; + const problem = (() => { + if (typed === "" || matched) return null; + if (existingKeys.includes(key)) return `"${key}" is already on this entry.`; + if (check?.definition) return null; + if (check?.diagnostics[0]?.code === "journal_field_reserved") { + return `"${key}" is already used by the app itself. Try another name.`; + } + return "Give this a name using letters or numbers."; + })(); const add = (field: JournalFieldDefinition): void => { onAdd(field); @@ -88,7 +87,7 @@ export function AddFieldRow({ available, existingKeys, onAdd, readOnly = false } return (