Files
BigBodyCobainandClaude Opus 5.5 e654f0eed7 CI: audit locked Python pins instead of the runtime env
The previous step ran pip-audit inside the project env on Python 3.10,
which also scanned pip-audit's own helper filelock 4.1.0; the patched
filelock needs Python 3.11, so it could not be installed there.

Now the step exports the locked pins, splits them by Python marker so
both the 3.10 and 3.11+ versions are covered, and runs pip-audit as a
separate 3.11 tool with filelock>=4.2.1. Verified locally: no known
vulnerabilities in either set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 22:34:03 -07:00

147 lines
6.5 KiB
YAML

name: CI - Lint & Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
# CI flake mitigation:
# ci.yml is triggered TWICE per PR on the same commit — once directly via
# the `pull_request` trigger above ("Frontend Tests & Build" check) and once
# via `workflow_call` from docker-publish.yml ("CI Gate / Frontend Tests &
# Build" check). Both jobs land on the same Actions runner pool at the same
# time and fight for CPU/RAM. Under contention, React's reconciliation in
# `messagesViewFirstContact.test.tsx > removes an approved contact …`
# overruns its 5s waitFor timeout — that's the single failure mode we've
# seen flake on PRs #226, #237, #261, #262, #265, #294, #303, and the
# fd7d6fa push. Backend tests and every other frontend test pass under
# the same conditions, which is what made this look random.
#
# Pinning a concurrency group on the SHA (PR head, or the pushed commit
# for main) serializes the two invocations so neither starves the other.
# We use cancel-in-progress: false so the second one queues instead of
# cancelling — cancelling could leave the PR check stuck "Expected" if
# only one of the two ever finishes. Total CI time grows by ~2 min in
# exchange for deterministic outcomes.
concurrency:
group: ci-${{ github.event.pull_request.head.sha || github.sha }}
cancel-in-progress: false
jobs:
frontend:
name: Frontend Tests & Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: frontend/package-lock.json
- run: npm ci
- name: Check React runtime versions match
run: >-
node -e "const react = require('react/package.json').version;
const dom = require('react-dom/package.json').version;
if (react !== dom) throw new Error('React runtime mismatch: react=' + react + ', react-dom=' + dom);
console.log('React and React DOM match: ' + react);"
- name: Audit production dependencies
run: npm audit --omit=dev --audit-level=high
- name: Test development credential bootstrap
run: node --test scripts/dev-admin.test.cjs
- name: Run operator HTTP security regressions
run: npx vitest run --pool=threads src/__tests__/proxy src/__tests__/desktop/adminSessionBoundary.test.ts src/__tests__/voice
- run: npm run lint
- run: npm run format:check
- run: npx vitest run --reporter=verbose
- run: npm run build
- run: npm run bundle:report
backend:
name: Backend Lint & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run secret scan
run: bash backend/scripts/scan-secrets.sh --all
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Verify uv.lock matches pyproject.toml
# Docker and CI install with --frozen, which ignores pyproject.toml.
# A stale lock means dependency bumps never actually ship.
run: uv lock --check
- name: Install dependencies
run: cd backend && uv sync --frozen --group dev
- name: Audit Python dependencies
# Audit the locked pins, not the runtime env: pip-audit's own helpers
# (e.g. filelock) otherwise get scanned too, and the patched filelock
# needs Python 3.11 while the project env runs on 3.10. Pins are split
# by Python marker so both the 3.10 and the 3.11+ versions get checked.
run: |
cd backend
uv export --frozen --no-hashes --no-emit-project --no-emit-workspace -o "$RUNNER_TEMP/req.txt" > /dev/null
grep -vE "python_full_version >= '3\.11" "$RUNNER_TEMP/req.txt" | sed -E 's/ ;.*$//' | grep -vE '^\s*(#|$)' > "$RUNNER_TEMP/req-py310.txt"
grep -vE "python_full_version < '3\.11'( |$)|python_full_version < '3\.11\.5'" "$RUNNER_TEMP/req.txt" | sed -E 's/ ;.*$//' | grep -vE '^\s*(#|$)' > "$RUNNER_TEMP/req-py311.txt"
for f in req-py310 req-py311; do
echo "== $f"
uvx --python 3.11 --with "filelock>=4.2.1" pip-audit -r "$RUNNER_TEMP/$f.txt" --no-deps --disable-pip --progress-spinner off
done
- run: cd backend && uv run ruff check .
- run: cd backend && uv run black --check .
- run: cd backend && uv run python -c "from services.fetchers.retry import with_retry; from services.env_check import validate_env; print('Module imports OK')"
- name: Run release smoke tests
run: |
cd backend
uv run pytest \
tests/test_operator_http_boundary.py \
tests/test_control_surface_auth.py \
tests/test_sentinel_routes_auth_gate.py \
tests/test_agent_shell_ws_auth.py \
tests/test_p0_security.py \
tests/test_voice_setup_api.py \
tests/test_voice_provider_catalog.py \
tests/test_agent_article_actions.py \
tests/test_mission_workspace.py \
tests/mesh/test_mesh_node_bootstrap_runtime.py \
tests/mesh/test_mesh_infonet_sync_support.py \
tests/mesh/test_mesh_canonical.py \
tests/mesh/test_mesh_merkle.py \
tests/test_release_helper.py \
tests/test_liveuamap_scraper_opt_in.py \
tests/test_liveuamap_parser.py \
tests/test_liveuamap_provider.py \
tests/test_liveuamap_docker_contract.py \
tests/test_xquik_news.py \
tests/test_aprs_is_resource_safety.py \
tests/test_summary_endpoint.py \
tests/test_cyber_status_kev_dates.py \
tests/test_ais_upstream_health.py \
-v --tb=short
desktop-runtime-portability:
name: Windows Runtime Portability
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Verify portable desktop backend staging
run: node --test desktop-shell/tauri-skeleton/scripts/build-backend-runtime.test.cjs
- name: Verify native operator sessions and custody boundaries
env:
TAURI_CONFIG: '{"bundle":{"resources":[]}}'
run: cargo test --manifest-path desktop-shell/tauri-skeleton/src-tauri/Cargo.toml --bin shadowbroker-tauri-shell --quiet