mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 15:10:00 +08:00
## Description Every third-party action in `.github/` ran from a version tag like `actions/checkout@v7`. A tag can be moved to other code at any time. That is how `tj-actions/changed-files` leaked CI secrets from ~23,000 repos in March 2025. Here a moved tag would run with the release job's PyPI OIDC token (`id-token: write`) and the Docker job's `packages: write` token. Pinning to a commit SHA closes that, and a new test keeps it closed. Closes # ## Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Performance improvement - [x] Code refactoring (no functional changes) ## Changes Made - All 195 third-party `uses:` refs in 25 files now name the commit their tag points to today, with the version as a comment: `actions/checkout@3d3c42e5... # v7.0.1`. No action version changes. - Dependabot's existing `github-actions` config updates SHA pins and their version comments, so the pins stay current. - Pin dtolnay/rust-toolchain stable and 1.95.0 branches to their existing commit heads. The stable action retains its runtime toolchain input/default; the 1.95.0 action embeds toolchain: 1.95.0. This preserves each call site's existing toolchain selection. - New `test_every_action_is_pinned_to_a_commit_sha` in `scripts/tests/test_ci_workflow.py` fails on any tag-pinned action and lists each one. - Three tests in `tests/test_release_workflows.py` matched the old tag text (`setup-buildx-action@v4`, `gh-action-pypi-publish@vX.Y.Z`, `release-please-action@v4/v5`). They now match the SHA pin and its version comment. ## Testing - [x] Unit tests pass (`pytest`) - [x] Linting passes (`ruff check .`) - [ ] Type checking passes (`mypy headroom`) - [x] New tests added for new functionality - [x] Manual testing performed ### Test Output ```text $ uv run --frozen --extra dev pytest -q scripts/tests/test_ci_workflow.py scripts/tests/test_pr_health_workflow.py scripts/tests/test_normalize_release_pr_bodies.py tests/test_release_workflows.py 87 passed in 0.87s $ uv run --frozen --extra dev pytest -q scripts/tests/test_pr_health_labels.py scripts/tests/test_version_sync.py tests/test_cli/test_wrap_copilot.py tests/test_learn/test_subagent_scanning.py tests/test_plugin_manifests.py tests/test_pr208_changes.py 114 passed in 1.32s $ uvx ruff check scripts/tests/test_ci_workflow.py tests/test_release_workflows.py && uvx ruff format --check <same> All checks passed! ``` ## Real Behavior Proof - Environment: macOS, Python 3.12 via `uv run --frozen --extra dev`, branch cut from `main` atc01cf07d. - Exact command / steps: resolved each tag with `git ls-remote --tags --heads https://github.com/<owner>/<repo>` (peeled for annotated tags), rewrote only the `uses:` lines, then ran the test files above and a `yaml.safe_load` over every file in `.github/`. - Observed result: 195 lines changed, 195 removed, no other line touched (mixed LF/CRLF in `pr-health.yml` kept). All 201 tests pass. On `main` the new test fails and lists the unpinned refs. - Not tested: `scripts/validate-workflows.sh` (actionlint plus act dry runs) was not run locally. The `workflow-validation` job runs it on this PR. ## Runtime Rollout Safety - Rollout-managed feature(s): None. CI workflow files and their tests only. - Minimum rollout channel: N/A, no runtime code changes. - Stable/default behavior changed: No. Each SHA is the commit its tag points to today. - Kill switch / disable path: N/A, revert the commit. - Unsafe override required: No. - Qualification impact: None. - Rollback path: Revert this PR. ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] I did **not** edit `CHANGELOG.md` — it is generated by release-please from my Conventional Commit PR title (a CI guard enforces this) ## Screenshots (if applicable) N/A, no UI change. ## Additional Notes - mypy and docs are N/A: no `headroom/` code or documented behavior changes. - Dependabot does not bump branch pins, so the two `dtolnay/rust-toolchain` pins stay on today's branch head until someone moves them. That action rarely changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4671" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a> <!-- devin-review-badge-end --> ### Maintainer current-main requalification Exact head `57b7edd8d05b6dc5e3bc4eac1dff55f21519afe8`, upstream main `c01cf07d943d816cfd9d97e6838ed4e38f1ff9a4`. Reviewed the27-file delta and existing discussion/Devin no-issues result against current upstream mainc01cf07d94, already included in the contributor head. Independent full-workflow comparison proves only uses refs/comments change across the25 workflow/action files. All195 replaced refs resolve exactly to their original upstream tag/branch commits (29 unique pins across26 repositories), with annotated tags peeled; no mismatches. Pinned dtolnay action source independently confirms stable runtime default versus embedded1.95.0 branch behavior, preserving toolchain selection.87 workflow/release tests and113 adjacent tests pass,1skip; changed Python lint/format passes. Maintainer fix only removes CRLF endings on two edited pr-health lines to clear whitespace; provenance reverified afterward. No contributor workflow logic altered. Description is corrected to explain embedded1.95.0 semantics. No publish/release workflow execution claimed; full hosted qualification must run on this new mechanical-fix head. Maintainers handle CI. Nothing merged. Exact-head hosted checks are being handled by maintainers. No new finding in the reviewed scope; formal approval awaits exact-head hosted qualification; nothing merged. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
123 lines
5.0 KiB
YAML
123 lines
5.0 KiB
YAML
name: Dev Containers
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- ".devcontainer/**"
|
|
- ".github/workflows/devcontainers.yml"
|
|
- "pyproject.toml"
|
|
- "uv.lock"
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- ".devcontainer/**"
|
|
- ".github/workflows/devcontainers.yml"
|
|
- "pyproject.toml"
|
|
- "uv.lock"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: default
|
|
config: .devcontainer/devcontainer.json
|
|
- name: memory-stack
|
|
config: .devcontainer/memory-stack/devcontainer.json
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
# Both variants exhaust the GitHub runner's disk, so free space up front
|
|
# on every variant. memory-stack brings up Neo4j + Postgres + Redis +
|
|
# Qdrant (PR #495: the diagnostic log writer hit "No space left on device"
|
|
# mid-smoke-test). The default variant's post-create `uv sync` fills the
|
|
# disk installing the ML wheel set — it failed copying numpy into the venv
|
|
# with "No space left on device" (os error 28). Previously this ran only
|
|
# on memory-stack, which left the default variant with no cushion.
|
|
#
|
|
# Reclaim ~14 GB by stripping preinstalled tools none of the devcontainer
|
|
# paths use (Android SDK, .NET, Haskell).
|
|
- name: Free runner disk
|
|
uses: jlumbroso/free-disk-space@ceedf095f4ec1a097402bc6bd80831f2e1a6fde6 # v2.0.0
|
|
with:
|
|
tool-cache: true
|
|
android: true
|
|
dotnet: true
|
|
haskell: true
|
|
large-packages: false
|
|
docker-images: false
|
|
swap-storage: false
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
|
|
- name: Install Dev Container CLI
|
|
run: npm install -g @devcontainers/cli@0.85.0
|
|
|
|
- name: Start ${{ matrix.name }}
|
|
run: devcontainer up --workspace-folder . --config ${{ matrix.config }} --remove-existing-container
|
|
|
|
- name: Smoke test ${{ matrix.name }}
|
|
shell: bash
|
|
run: |
|
|
if [[ "${{ matrix.name }}" == "memory-stack" ]]; then
|
|
devcontainer exec --workspace-folder . --config ${{ matrix.config }} bash -lc 'git rev-parse --show-toplevel >/dev/null && uv --version && node --version && gh --version >/dev/null && uv run python -c "import socket; socket.create_connection((\"qdrant\", 6333), 5).close(); socket.create_connection((\"neo4j\", 7687), 5).close(); from mem0 import Memory; from qdrant_client import QdrantClient; import neo4j; import headroom; print(\"memory-stack smoke test passed\")"'
|
|
else
|
|
devcontainer exec --workspace-folder . --config ${{ matrix.config }} bash -lc 'git rev-parse --show-toplevel >/dev/null && uv --version && node --version && gh --version >/dev/null && uv run python -c "import headroom; print(\"default smoke test passed\")"'
|
|
fi
|
|
|
|
validate-worktree:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
# The worktree devcontainer runs the same `uv sync --extra dev` build as
|
|
# the default validate job, which now pulls transformers 5.x. Copying that
|
|
# into the venv volume exhausts the GitHub runner's disk ("No space left on
|
|
# device", see PR #495). Reclaim ~14 GB by stripping preinstalled tools the
|
|
# build never touches — mirrors the memory-stack job's existing remedy.
|
|
- name: Free runner disk
|
|
uses: jlumbroso/free-disk-space@ceedf095f4ec1a097402bc6bd80831f2e1a6fde6 # v2.0.0
|
|
with:
|
|
tool-cache: true
|
|
android: true
|
|
dotnet: true
|
|
haskell: true
|
|
large-packages: false
|
|
docker-images: false
|
|
swap-storage: false
|
|
|
|
- name: Create linked worktree
|
|
run: git worktree add "$RUNNER_TEMP/headroom-worktree" HEAD
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
|
|
- name: Install Dev Container CLI
|
|
run: npm install -g @devcontainers/cli@0.85.0
|
|
|
|
- name: Start linked worktree devcontainer
|
|
run: devcontainer up --workspace-folder "$RUNNER_TEMP/headroom-worktree" --config "$RUNNER_TEMP/headroom-worktree/.devcontainer/devcontainer.json" --remove-existing-container
|
|
|
|
- name: Smoke test linked worktree
|
|
run: devcontainer exec --workspace-folder "$RUNNER_TEMP/headroom-worktree" --config "$RUNNER_TEMP/headroom-worktree/.devcontainer/devcontainer.json" bash -lc 'git rev-parse --show-toplevel && uv run python -c "import headroom; print(\"worktree smoke test passed\")"'
|