diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index 19b81f69a..a00a4cdf7 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -56,6 +56,9 @@ workflows: - 'actions/checkout@v4.4.0' - 'actions/download-artifact@v4.3.0' - 'tuna-os/.github@main' + '.github/workflows/ratchet.yaml': + - 'actions/checkout@v4.4.0' + - 'tuna-os/.github@8ecf20e5800fd80bde03d572ab1e3bbcb5b2cf17' '.github/workflows/release.yml': - 'actions/checkout@v4.4.0' - 'actions/download-artifact@v4.3.0' @@ -181,6 +184,11 @@ dependencies: commit: 'sha1-83ac0ad63c0167e6f06796fab0fce28db1bf3db0' owner_id: 43724913 repo_id: 442947557 + 'tuna-os/.github@8ecf20e5800fd80bde03d572ab1e3bbcb5b2cf17': + ref: 'main' + commit: 'sha1-8ecf20e5800fd80bde03d572ab1e3bbcb5b2cf17' + owner_id: 223733964 + repo_id: 1187761922 'tuna-os/.github@main': ref: 'main' commit: 'sha1-4078f531ac74703f203bde835ef6c25e9321b97b' diff --git a/.github/workflows/ratchet.yaml b/.github/workflows/ratchet.yaml new file mode 100644 index 000000000..1495ce713 --- /dev/null +++ b/.github/workflows/ratchet.yaml @@ -0,0 +1,39 @@ +name: Ratchet + +# Counted metrics held at a budget that only goes down: .unwrap(), .expect(, oversized modules and undated cargo-deny ignores. +# Budgets and patterns live in .ratchet.toml; the checker is the shared +# count-ratchet action in tuna-os/.github, so the rules cannot drift between +# repos. +# +# count > budget fails: remove what the change added. +# count < budget fails: write the new, lower budget (the error names it), +# so an improvement stays locked in. +# budget raised fails on a pull request unless it has the +# `ratchet-raise` label (labeled/unlabeled re-run it). + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + ratchet: + name: Ratchet + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4.4.0 + with: + persist-credentials: false + # The raise check fetches origin/ itself (depth 1), so the + # checkout stays shallow. + - uses: tuna-os/.github/.github/actions/count-ratchet@8ecf20e5800fd80bde03d572ab1e3bbcb5b2cf17 # main # zizmor: ignore[ref-version-mismatch] pinned to a reviewed main commit; Renovate bumps the digest, so main may be ahead diff --git a/.ratchet.toml b/.ratchet.toml new file mode 100644 index 000000000..ec976c1f1 --- /dev/null +++ b/.ratchet.toml @@ -0,0 +1,42 @@ +# Counted metrics that only go down. Checked by .github/workflows/ratchet.yml +# with tuna-os/.github's count-ratchet action (see its README for the format). +# +# A count over budget fails. A count under budget also fails, with the new +# number to write here, so an improvement stays locked in. Raising a budget +# needs the `ratchet-raise` label on the pull request. +# +# Local count: python3 /.github/actions/count-ratchet/ratchet.py check +# Seeded 2026-11-20 from main. + +# Non-test Rust under crates/: test directories, *_test.rs files and +# #[cfg(test)] / #[cfg(all(test, ...))] modules are out of scope. +[defaults] +include = ["crates/**/*.rs"] +exclude = [ + "**/tests/**", "**/benches/**", "**/examples/**", "**/fuzz/**", + "**/*_test.rs", "**/*_tests.rs", "**/tests.rs", "**/test_*.rs", +] +exclude-rust-tests = true + +[metrics.unwrap] +description = ".unwrap() in non-test Rust" +pattern = '\.unwrap\(\)' +budget = 6 + +[metrics.expect] +description = ".expect( in non-test Rust" +pattern = '\.expect\(' +budget = 70 + +# scripts/architecture/module-size.py (#330): Rust files over the 1500-line +# limit that are not in scripts/architecture/allowlist.txt. The script still +# prints the per-file warnings; this holds their number. +[metrics.oversized-modules] +description = "Rust files over 1500 lines and not allowlisted" +command = "python3 scripts/architecture/module-size.py | sed -nE 's/.* scanned, ([0-9]+) over .*/\\1/p'" +budget = 4 + +[metrics.deny-undated] +description = "deny.toml advisory ignores without a dated reason ('; review by YYYY-MM-DD')" +command = 'python3 "$RATCHET_ACTION_PATH/checks/deny_review_dates.py" deny.toml' +budget = 0 diff --git a/deny.toml b/deny.toml index 6352d2e22..ca0dfca34 100644 --- a/deny.toml +++ b/deny.toml @@ -23,28 +23,28 @@ ignore = [ # ttf-parser: used directly by compass and by Iced's text stack (fontdb, # cosmic-text). Goes when Iced moves to skrifa. # https://rustsec.org/advisories/RUSTSEC-2026-0192 - { id = "RUSTSEC-2026-0192", reason = "unmaintained ttf-parser via Iced 0.14's fontdb/cosmic-text; no fix until Iced moves to skrifa" }, + { id = "RUSTSEC-2026-0192", reason = "unmaintained ttf-parser via Iced 0.14's fontdb/cosmic-text; no fix until Iced moves to skrifa; review by 2027-01-01" }, # rustybuzz: through usvg 0.45, which resvg 0.45 and iced_tiny_skia 0.14 pin. # https://rustsec.org/advisories/RUSTSEC-2026-0206 - { id = "RUSTSEC-2026-0206", reason = "unmaintained rustybuzz via usvg 0.45, pinned by iced_tiny_skia 0.14" }, + { id = "RUSTSEC-2026-0206", reason = "unmaintained rustybuzz via usvg 0.45, pinned by iced_tiny_skia 0.14; review by 2027-01-01" }, # bincode 1 and yaml-rust: through syntect 5.3 (latest), from two-face and # iced_highlighter 0.14. They load syntect's bundled syntax dumps. # https://rustsec.org/advisories/RUSTSEC-2025-0141 # https://rustsec.org/advisories/RUSTSEC-2024-0320 - { id = "RUSTSEC-2025-0141", reason = "unmaintained bincode 1 via syntect 5.3 (latest) from iced_highlighter 0.14" }, - { id = "RUSTSEC-2024-0320", reason = "unmaintained yaml-rust via syntect 5.3 (latest) from iced_highlighter 0.14" }, + { id = "RUSTSEC-2025-0141", reason = "unmaintained bincode 1 via syntect 5.3 (latest) from iced_highlighter 0.14; review by 2027-01-01" }, + { id = "RUSTSEC-2024-0320", reason = "unmaintained yaml-rust via syntect 5.3 (latest) from iced_highlighter 0.14; review by 2027-01-01" }, # smartstring: through rhai 1.26.1 (latest), for compass-script. # https://rustsec.org/advisories/RUSTSEC-2026-0249 - { id = "RUSTSEC-2026-0249", reason = "unmaintained smartstring via rhai 1.26.1 (latest), compass-script's engine" }, + { id = "RUSTSEC-2026-0249", reason = "unmaintained smartstring via rhai 1.26.1 (latest), compass-script's engine; review by 2027-01-01" }, # zvariant, zvariant_derive and zbus_names: folded into zbus 6. zbus 5 is the # workspace's D-Bus stack and what ashpd, ksni, mundy, notify-rust, oo7 and # system-tray all build on, so these go when that set moves to zbus 6. # https://rustsec.org/advisories/RUSTSEC-2026-0370 # https://rustsec.org/advisories/RUSTSEC-2026-0371 # https://rustsec.org/advisories/RUSTSEC-2026-0372 - { id = "RUSTSEC-2026-0370", reason = "unmaintained zvariant 5, merged into zbus 6; zbus 5 is pinned by ashpd, ksni, mundy, notify-rust, oo7 and system-tray" }, - { id = "RUSTSEC-2026-0371", reason = "unmaintained zbus_names 4, merged into zbus 6; zbus 5 is pinned by ashpd, ksni, mundy, notify-rust, oo7 and system-tray" }, - { id = "RUSTSEC-2026-0372", reason = "unmaintained zvariant_derive 5, merged into zbus 6; zbus 5 is pinned by ashpd, ksni, mundy, notify-rust, oo7 and system-tray" }, + { id = "RUSTSEC-2026-0370", reason = "unmaintained zvariant 5, merged into zbus 6; zbus 5 is pinned by ashpd, ksni, mundy, notify-rust, oo7 and system-tray; review by 2027-01-01" }, + { id = "RUSTSEC-2026-0371", reason = "unmaintained zbus_names 4, merged into zbus 6; zbus 5 is pinned by ashpd, ksni, mundy, notify-rust, oo7 and system-tray; review by 2027-01-01" }, + { id = "RUSTSEC-2026-0372", reason = "unmaintained zvariant_derive 5, merged into zbus 6; zbus 5 is pinned by ashpd, ksni, mundy, notify-rust, oo7 and system-tray; review by 2027-01-01" }, ] [bans]