Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
ci(deps): add a helper that services Dependabot uv bumps the way deps-sync checks them (#1144)
Ruben Lütke5f1ad6faa73a
diff --git a/.github/dependabot.yml b/.github/dependabot.ymlindex 7f7a7e9a6d..d81c8d2a81 100644--- a/.github/dependabot.yml+++ b/.github/dependabot.yml@@ -108,9 +108,9 @@ updates:## `open-pull-requests-limit: 0` disables VERSION updates only. Dependabot# SECURITY updates are configured separately in the repository settings and- # still fire, so advisories keep reaching the repo — they are then serviced by- # hand through the compile command above, which is also what the header of- # `requirements.in` instructs.+ # still fire, so advisories keep reaching the repo. Their requirements.txt is+ # never the gate's recompile, so service each one by resetting its branch onto+ # main and running `python scripts/ci/bump_locked_package.py NAME==VERSION`.- package-ecosystem: pipdirectory: /# New releases wait a week before a PR, so a hijacked publish isdiff --git a/scripts/ci/bump_locked_package.py b/scripts/ci/bump_locked_package.pynew file mode 100644index 0000000000..bc1a419183--- /dev/null+++ b/scripts/ci/bump_locked_package.py@@ -0,0 +1,62 @@+#!/usr/bin/env python3+"""Bump packages in ``uv.lock`` and ``requirements.txt`` the way CI checks them.++Dependabot's uv security updates rewrite ``requirements.txt`` from+``requirements.in`` without ``--emit-find-links`` and the pyproject header, so+the deps-sync gate (``check_portable_install_matrix.py``) rejects them as "not a+byte-identical no-upgrade universal/hash recompile". Service such a pull+request by resetting its branch onto ``main`` and running, from the repo root::++ python scripts/ci/bump_locked_package.py pypdf==6.21.4 [pyasn1==0.6.5 ...]++It upgrades only the named packages, using the gate's own uv flags and compile+command, then runs the gate's lock and recompile checks.+"""++from __future__ import annotations++import subprocess+import sys+from pathlib import Path++REPO_ROOT = Path(__file__).resolve().parents[2]+sys.path.insert(0, str(REPO_ROOT / "scripts" / "ci"))++import check_portable_install_matrix as matrix # noqa: E402+++def upgrade_flags(packages: list[str]) -> list[str]:+ flags: list[str] = []+ for package in packages:+ flags += ["--upgrade-package", package]+ return flags+++def main(argv: list[str] | None = None) -> int:+ packages = list(sys.argv[1:] if argv is None else argv)+ if not packages or any(p.startswith("-") for p in packages):+ print(__doc__)+ return 2+ error = matrix._verify_uv_version()+ if error:+ print(f"FAIL: {error}")+ return 1+ commands = (+ ["uv", "lock", *upgrade_flags(packages), *matrix._public_uv_flags()],+ matrix.requirements_compile_command(*upgrade_flags(packages)),+ )+ for command in commands:+ print("+", " ".join(command), flush=True)+ if subprocess.run(command, cwd=REPO_ROOT).returncode:+ return 1+ for check in (matrix._verify_uv_lock, matrix._verify_reproducible_requirements):+ error = check()+ if error:+ print(f"FAIL: {error}")+ return 1+ print("OK: uv.lock and requirements.txt match what the deps-sync gate expects.")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/scripts/ci/check_portable_install_matrix.py b/scripts/ci/check_portable_install_matrix.pyindex d1253ce4d6..6d63173371 100644--- a/scripts/ci/check_portable_install_matrix.py+++ b/scripts/ci/check_portable_install_matrix.py@@ -891,6 +891,31 @@ def _requirements_diff(expected: bytes, actual: bytes) -> str:return "\n".join(diff[:80]) or "files differ at the byte level"+def requirements_compile_command(*extra: str) -> list[str]:+ """Return the exact ``uv pip compile`` that produces ``requirements.txt``.++ Run from the repository root (or a copy holding ``pyproject.toml`` and+ ``packaging/native-crypto-uv.toml``). ``extra`` takes flags such as+ ``--upgrade-package NAME``; the gate itself passes none.+ """+ return [+ "uv",+ "pip",+ "compile",+ "--universal",+ "--generate-hashes",+ "--emit-find-links",+ "--python-version",+ "3.11",+ "--output-file=requirements.txt",+ "pyproject.toml",+ "--find-links",+ wheel_links_url(),+ *extra,+ *_public_uv_flags(),+ ]++def _verify_reproducible_requirements() -> str | None:with tempfile.TemporaryDirectory(prefix="jarvis-requirements-recompile-") as raw_dir:workspace = Path(raw_dir)@@ -904,24 +929,7 @@ def _verify_reproducible_requirements() -> str | None:# Seeding the output is load-bearing: without --upgrade, uv reuses these# exact pins and proves a no-upgrade maintenance recompile is stable.shutil.copyfile(REQUIREMENTS_TXT, generated)- result = _run_command(- [- "uv",- "pip",- "compile",- "--universal",- "--generate-hashes",- "--emit-find-links",- "--python-version",- "3.11",- "--output-file=requirements.txt",- "pyproject.toml",- "--find-links",- wheel_links_url(),- *_public_uv_flags(),- ],- cwd=workspace,- )+ result = _run_command(requirements_compile_command(), cwd=workspace)if result.returncode:return _command_failure("no-upgrade universal requirements recompile", result)expected = REQUIREMENTS_TXT.read_bytes()diff --git a/tests/unit/install/test_portable_install_matrix_gate.py b/tests/unit/install/test_portable_install_matrix_gate.pyindex bc8d35c4d3..d232c1f66b 100644--- a/tests/unit/install/test_portable_install_matrix_gate.py+++ b/tests/unit/install/test_portable_install_matrix_gate.py@@ -411,6 +411,35 @@ def test_requirements_recompile_is_no_upgrade_and_byte_compared(assert "not a byte-identical" in gate._verify_reproducible_requirements()+def test_bump_helper_reuses_the_gate_compile_command(+ gate, monkeypatch: pytest.MonkeyPatch+) -> None:+ spec = importlib.util.spec_from_file_location(+ "bump_locked_package", _ROOT / "scripts" / "ci" / "bump_locked_package.py"+ )+ assert spec is not None and spec.loader is not None+ helper = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(helper)+ commands: list[list[str]] = []++ def record(command: list[str], *, cwd: Path):+ del cwd+ commands.append(command)+ return gate.CommandResult(0)++ monkeypatch.setattr(helper.subprocess, "run", record)+ monkeypatch.setattr(helper.matrix, "_verify_uv_version", lambda: None)+ monkeypatch.setattr(helper.matrix, "_verify_uv_lock", lambda: None)+ monkeypatch.setattr(helper.matrix, "_verify_reproducible_requirements", lambda: None)+ assert helper.main(["pypdf==6.21.4"]) == 0+ upgrade = ["--upgrade-package", "pypdf==6.21.4"]+ assert commands[0][:2] == ["uv", "lock"] and upgrade[1] in commands[0]+ assert commands[1] == helper.matrix.requirements_compile_command(*upgrade)+ no_upgrade = gate.requirements_compile_command()+ assert [part for part in commands[1] if part not in upgrade] == no_upgrade+ assert helper.main([]) == 2++def test_mock_pylock_fixture_is_valid_toml() -> None:fixture = b"""lock-version = \"1.0\"\n[[packages]]\nname = \"example\"\nversion = \"1.0\"\n"""assert tomllib.loads(fixture.decode())["packages"][0]["name"] == "example"