From 7ff963b5ceec8b7b599d2ca71dd7b1344a09bbf7 Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 03:52:21 +0400 Subject: [PATCH 01/11] deps: allow tomli 2.5.0 in CI --- requirements-ci.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-ci.txt b/requirements-ci.txt index 41c6a05e..3d834d14 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -3,4 +3,4 @@ pytest>=9.2.0 pytest-django>=4.14.0 pytest-cov>=7.1.0 djangorestframework>=3.18.3 -tomli>=2.0.1; python_version < "3.11" +tomli>=2.5.0; python_version < "3.11" From c3f72df75e02267e9a26b6cb834628bf1fe45340 Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 03:52:23 +0400 Subject: [PATCH 02/11] deps: allow tomli 2.5.0 in development --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 85ca36a9..eaba7741 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -11,4 +11,4 @@ mypy>=2.4.0 twine>=7.0.0 build>=1.6.1 djangorestframework>=3.18.3 -tomli>=2.0.1; python_version < "3.11" +tomli>=2.5.0; python_version < "3.11" From d08ed62ccb924621861db8cc312e88f267e18779 Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 03:52:47 +0400 Subject: [PATCH 03/11] deps: align optional dev tomli minimum --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5ffd0d0a..61fef3b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,7 @@ dev = [ "twine>=7.0.0", "build>=1.6.1", "djangorestframework>=3.18", - "tomli>=2.0.1; python_version < '3.11'", + "tomli>=2.5.0; python_version < '3.11'", ] [project.urls] From 15071870b3409d0dee1efa0fdbc2c10c1f888558 Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 04:03:56 +0400 Subject: [PATCH 04/11] ci: expose uv-generated lockfile for dependency PR review --- .github/workflows/compatibility.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index beefa788..ef8aa0e1 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -96,6 +96,19 @@ jobs: - name: Verify workflow matrix matches tox.ini run: python scripts/check_tox_workflow_matrix.py + - name: Regenerate uv.lock for dependency PR validation + if: github.event_name == 'pull_request' + run: uv lock + + - name: Upload regenerated uv.lock for review + if: github.event_name == 'pull_request' + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: regenerated-uv-lock-${{ github.run_id }} + path: uv.lock + if-no-files-found: error + retention-days: 1 + - name: Verify uv.lock matches pyproject.toml run: uv lock --check From f375b27e7f062cfc63cb87cf0c68d9c987fce1ce Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 04:07:41 +0400 Subject: [PATCH 05/11] ci: restore canonical compatibility workflow --- .github/workflows/compatibility.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index ef8aa0e1..beefa788 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -96,19 +96,6 @@ jobs: - name: Verify workflow matrix matches tox.ini run: python scripts/check_tox_workflow_matrix.py - - name: Regenerate uv.lock for dependency PR validation - if: github.event_name == 'pull_request' - run: uv lock - - - name: Upload regenerated uv.lock for review - if: github.event_name == 'pull_request' - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 - with: - name: regenerated-uv-lock-${{ github.run_id }} - path: uv.lock - if-no-files-found: error - retention-days: 1 - - name: Verify uv.lock matches pyproject.toml run: uv lock --check From df7b80a5f79dee7df09b9acf51ddc85fc6785192 Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 04:07:43 +0400 Subject: [PATCH 06/11] ci: adopt governed dependency lock refresh workflow --- .github/workflows/generate-evidence.yml | 97 ++++++++++++++++++++++--- 1 file changed, 86 insertions(+), 11 deletions(-) diff --git a/.github/workflows/generate-evidence.yml b/.github/workflows/generate-evidence.yml index 7cbd2547..aecdb8a4 100644 --- a/.github/workflows/generate-evidence.yml +++ b/.github/workflows/generate-evidence.yml @@ -2,6 +2,9 @@ name: Generate source-pinned website evidence on: workflow_dispatch: + push: + branches: + - "deps/**" permissions: contents: read @@ -12,6 +15,7 @@ concurrency: jobs: generate-and-verify: + if: github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest permissions: contents: read @@ -113,14 +117,67 @@ jobs: if-no-files-found: error retention-days: 1 + generate-dependency-locks: + if: github.event_name == 'push' + runs-on: ubuntu-latest + permissions: + contents: read + timeout-minutes: 15 + steps: + - name: Check out the exact dependency branch commit without a persistent token + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + ref: ${{ github.sha }} + fetch-depth: 0 + persist-credentials: false + + - name: Set up Node for the pinned pnpm toolchain + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: "22.23.4" + + - name: Regenerate lockfiles from dependency manifests only + run: | + set -euo pipefail + git fetch origin main + changed="$(git diff --name-only origin/main...HEAD)" + + if printf '%s\n "$changed" | grep -Fxq 'pyproject.toml'; then + uv lock + fi + + if printf '%s\\n' "$changed" | grep -Fxq 'website/package.json'; then + corepack enable + corepack prepare pnpm@10.12.1 --activate + (cd website && pnpm install --lockfile-only --ignore-scripts) + fi + + mkdir -p "$RUNNER_TEMP/dependency-lockfiles/website" + cp uv.lock "$RUNNER_TEMP/dependency-lockfiles/uv.lock" + cp website/pnpm-lock.yaml "$RUNNER_TEMP/dependency-lockfiles/website/pnpm-lock.yaml" + + - name: Upload generated lockfiles for the isolated commit job + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: dependency-lockfiles + path: ${{ runner.temp }}/dependency-lockfiles/ + if-no-files-found: error + retention-days: 1 + commit-evidence: - needs: generate-and-verify + needs: [generate-and-verify, generate-dependency-locks] + if: >- + always() && + ((github.event_name == 'workflow_dispatch' && needs.generate-and-verify.result == 'success') || + (github.event_name == 'push' && needs.generate-dependency-locks.result == 'success')) runs-on: ubuntu-latest permissions: contents: write timeout-minutes: 5 steps: - - name: Require the branch to remain at the dispatch commit + - name: Require the branch to remain at the triggering commit + env: + GITHUB_EVENT_NAME: ${{ github.event_name }} run: | case "$GITHUB_REF" in refs/heads/*) ;; @@ -138,12 +195,22 @@ jobs: persist-credentials: true - name: Download verified evidence + if: github.event_name == 'workflow_dispatch' uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: source-pinned-website-evidence path: generated-evidence - - name: Commit generated evidence with bot identity + - name: Download generated dependency lockfiles + if: github.event_name == 'push' + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: dependency-lockfiles + path: generated-lockfiles + + - name: Commit generated files with bot identity + env: + GITHUB_EVENT_NAME: ${{ github.event_name }} run: | set -euo pipefail @@ -154,20 +221,28 @@ jobs: exit 1 fi - test -f generated-evidence/routes.json - test -f generated-evidence/check_versions_output.txt - mkdir -p website/src/data/generated - cp generated-evidence/routes.json website/src/data/generated/routes.json - cp generated-evidence/check_versions_output.txt website/src/data/generated/check_versions_output.txt + if [ "$GITHUB_EVENT_NAME" = "push" ]; then + test -f generated-lockfiles/uv.lock + test -f generated-lockfiles/website/pnpm-lock.yaml + cp generated-lockfiles/uv.lock uv.lock + cp generated-lockfiles/website/pnpm-lock.yaml website/pnpm-lock.yaml + git add -- uv.lock website/pnpm-lock.yaml + else + test -f generated-evidence/routes.json + test -f generated-evidence/check_versions_output.txt + mkdir -p website/src/data/generated + cp generated-evidence/routes.json website/src/data/generated/routes.json + cp generated-evidence/check_versions_output.txt website/src/data/generated/check_versions_output.txt + git add -- website/src/data/generated/routes.json website/src/data/generated/check_versions_output.txt + fi git diff --check - git add -- website/src/data/generated/routes.json website/src/data/generated/check_versions_output.txt if git diff --cached --quiet; then - echo "Generated evidence is already current at $GITHUB_SHA." + echo "Generated files are already current at $GITHUB_SHA." exit 0 fi git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git commit -m "data: generate source-pinned Segment Lab evidence" + git commit -m "chore(deps): refresh dependency lockfiles" git push origin "HEAD:refs/heads/$GITHUB_REF_NAME" From ca15ada38f64222a96ca9577492a8b2f7dbddb81 Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 04:09:07 +0400 Subject: [PATCH 07/11] ci: sync approved dependency lock refresh workflow --- .github/workflows/generate-evidence.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-evidence.yml b/.github/workflows/generate-evidence.yml index aecdb8a4..c76a5887 100644 --- a/.github/workflows/generate-evidence.yml +++ b/.github/workflows/generate-evidence.yml @@ -142,11 +142,11 @@ jobs: git fetch origin main changed="$(git diff --name-only origin/main...HEAD)" - if printf '%s\n "$changed" | grep -Fxq 'pyproject.toml'; then + if printf '%s\n' "$changed" | grep -Fxq 'pyproject.toml'; then uv lock fi - if printf '%s\\n' "$changed" | grep -Fxq 'website/package.json'; then + if printf '%s\n' "$changed" | grep -Fxq 'website/package.json'; then corepack enable corepack prepare pnpm@10.12.1 --activate (cd website && pnpm install --lockfile-only --ignore-scripts) From 27df267b61695b6dd18bd4b94a160dd0080dc897 Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 04:10:38 +0400 Subject: [PATCH 08/11] ci: sync pinned uv setup for dependency lock refresh --- .github/workflows/generate-evidence.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/generate-evidence.yml b/.github/workflows/generate-evidence.yml index c76a5887..97a8dbe3 100644 --- a/.github/workflows/generate-evidence.yml +++ b/.github/workflows/generate-evidence.yml @@ -131,6 +131,14 @@ jobs: fetch-depth: 0 persist-credentials: false + - name: Set up Python for the pinned uv toolchain + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: "3.15" + + - name: Install tox and tox-uv (provides the uv CLI used by CI) + run: python -m pip install tox tox-uv + - name: Set up Node for the pinned pnpm toolchain uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: From 070bdbe1fdcbf34a5cc33928852191154c78e1a5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Nov 2026 00:11:00 +0000 Subject: [PATCH 09/11] chore(deps): refresh dependency lockfiles --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index 79ceeed6..402c5c75 100644 --- a/uv.lock +++ b/uv.lock @@ -830,7 +830,7 @@ requires-dist = [ { name = "pytest", marker = "extra == 'dev'", specifier = ">=9.2.0" }, { name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=7.1.0" }, { name = "pytest-django", marker = "extra == 'dev'", specifier = ">=4.14.0" }, - { name = "tomli", marker = "python_full_version < '3.11' and extra == 'dev'", specifier = ">=2.0.1" }, + { name = "tomli", marker = "python_full_version < '3.11' and extra == 'dev'", specifier = ">=2.5.0" }, { name = "twine", marker = "extra == 'dev'", specifier = ">=7.0.0" }, ] provides-extras = ["dev"] From 7fe09f9160ca4ead51aefe00435c3ed2a5b6ed8a Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 04:11:13 +0400 Subject: [PATCH 10/11] docs: document reproducible dependency lockfile workflow --- CONTRIBUTING.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e30a22e..787ffef8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -107,6 +107,27 @@ Follow `AGENTS.md` and the relevant canonical skill in `.agents/skills/`. The pa - Edit website articles only in `docs/articles/`; generated article copies and RSS output are build products and must not be committed. - Update `website/pnpm-lock.yaml` from `website/package.json` with the pinned pnpm version on the active topic branch. Do not use npm lockfiles or update dependency locks directly on `main`. +## Dependency lockfiles + +- Treat `uv.lock` and `website/pnpm-lock.yaml` as generated artifacts. Never hand-edit either file. +- When `pyproject.toml` changes, regenerate the Python lock with `uv lock` and verify it with `uv lock --check`. Use the same `uv` CLI provided by the repository's `tox-uv` toolchain. +- When `website/package.json` changes, use Node `22.23.4`, Corepack, and the pinned `pnpm@10.12.1`; regenerate with `pnpm install --lockfile-only --ignore-scripts` from `website/`. +- Dependency branches under `deps/` use the guarded lock-refresh path in `.github/workflows/generate-evidence.yml`: generation runs with read-only permissions, and only the isolated commit job can push the generated lockfiles. It does not execute package lifecycle scripts. +- A generated lockfile is not sufficient validation. The PR gate must pass for the final branch head after the lockfile commit. + + + +## Security and dependency policy + +- Report vulnerabilities privately through GitHub's **Report a vulnerability** flow. Do not publish exploit details in an issue or pull request. See [SECURITY.md](SECURITY.md). +- Keep Dependabot version updates and security updates enabled for GitHub Actions, Python dependencies, and website npm dependencies. Review grouped updates; do not blindly merge major-version changes. +- Dependency review blocks new high- and critical-severity advisories. Investigate transitive upgrades and license changes; document temporary exceptions in the PR. +- CodeQL analyzes the Python package and TypeScript/JavaScript website on pull requests, `main`, and weekly. Fix newly introduced actionable findings before merging. +- Enable secret scanning and push protection. Never place real credentials in examples, fixtures, commits, or workflow output; use clearly fake values. +- GitHub Actions receive read-only token permissions by default. Grant narrow write permissions only where required. PyPI publication is the only job allowed `id-token: write`. + +Repository settings are managed by the idempotent maintainer script `scripts/configure_github_repository.sh`. Run it with authenticated `gh` and repository-admin permissions after the PR gate is available. It configures GitHub rulesets and security settings; it does not change package code or publish releases. + ## Security and dependency policy From e0f6a15a207c4024dc95f992d591d57d08a77fd8 Mon Sep 17 00:00:00 2001 From: Mojtaba Arvin Date: Thu, 19 Nov 2026 04:12:36 +0400 Subject: [PATCH 11/11] docs: align dependency workflow guidance with main --- CONTRIBUTING.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 787ffef8..5d0afa74 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -117,18 +117,6 @@ Follow `AGENTS.md` and the relevant canonical skill in `.agents/skills/`. The pa -## Security and dependency policy - -- Report vulnerabilities privately through GitHub's **Report a vulnerability** flow. Do not publish exploit details in an issue or pull request. See [SECURITY.md](SECURITY.md). -- Keep Dependabot version updates and security updates enabled for GitHub Actions, Python dependencies, and website npm dependencies. Review grouped updates; do not blindly merge major-version changes. -- Dependency review blocks new high- and critical-severity advisories. Investigate transitive upgrades and license changes; document temporary exceptions in the PR. -- CodeQL analyzes the Python package and TypeScript/JavaScript website on pull requests, `main`, and weekly. Fix newly introduced actionable findings before merging. -- Enable secret scanning and push protection. Never place real credentials in examples, fixtures, commits, or workflow output; use clearly fake values. -- GitHub Actions receive read-only token permissions by default. Grant narrow write permissions only where required. PyPI publication is the only job allowed `id-token: write`. - -Repository settings are managed by the idempotent maintainer script `scripts/configure_github_repository.sh`. Run it with authenticated `gh` and repository-admin permissions after the PR gate is available. It configures GitHub rulesets and security settings; it does not change package code or publish releases. - - ## Security and dependency policy - Report vulnerabilities privately through GitHub's **Report a vulnerability** flow. Do not publish exploit details in an issue or pull request. See [SECURITY.md](SECURITY.md).