From 0c9f3e50be7e0749a939db06b76ede7318ee4b52 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Tue, 24 Mar 2026 14:12:57 +0100 Subject: [PATCH 01/17] use `prek` for unified linting --- .github/dependabot.yml | 6 ++ .github/workflows/ci.yaml | 100 ++++++++++++------------------- .github/workflows/pr-format.yaml | 74 ----------------------- .pre-commit-config.yaml | 71 ++++++++++++++++++++++ 4 files changed, 114 insertions(+), 137 deletions(-) delete mode 100644 .github/workflows/pr-format.yaml create mode 100644 .pre-commit-config.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index dff1cb17a2c..4995153001e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -159,3 +159,9 @@ updates: semver-major-days: 30 semver-minor-days: 7 semver-patch-days: 3 + - package-ecosystem: pre-commit + directory: / + schedule: + interval: weekly + cooldown: + default-days: 7 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8def75a65d5..7b28396eb2c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -66,6 +66,9 @@ jobs: - name: check compilation without threading run: cargo check ${{ env.CARGO_ARGS }} + - run: cargo doc --locked + if: runner.os == 'Linux' + - name: check compilation without host_env (sandbox mode) run: | cargo check -p rustpython-vm --no-default-features --features compiler @@ -326,8 +329,13 @@ jobs: run: python -I scripts/whats_left.py ${{ env.CARGO_ARGS }} --features jit lint: - name: Lint Rust & Python code + name: Lint runs-on: ubuntu-latest + permissions: + contents: read + checks: write + pull-requests: write + security-events: write # for zizmor steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -337,53 +345,41 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - - name: Check for redundant test patches - run: python scripts/check_redundant_patches.py - - uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 with: - components: clippy toolchain: stable + components: rustfmt - - name: run clippy on wasm - run: cargo clippy --manifest-path=crates/wasm/Cargo.toml -- -Dwarnings - - - name: Ensure docs generate no warnings - run: cargo doc --locked + - uses: cargo-bins/cargo-binstall@113a77a4ce971c41332f2129c3d995df993cf746 # v1.17.8 - - name: Ensure Lib/_opcode_metadata is updated + - name: cargo shear run: | - python scripts/generate_opcode_metadata.py - if [ -n "$(git status --porcelain)" ]; then - exit 1 - fi + cargo binstall --no-confirm cargo-shear + cargo shear - - name: Install ruff - uses: astral-sh/ruff-action@4919ec5cf1f49eff0871dbcea0da843445b837e6 # v3.6.1 - with: - version: "0.15.5" - args: "--version" + - name: actionlint + uses: reviewdog/action-actionlint@0d952c597ef8459f634d7145b0b044a9699e5e43 # v1.71.0 - - run: ruff check --diff + - name: zizmor + uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2 - - run: ruff format --check + - name: Cache prek + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + path: ~/.cache/prek + key: prek-${{ hashFiles('.pre-commit-config.yaml') }} - - name: install prettier - run: | - yarn global add prettier - yarn global bin >> "$GITHUB_PATH" - - - name: check wasm code with prettier - # prettier doesn't handle ignore files very well: https://github.com/prettier/prettier/issues/8506 - run: cd wasm && git ls-files -z | xargs -0 prettier --check -u - # Keep cspell check as the last step. This is optional test. - - name: install extra dictionaries - run: npm install @cspell/dict-en_us @cspell/dict-cpp @cspell/dict-python @cspell/dict-rust @cspell/dict-win32 @cspell/dict-shell - - name: spell checker - uses: streetsidesoftware/cspell-action@v8 + - name: prek + uses: j178/prek-action@79f765515bd648eb4d6bb1b17277b7cb22cb6468 # v2.0.0 + with: + cache: false + + - name: reviewdog + if: failure() + uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # 1.24.0 with: - files: "**/*.rs" - incremental_files_only: true + tool_name: prek + fail_level: error miri: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} @@ -425,12 +421,16 @@ jobs: - uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 with: + components: clippy toolchain: stable - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 with: save-if: ${{ github.ref == 'refs/heads/main' }} + - name: cargo clippy + run: cargo clippy --manifest-path=crates/wasm/Cargo.toml -- -Dwarnings + - name: install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - name: install geckodriver @@ -520,29 +520,3 @@ jobs: run: wasmer run --dir "$(pwd)" target/wasm32-wasip1/release/rustpython.wasm -- "$(pwd)/extra_tests/snippets/stdlib_random.py" - name: run cpython unittest run: wasmer run --dir "$(pwd)" target/wasm32-wasip1/release/rustpython.wasm -- "$(pwd)/Lib/test/test_int.py" - - cargo-shear: - name: cargo shear - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - uses: cargo-bins/cargo-binstall@113a77a4ce971c41332f2129c3d995df993cf746 # v1.17.8 - - - run: cargo binstall --no-confirm cargo-shear - - - run: cargo shear - - security-lint: - runs-on: ubuntu-latest - permissions: - security-events: write - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - name: Run zizmor - uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2 diff --git a/.github/workflows/pr-format.yaml b/.github/workflows/pr-format.yaml deleted file mode 100644 index 48e19f5dd5f..00000000000 --- a/.github/workflows/pr-format.yaml +++ /dev/null @@ -1,74 +0,0 @@ -name: Format Check - -# This workflow triggers when a PR is opened/updated -# Posts inline suggestion comments instead of auto-committing -on: - pull_request: - types: [opened, synchronize, reopened] - branches: - - main - - release - -concurrency: - group: format-check-${{ github.event.pull_request.number }} - cancel-in-progress: true - -env: - PYTHON_VERSION: "3.14.3" - -jobs: - format_check: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - uses: reviewdog/action-actionlint@0d952c597ef8459f634d7145b0b044a9699e5e43 # v1.71.0 - - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt - - - name: Run cargo fmt - run: cargo fmt --all - - - name: Install ruff - uses: astral-sh/ruff-action@4919ec5cf1f49eff0871dbcea0da843445b837e6 # v3.6.1 - with: - version: "0.15.4" - args: "--version" - - - name: Run ruff format - run: ruff format - - - name: Run ruff check import sorting - run: ruff check --select I --fix - - - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Run generate_opcode_metadata.py - run: python scripts/generate_opcode_metadata.py - - - name: Check for formatting changes - run: | - if ! git diff --exit-code; then - echo "::error::Formatting changes detected. Please run 'cargo fmt --all', 'ruff format', and 'ruff check --select I --fix' locally." - exit 1 - fi - - - name: Post formatting suggestions - if: failure() - uses: reviewdog/action-suggester@v1 - with: - tool_name: auto-format - github_token: ${{ secrets.GITHUB_TOKEN }} - level: warning - filter_mode: diff_context diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..69706da972c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,71 @@ +# NOTE: Reason for not using `prek.toml` is dependabot supports `pre-commit` as an ecosystem +# See: https://github.blog/changelog/2026-03-10-dependabot-now-supports-pre-commit-hooks/ + +fail_fast: false +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-merge-conflict + priority: 0 + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.7 + hooks: + - id: ruff-format + priority: 0 + + - id: ruff-check + args: [--select, I, --fix, --exit-non-zero-on-fix] + types_or: [python] + require_serial: true + priority: 1 + + - repo: local + hooks: + - id: redundant-test-patches + name: Ensure no redundant test patches + entry: python scripts/check_redundant_patches.py + language: system + pass_filenames: false + types_or: [python] + priority: 0 + + - repo: local + hooks: + - id: rustfmt + name: rustfmt + entry: cargo fmt --all + language: system + types: [rust] + pass_filenames: false + priority: 0 + + - id: generate-opcode-metadata + name: Generate opcode metadata + entry: python scripts/generate_opcode_metadata.py + pass_filenames: false + language: system + require_serial: true # so rustfmt runs first + priority: 1 + + - repo: https://github.com/streetsidesoftware/cspell-cli + rev: v9.7.0 + hooks: + - id: cspell + types: [rust] + additional_dependencies: + - '@cspell/dict-en_us' + - '@cspell/dict-cpp' + - '@cspell/dict-python' + - '@cspell/dict-rust' + - '@cspell/dict-win32' + - '@cspell/dict-shell' + priority: 0 + + - repo: https://github.com/rbubley/mirrors-prettier + rev: v3.8.1 + hooks: + - id: prettier + files: '^wasm/.*$' + priority: 0 From 72fd63269cf4a7ab921f0d176cedb1301b39588e Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:15:13 +0100 Subject: [PATCH 02/17] Fix actionlint error --- .github/workflows/ci.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7b28396eb2c..052f2735a3a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -363,17 +363,25 @@ jobs: - name: zizmor uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2 - - name: Cache prek - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + - name: restore prek cache + if: ${{ github.ref != 'refs/heads/main' }} # never restore on main + uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 with: - path: ~/.cache/prek key: prek-${{ hashFiles('.pre-commit-config.yaml') }} + path: ~/.cache/prek - name: prek uses: j178/prek-action@79f765515bd648eb4d6bb1b17277b7cb22cb6468 # v2.0.0 with: cache: false + - name: save prek cache + if: ${{ github.ref == 'refs/heads/main' }} # only save on main + uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + key: prek-${{ hashFiles('.pre-commit-config.yaml') }} + path: ~/.cache/prek + - name: reviewdog if: failure() uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # 1.24.0 From 149cc38ffec3a6b3b87fa3a19605581eb42e1a2d Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:46:27 +0100 Subject: [PATCH 03/17] Generate metadata when specific files change --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69706da972c..fa0137bf310 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,6 +44,7 @@ repos: - id: generate-opcode-metadata name: Generate opcode metadata entry: python scripts/generate_opcode_metadata.py + files: '^(crates/compiler-core/src/bytecode/instruction\.rs|scripts/generate_opcode_metadata\.py)$' pass_filenames: false language: system require_serial: true # so rustfmt runs first From e09cf9ed4257c4f2f3192ca0119c39d7af89a328 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Wed, 25 Mar 2026 19:19:15 +0100 Subject: [PATCH 04/17] `check_redundant_patches.py` to accept glob path --- .github/workflows/ci.yaml | 1 + .pre-commit-config.yaml | 12 +++---- scripts/check_redundant_patches.py | 56 +++++++++++++++++++++++++----- 3 files changed, 55 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 052f2735a3a..6094f695509 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -374,6 +374,7 @@ jobs: uses: j178/prek-action@79f765515bd648eb4d6bb1b17277b7cb22cb6468 # v2.0.0 with: cache: false + show-verbose-logs: false - name: save prek cache if: ${{ github.ref == 'refs/heads/main' }} # only save on main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa0137bf310..35c1528f4ad 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,11 +24,11 @@ repos: - repo: local hooks: - id: redundant-test-patches - name: Ensure no redundant test patches - entry: python scripts/check_redundant_patches.py - language: system - pass_filenames: false - types_or: [python] + name: check redundant test patches + entry: scripts/check_redundant_patches.py + files: '^Lib/test/.*\.py$' + language: script + types: [python] priority: 0 - repo: local @@ -42,7 +42,7 @@ repos: priority: 0 - id: generate-opcode-metadata - name: Generate opcode metadata + name: generate opcode metadata entry: python scripts/generate_opcode_metadata.py files: '^(crates/compiler-core/src/bytecode/instruction\.rs|scripts/generate_opcode_metadata\.py)$' pass_filenames: false diff --git a/scripts/check_redundant_patches.py b/scripts/check_redundant_patches.py index 25cd2e1229e..4bc89a573d4 100644 --- a/scripts/check_redundant_patches.py +++ b/scripts/check_redundant_patches.py @@ -1,15 +1,46 @@ #!/usr/bin/env python +import argparse import ast +import glob +import os import pathlib import sys ROOT = pathlib.Path(__file__).parents[1] TEST_DIR = ROOT / "Lib" / "test" +IS_GH_CI = "GITHUB_ACTIONS" in os.environ -def main(): + +def build_argparser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser(prog="check_redundant_patches") + parser.add_argument( + "patterns", + nargs="*", + default=[f"{TEST_DIR}/**/*.py"], + help="Glob patterns (e.g. foo/bar/**.py a/b/file.py)", + ) + + return parser + + +def iter_files(patterns: list[str]): + seen = set() + for pattern in set(patterns): + matches = glob.glob(pattern, recursive=True) + for path in matches: + if path in seen: + continue + seen.add(path) + yield path + + +def main(patterns: list[str]): exit_status = 0 - for file in TEST_DIR.rglob("**/*.py"): + for file in map(pathlib.Path, iter_files(patterns)): + if file.is_dir(): + continue + try: contents = file.read_text(encoding="utf-8") except UnicodeDecodeError: @@ -20,7 +51,11 @@ def main(): except SyntaxError: continue + cls_name = None for node in ast.walk(tree): + if isinstance(node, ast.ClassDef): + cls_name = node.name + if not isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)): continue @@ -39,14 +74,19 @@ def main(): f"super().{name}()", ): exit_status += 1 - rel = file.relative_to(ROOT) + lineno = node.lineno - print( - f"{rel}:{name}:{lineno} is a test patch that can be safely removed", - file=sys.stderr, - ) + msg = f"{file}:{lineno}:{cls_name}.{name} is a test patch that can be safely removed" + if IS_GH_CI: + end_lineno = node.end_lineno + msg = f"::error file={file},line={lineno},endLine={end_lineno},title=Redundant Test Patch::{msg}" + + print(msg, file=sys.stderr) + return exit_status if __name__ == "__main__": - exit(main()) + parser = build_argparser() + args = parser.parse_args() + exit(main(args.patterns)) From 15b06c2445f37004c7ab656299ef56b56b873a4b Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Wed, 25 Mar 2026 19:19:37 +0100 Subject: [PATCH 05/17] Test --- Lib/test/test_operator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py index 1f89986c777..a7fc72fb641 100644 --- a/Lib/test/test_operator.py +++ b/Lib/test/test_operator.py @@ -132,6 +132,9 @@ def test_gt(self): self.assertFalse(operator.gt(1, 2)) self.assertFalse(operator.gt(1, 2.0)) + def test_a(): + return super().test_a() + def test_abs(self): operator = self.module self.assertRaises(TypeError, operator.abs) From 59a7d2c7dc30e3deaf7b646692eb3a3ae2434e6f Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Wed, 25 Mar 2026 21:15:41 +0100 Subject: [PATCH 06/17] revert defective changes --- Lib/test/test_operator.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py index a7fc72fb641..1f89986c777 100644 --- a/Lib/test/test_operator.py +++ b/Lib/test/test_operator.py @@ -132,9 +132,6 @@ def test_gt(self): self.assertFalse(operator.gt(1, 2)) self.assertFalse(operator.gt(1, 2.0)) - def test_a(): - return super().test_a() - def test_abs(self): operator = self.module self.assertRaises(TypeError, operator.abs) From b39ab517bfa2f32e1ba5a74c1a31523d265bbcad Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 04:32:12 +0100 Subject: [PATCH 07/17] use `rustfmt` over `cargo fmt` for individual files --- .pre-commit-config.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 35c1528f4ad..7a8faf732a5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,10 +35,9 @@ repos: hooks: - id: rustfmt name: rustfmt - entry: cargo fmt --all + entry: rustfmt language: system types: [rust] - pass_filenames: false priority: 0 - id: generate-opcode-metadata From c7be0d6285a4a2680f6477e4785e534aaab61660 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 05:15:18 +0100 Subject: [PATCH 08/17] debug reviewdog --- .github/workflows/ci.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6094f695509..42ac91049bf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -371,10 +371,12 @@ jobs: path: ~/.cache/prek - name: prek + id: prek uses: j178/prek-action@79f765515bd648eb4d6bb1b17277b7cb22cb6468 # v2.0.0 with: cache: false show-verbose-logs: false + continue-on-error: true - name: save prek cache if: ${{ github.ref == 'refs/heads/main' }} # only save on main @@ -384,11 +386,14 @@ jobs: path: ~/.cache/prek - name: reviewdog - if: failure() uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # 1.24.0 with: - tool_name: prek - fail_level: error + fail_level: none + cleanup: false + + - name: fail + if: ${{ steps.prek.outcome == 'failure' }} + run: exit 1 miri: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} From 4c3b303610cf4a628429c296199e99ca218aba43 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 05:19:20 +0100 Subject: [PATCH 09/17] rustfmt --- .../wasm32_without_js/rustpython-without-js/src/lib.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs b/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs index a152ebe1c4a..382daebb04e 100644 --- a/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs +++ b/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs @@ -1,4 +1,4 @@ -use rustpython_vm::{Interpreter}; +use rustpython_vm::Interpreter; unsafe extern "C" { fn kv_get(kp: i32, kl: i32, vp: i32, vl: i32) -> i32; @@ -37,12 +37,7 @@ pub unsafe extern "C" fn eval(s: *const u8, l: usize) -> i32 { let msg = format!("eval result: {result}"); - unsafe { - print( - msg.as_str().as_ptr() as usize as i32, - msg.len() as i32, - ) - }; + unsafe { print(msg.as_str().as_ptr() as usize as i32, msg.len() as i32) }; 0 } From 3adf4980b9f002fbb27819560cdd723e3d8c196e Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 05:30:07 +0100 Subject: [PATCH 10/17] Move comment to correct location --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a8faf732a5..00a0a194b87 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,8 +46,8 @@ repos: files: '^(crates/compiler-core/src/bytecode/instruction\.rs|scripts/generate_opcode_metadata\.py)$' pass_filenames: false language: system - require_serial: true # so rustfmt runs first - priority: 1 + require_serial: true + priority: 1 # so rustfmt runs first - repo: https://github.com/streetsidesoftware/cspell-cli rev: v9.7.0 From 855eca10585923a3df87a5fd66426f4ebdd069cb Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 05:31:00 +0100 Subject: [PATCH 11/17] defevtive fmt test --- .../wasm32_without_js/rustpython-without-js/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs b/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs index 382daebb04e..baa989dfa85 100644 --- a/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs +++ b/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs @@ -21,7 +21,7 @@ pub unsafe extern "C" fn eval(s: *const u8, l: usize) -> i32 { let result = interpreter.enter(|vm| { let scope = vm.new_scope_with_builtins(); let res = match vm.run_block_expr(scope, src) { - Ok(val) => val, + Ok(val) => val, Err(_) => return Err(-1), // Python execution error }; let repr_str = match res.repr(vm) { From 15bdf1f92987981e7cd93cf3afb47bb566d36576 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 05:52:15 +0100 Subject: [PATCH 12/17] Fail with reviewdog --- .github/workflows/ci.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 42ac91049bf..37903294426 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -388,13 +388,10 @@ jobs: - name: reviewdog uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # 1.24.0 with: - fail_level: none + level: warning + fail_level: error cleanup: false - - name: fail - if: ${{ steps.prek.outcome == 'failure' }} - run: exit 1 - miri: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} name: Run tests under miri From cefe51ff4a7425b24d785bdd4c6dc77f03da0ca7 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 05:57:58 +0100 Subject: [PATCH 13/17] fix reviewdog perms --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 37903294426..7d1ed1ee5ed 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -334,6 +334,7 @@ jobs: permissions: contents: read checks: write + issues: write pull-requests: write security-events: write # for zizmor steps: @@ -391,6 +392,7 @@ jobs: level: warning fail_level: error cleanup: false + github_token: ${{ github.token }} miri: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} From ae898da0ebdd542c6241bd0f0373bb555ccf2ad2 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 06:01:11 +0100 Subject: [PATCH 14/17] Try to use present token --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7d1ed1ee5ed..3692539413a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -392,7 +392,7 @@ jobs: level: warning fail_level: error cleanup: false - github_token: ${{ github.token }} + github_token: ${{ secrets.GITHUB_TOKEN }} miri: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} From 88028e653fc0793f3583816798818f1260ccfa11 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 06:08:40 +0100 Subject: [PATCH 15/17] without checks oerms --- .github/workflows/ci.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3692539413a..d8d09e6d64c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -333,8 +333,8 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - checks: write - issues: write + # checks: write + # issues: write pull-requests: write security-events: write # for zizmor steps: @@ -392,7 +392,6 @@ jobs: level: warning fail_level: error cleanup: false - github_token: ${{ secrets.GITHUB_TOKEN }} miri: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} From 0d52e5e0cc85670b8bf48ab8ba0e2a9a8273f53b Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 06:13:21 +0100 Subject: [PATCH 16/17] put normal perms --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d8d09e6d64c..37903294426 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -333,8 +333,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - # checks: write - # issues: write + checks: write pull-requests: write security-events: write # for zizmor steps: From eefe09351c4e43cc59370bf8f13ee8e8b7d16aa4 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 26 Mar 2026 06:16:34 +0100 Subject: [PATCH 17/17] fmt --- .../wasm32_without_js/rustpython-without-js/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs b/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs index baa989dfa85..382daebb04e 100644 --- a/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs +++ b/example_projects/wasm32_without_js/rustpython-without-js/src/lib.rs @@ -21,7 +21,7 @@ pub unsafe extern "C" fn eval(s: *const u8, l: usize) -> i32 { let result = interpreter.enter(|vm| { let scope = vm.new_scope_with_builtins(); let res = match vm.run_block_expr(scope, src) { - Ok(val) => val, + Ok(val) => val, Err(_) => return Err(-1), // Python execution error }; let repr_str = match res.repr(vm) {