From 1c6a80d3d5e7100f26141c287cafdb1122f31625 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Sat, 14 Nov 2026 21:43:21 +0000 Subject: [PATCH] ci(deps): make Renovate read the lock and look the hooks up without a token Dry run 3880 showed that since #124 Renovate proposed no bump at all: - pip-compile: the manager refused the lock's header ("Option --newline=LF not supported (yet)"), extracted nothing and only logged a WARN, so the Python tools were never bumped. Drop --newline from scripts/lock-requirements.sh and the lock header (the 81 entries and hashes are unchanged); the manager now reads 81 dependencies. The lock is an image input: ci 0.2.19 -> 0.2.20. - pre-commit: every hook was skipped (skipReason github-token-required, no GitHub token exists), and with the warning off the GitHub GraphQL lookup is refused at once (403 rate limit). Look the hooks up with git ls-remote (packageRule overrideDatasource git-tags, which needs RENOVATE_GITHUB_TOKEN_WARN=false because the token check runs before package rules apply). Renovate dereferences annotated tags, so the new rev is the commit (checked against git ls-remote for conventional-pre-commit v4.5.0). git-tags has no release timestamps, so hook bumps are not automerged. Tested with renovate@44.161.0 --platform=local against this checkout. Not tested: the real job (renovate.json is read from main), the lock replay by Renovate's pip-compile artifact step, and the ci 0.2.20 image build. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_014uGZTRacjtXvmKxHr5TM5G --- .gitea/workflows/image.yml | 2 +- .gitea/workflows/renovate.yml | 10 ++++++++-- CLAUDE.md | 8 ++++++++ renovate.json | 12 ++++++++++++ requirements-dev.lock | 2 +- scripts/lock-requirements.sh | 5 ++++- 6 files changed, 34 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/image.yml b/.gitea/workflows/image.yml index 9a19b1e..570e2d5 100644 --- a/.gitea/workflows/image.yml +++ b/.gitea/workflows/image.yml @@ -88,7 +88,7 @@ jobs: dockerfile: Dockerfile job_image: ubuntu:26.04@sha256:6a06111c3b0a8600feadb270aec771dc239bf407b25625f93f44ab00e11f4d3c - name: ci - version: 0.2.19 + version: 0.2.20 subpath: "" dockerfile: images/ci/Dockerfile job_image: ubuntu:26.04@sha256:6a06111c3b0a8600feadb270aec771dc239bf407b25625f93f44ab00e11f4d3c diff --git a/.gitea/workflows/renovate.yml b/.gitea/workflows/renovate.yml index 6514296..0b0f42a 100644 --- a/.gitea/workflows/renovate.yml +++ b/.gitea/workflows/renovate.yml @@ -6,8 +6,11 @@ name: Renovate # the repository secret RENOVATE_BOT_TOKEN (not an org secret: only image.yml may reference those). # The job token cannot be used: Renovate filters every pull request lookup by its own username, # which is the virtual user gitea-actions with the job token, and Gitea answers 400 "user does not -# exist" (dry run 2445). Unauthenticated GitHub lookups for the github.com pre-commit hooks may -# hit rate limits: best effort, no RENOVATE_GITHUB_COM_TOKEN exists. +# exist" (dry run 2445). No GitHub token exists (no RENOVATE_GITHUB_COM_TOKEN): the github-tags +# datasource then skips every pre-commit hook (skipReason github-token-required, dry run 3880), and +# unauthenticated GitHub API lookups are refused at once (403 rate limit). The hooks are looked up +# with git ls-remote instead (renovate.json, packageRule overrideDatasource git-tags), which needs +# RENOVATE_GITHUB_TOKEN_WARN=false below: the token check runs before package rules apply. # # Dry run: Actions > Renovate > Run workflow, dry_run=true (the default for a manual run), then # read the debug log. The schedule runs live. @@ -55,6 +58,9 @@ jobs: # Git auth: see the run block. The host the header is scoped to. GIT_HOST_URL: ${{ github.server_url }}/ RENOVATE_GIT_AUTHOR: "Renovate Bot " + # No GitHub token exists, and the hooks go through git-tags (see the header). Without this + # Renovate marks every github-tags dependency as skipped before the package rule applies. + RENOVATE_GITHUB_TOKEN_WARN: "false" # postUpgradeTasks may run exactly this one command (anchored, no wildcard); the JSON # string holds a regex, hence the doubled backslash. RENOVATE_ALLOWED_COMMANDS: '["^python3 scripts/bump_image_versions\\.py origin/main$"]' diff --git a/CLAUDE.md b/CLAUDE.md index fee3ece..8a756c7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -131,7 +131,15 @@ maintainer's production environment. Never reuse another Renovate credential her pip refuses an unhashed package and any disagreement between the two). Renovate's `pip-compile` manager bumps a pin and regenerates the lock by replaying the lock's header command; a weekly lock-file-maintenance PR moves transitive packages and is never automerged. By hand: `scripts/lock-requirements.sh [--upgrade]`. + The header must hold only options Renovate knows: it refuses `--newline=LF` ("not supported (yet)"), + extracts nothing, and proposes no bump, with only a WARN in an otherwise green run. Hook repositories in `.pre-commit-config.yaml` are pinned by commit SHA with a `# frozen: vX.Y.Z` comment. + Renovate looks them up with `git ls-remote` (packageRule `overrideDatasource: git-tags` plus + `RENOVATE_GITHUB_TOKEN_WARN=false` in `renovate.yml`), because there is no GitHub token and the default + `github-tags` lookup is skipped or rate limited. A hook bump is never automerged: `git-tags` has no release + timestamps, so `minimumReleaseAge` cannot delay it. After a Renovate config change, test it locally before + the merge: `renovate --platform=local` (same version as `renovate.yml`) reads this checkout; a dry run in + Actions reads `renovate.json` from `main`. - **Bot-diff gate:** `scripts/check_bot_pr_diff.py` runs in the lint workflow, from `origin/main`'s copy so a pull request cannot weaken it. A `renovate/` head ref may only change version lines (tool pins and their lock entries and hashes, hook `rev:` lines, Dockerfile FROM tags and digests, matrix `version:` lines, `job_image:` pins, consumer image pins); diff --git a/renovate.json b/renovate.json index fd96909..0080dc5 100644 --- a/renovate.json +++ b/renovate.json @@ -179,6 +179,18 @@ "git.rkdr.net/mortis/**" ], "automerge": true + }, + { + "description": "Look the pre-commit hook repositories up with git ls-remote (git-tags) instead of the GitHub API. This run has no GitHub token, and the github-tags datasource then either skips every hook (skipReason github-token-required, dry run 3880) or is refused at once with 403 rate limit (githubTokenWarn off, local run). git-tags needs no API and no credential, and it uses the dereferenced hash of an annotated tag, so the new rev is the commit, as pre-commit needs. The `# frozen:` form is kept by the manager's own replace template. It works only together with RENOVATE_GITHUB_TOKEN_WARN=false in renovate.yml: the token check runs after extraction and skips every github-tags dependency before a package rule can change its datasource (local run, Renovate 44.161.0). git-tags has no release timestamps, so minimumReleaseAge cannot delay a hook bump: hook bumps are never automerged, a person reviews each one.", + "matchManagers": [ + "pre-commit" + ], + "matchDatasources": [ + "github-tags" + ], + "overrideDatasource": "git-tags", + "overridePackageName": "https://github.com/{{{depName}}}", + "automerge": false } ], "lockFileMaintenance": { diff --git a/requirements-dev.lock b/requirements-dev.lock index ca43ad5..66d6016 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.13 # by the following command: # -# pip-compile --allow-unsafe --generate-hashes --newline=LF --output-file=requirements-dev.lock --strip-extras requirements-dev.txt +# pip-compile --allow-unsafe --generate-hashes --output-file=requirements-dev.lock --strip-extras requirements-dev.txt # aiofiles==25.1.0 \ --hash=sha256:a8d728f0a29de45dc521f18f07297428d56992a742f0cd2701ba86e44d23d5b2 \ diff --git a/scripts/lock-requirements.sh b/scripts/lock-requirements.sh index 2bde43d..30b7c62 100755 --- a/scripts/lock-requirements.sh +++ b/scripts/lock-requirements.sh @@ -18,6 +18,9 @@ # # Renovate runs the same command from the header of the lock (pip-compile manager, renovate.json), # so keep the header: do not add --no-header, and keep the flags below in step with renovate.json. +# Renovate's pip-compile manager refuses a header with an option it does not know ("Option +# --newline=LF not supported (yet)", dry run 3880): it then extracts nothing and proposes no bump. +# So no --newline here: pip-compile keeps the lock's own line endings (LF on Linux) by default. set -euo pipefail pip_version="25.2" @@ -44,6 +47,6 @@ trap 'rm -rf "$tmp"' EXIT cd "$root" # --allow-unsafe: setuptools is a dependency of a tool here, and pip refuses an unpinned # requirement in a file that carries hashes. -"$tmp/venv/bin/pip-compile" --quiet --generate-hashes --strip-extras --allow-unsafe --newline lf \ +"$tmp/venv/bin/pip-compile" --quiet --generate-hashes --strip-extras --allow-unsafe \ "${upgrade[@]}" --output-file requirements-dev.lock requirements-dev.txt echo "requirements-dev.lock regenerated; commit it with requirements-dev.txt."