Skip to content

Commit fb2deb2

Browse files
committed
Merge remote-tracking branch 'origin/main' into dependabot/pip/numpy-gte-2-and-lt-2.5
2 parents d2b5dbf + 806e19d commit fb2deb2

433 files changed

Lines changed: 50218 additions & 7776 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/CODEOWNERS‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Repository-side ownership for review-sensitive surfaces.
2+
/.github/** @brownjuly2003-code
3+
/infrastructure/** @brownjuly2003-code
4+
/helm/** @brownjuly2003-code
5+
/src/agentflow_runtime/serving/api/auth/** @brownjuly2003-code
6+
/src/agentflow_runtime/serving/api/middleware/** @brownjuly2003-code
7+
/scripts/release.py @brownjuly2003-code
8+
/scripts/evaluate_trivy_policy.py @brownjuly2003-code
9+
/scripts/run_pip_audit_scan.py @brownjuly2003-code
10+
/security/trivy-waivers.json @brownjuly2003-code
11+
/config/project_claims.toml @brownjuly2003-code
12+
/SECURITY.md @brownjuly2003-code
13+
/docs/release-*.md @brownjuly2003-code

‎.github/workflows/backup.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Backup/Restore Regression Test
44
# fixtures on an ephemeral runner, backs *those* up, verifies the manifest,
55
# and restores into a scratch directory — a regression test for
66
# scripts/backup.py, scripts/verify_backup.py and scripts/restore.py, not a
7-
# disaster-recovery control (audit P1-2). See docs/disaster-recovery.md for
7+
# disaster-recovery control (audit P1-2). See docs/operations/disaster-recovery.md for
88
# what backup coverage actually exists today.
99
on:
1010
schedule:
@@ -90,12 +90,12 @@ jobs:
9090
conn.close()
9191
PY
9292
- name: Create backup archive (synthetic fixture)
93-
run: python scripts/backup.py --output backup-artifacts
93+
run: python scripts/backup.py --output .artifacts/backup-regression
9494
- name: Resolve backup path
9595
id: backup
9696
shell: bash
9797
run: |
98-
archive_path="$(ls -1t backup-artifacts/*.tar.gz | head -n 1)"
98+
archive_path="$(ls -1t .artifacts/backup-regression/*.tar.gz | head -n 1)"
9999
echo "archive_path=$archive_path" >> "$GITHUB_OUTPUT"
100100
- name: Verify backup manifest
101101
run: python scripts/verify_backup.py "${{ steps.backup.outputs.archive_path }}"

‎.github/workflows/benchmark-arm.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ name: ARM Benchmark
33
# Dispatch-only benchmark on real ARM server hardware.
44
# Runs on the GitHub-hosted arm64 runner for public repositories
55
# (ubuntu-24.04-arm: Cobalt 100, Arm Neoverse N2, Armv9-A, 4 vCPU) — the
6-
# available ARM server class for this project. Not a required check; evidence
7-
# is recorded into docs/perf/ from the uploaded artifacts.
6+
# available ARM server class for this project. Not a required check; uploaded
7+
# `.artifacts/` files are runtime artifacts. Tracked evidence is created only
8+
# by separate review/promotion.
89

910
on:
1011
workflow_dispatch:

‎.github/workflows/ci.yml‎

Lines changed: 98 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ jobs:
235235
# removed, so the job that executes repository-owned test code no longer
236236
# carries an OIDC capability it cannot use. Coverage floors below remain
237237
# the blocking gates. Reintroduce upload in a separate job consuming a
238-
# coverage.xml artifact if external reporting is ever enabled.
238+
# .artifacts/coverage/coverage.xml artifact if external reporting is ever
239+
# enabled.
239240
permissions:
240241
contents: read
241242
steps:
@@ -248,6 +249,8 @@ jobs:
248249
- name: Install dependencies
249250
run: |
250251
bash scripts/ci_sync.sh test-integrations
252+
- name: Verify SDK/integrations joint installability
253+
run: python scripts/check_cross_package_install.py
251254
- name: Prepare pytest temp directory
252255
run: mkdir -p .tmp
253256
- name: Run unit and property tests with coverage
@@ -256,9 +259,10 @@ jobs:
256259
# --cov-branch turns the floor into a combined line+branch metric — local baseline
257260
# 2026-05-25 is 62% (7716 lines / 2010 branches measured on HEAD `22b1be9`), so the
258261
# 60% gate stays passing with a 2pp cushion. Raise the gate once that cushion grows.
259-
python -m pytest tests/unit/ tests/property/ -v --tb=short --cov=src/agentflow_runtime --cov=sdk --cov-branch --cov-report=xml --cov-report=term-missing --cov-fail-under=60
262+
mkdir -p .artifacts/coverage
263+
python -m pytest tests/unit/ tests/property/ -v --tb=short --cov=src/agentflow_runtime --cov=sdk --cov-branch --cov-report=xml:.artifacts/coverage/coverage.xml --cov-report=term-missing --cov-fail-under=60
260264
- name: Enforce changed-code coverage
261-
run: diff-cover coverage.xml --compare-branch=origin/main --fail-under=80
265+
run: diff-cover .artifacts/coverage/coverage.xml --compare-branch=origin/main --fail-under=80
262266
- name: Run quality validators coverage gate
263267
run: |
264268
python -m pytest tests/unit/test_validators.py -v --tb=short --cov=agentflow_runtime.quality.validators --cov-report=term-missing --cov-fail-under=90
@@ -296,27 +300,57 @@ jobs:
296300
run: |
297301
# Security-critical auth manager (key match/verify, tenant isolation,
298302
# rate-limit/failed-auth windows, rotation grace) and a mutmut target;
299-
# the gate runs its dedicated unit files. Module coverage is 94% so the
303+
# the gate runs its dedicated unit files. Module coverage is 97% so the
300304
# 90% gate keeps a cushion; the remaining gap is the platform-divergent
301-
# SIGHUP handler and bcrypt rotation paths the integration/e2e auth
302-
# suites cover.
305+
# SIGHUP handler, the two read-only-store branches load() reaches only
306+
# when the store flips between probe and write, and the thin
307+
# KeyRotator/usage-table delegations the integration/e2e auth suites
308+
# cover.
309+
#
310+
# This list IS the gate: a dedicated unit file that is not named here
311+
# buys the module nothing. test_key_store_readonly.py arrived with the
312+
# read-only Secret mount work (F-02 B, 2026-08-23) and was never added,
313+
# which by itself took the module from 94% to 82% -- unnoticed, because
314+
# an earlier step in this job was failing and this one never ran.
303315
#
304316
# NOTE: unlike the other per-module gates this uses `coverage run` +
305317
# `coverage report --include`, NOT `pytest --cov=<module>`. The auth
306318
# manager pulls in duckdb (usage table), and pytest-cov's source
307319
# instrumentation of a duckdb-importing module trips duckdb's lazy
308320
# `_duckdb._sqltypes` import at COLLECTION time, both locally and on CI
309321
# runners. `coverage run` imports duckdb normally and avoids the break.
310-
python -m coverage run -m pytest tests/unit/test_auth.py tests/unit/test_auth_manager_pure_logic.py tests/unit/test_auth_manager_memory_bounds.py tests/unit/test_auth_hashed_key_guidance.py tests/unit/test_auth_argon2_lookup.py -p no:schemathesis
322+
python -m coverage run -m pytest \
323+
tests/unit/test_auth.py \
324+
tests/unit/test_auth_manager_pure_logic.py \
325+
tests/unit/test_auth_manager_memory_bounds.py \
326+
tests/unit/test_auth_hashed_key_guidance.py \
327+
tests/unit/test_auth_argon2_lookup.py \
328+
tests/unit/test_auth_key_store_probe.py \
329+
tests/unit/test_auth_manager_key_resolution.py \
330+
tests/unit/test_key_store_readonly.py \
331+
-p no:schemathesis
311332
python -m coverage report --include="*/serving/api/auth/manager.py" --show-missing --fail-under=90
312333
- name: Run key rotation coverage gate
313334
run: |
314335
# Security-critical key-rotation lifecycle (create/rotate/revoke,
315336
# grace-period scheduling, rotation status) and a mutmut target. Like
316337
# the auth manager gate it pulls in duckdb, so it uses coverage run +
317338
# coverage report --include (not pytest --cov) to avoid the
318-
# duckdb _duckdb._sqltypes collection break. Module coverage is 93%.
319-
python -m coverage run -m pytest tests/unit/test_key_rotation.py -p no:schemathesis
339+
# duckdb _duckdb._sqltypes collection break.
340+
#
341+
# Module coverage is 100%. It was 89.6% on test_key_rotation.py alone
342+
# -- passing only because coverage rounds to 90 before comparing, so
343+
# one more defensive line would have turned this gate red without
344+
# anyone changing its behaviour. test_key_rotation.py pins the happy
345+
# lifecycle; the revoke_and_failures file adds what it never reached:
346+
# revoke_key_by_id (the only revoke path the admin router calls since
347+
# F-02 A), the read-only vs merely-broken key-store split, and the
348+
# grace-period cleanup failure that runs on a timer thread with no
349+
# caller left to see it.
350+
python -m coverage run -m pytest \
351+
tests/unit/test_key_rotation.py \
352+
tests/unit/test_key_rotation_revoke_and_failures.py \
353+
-p no:schemathesis
320354
python -m coverage report --include="*/serving/api/auth/key_rotation.py" --show-missing --fail-under=90
321355
- name: Run outbox coverage gate
322356
run: |
@@ -411,6 +445,38 @@ jobs:
411445
CLICKHOUSE_LIVE_DATABASE: agentflow
412446
AGENTFLOW_TEST_PG_DSN: postgresql://agentflow:agentflow@localhost:5432/agentflow
413447
run: pytest tests/integration/ -v --tb=short
448+
- name: Control-plane critical-set coverage gate (audit F-12)
449+
# The repository floor is one number over hundreds of files, so a
450+
# surface can sit at 21% while the aggregate reads 78%. These adapters
451+
# carry the lease / SKIP LOCKED / one-transaction semantics whose
452+
# regressions are silent in production, so they get their own floors
453+
# (scripts/check_control_plane_coverage.py holds the table).
454+
#
455+
# Unit and live coverage go into ONE data file on purpose: most
456+
# branches in these modules only execute against a real server, so a
457+
# unit-only number measures the absence of a database rather than the
458+
# absence of tests. -p no:cov keeps pytest-cov from double-instrumenting
459+
# the `coverage run` (the auth/outbox gate pattern).
460+
env:
461+
AGENTFLOW_TEST_PG_DSN: postgresql://agentflow:agentflow@localhost:5432/agentflow
462+
run: |
463+
coverage erase
464+
coverage run --append -m pytest -q -p no:cov tests/unit/test_control_plane_store.py tests/unit/test_control_plane_capabilities.py tests/unit/test_postgres_enqueue_lease_contract.py tests/unit/test_query_analytics_retention.py tests/unit/test_analytics_middleware.py tests/unit/test_embedded_usage_analytics.py tests/unit/test_audit_publisher.py tests/unit/test_usage_db_connection_reuse.py tests/unit/test_usage_write_off_request_path.py tests/unit/test_node_ingest.py
465+
coverage run --append -m pytest -q -p no:cov tests/integration/test_control_plane_postgres_live.py tests/integration/test_exceptions_inbox.py tests/integration/test_stuck_orders.py tests/integration/test_tenant_isolation.py tests/integration/test_node_topology.py
466+
mkdir -p .artifacts/coverage
467+
coverage xml -o .artifacts/coverage/coverage-control-plane.xml --include="*/serving/control_plane/*,*/routers/ops.py,*/semantic_layer/reconciliation.py,*/serving/node/ingest.py"
468+
python scripts/check_control_plane_coverage.py
469+
- name: Publish control-plane coverage
470+
# Separate from the repository-wide report on purpose (audit F-12 asks
471+
# for integration coverage to be published without folding it into the
472+
# general floor, which would raise the aggregate without covering
473+
# anything new).
474+
if: always()
475+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
476+
with:
477+
name: coverage-control-plane
478+
path: .artifacts/coverage/coverage-control-plane.xml
479+
if-no-files-found: warn
414480

415481
helm-schema-live:
416482
runs-on: ubuntu-latest
@@ -424,6 +490,10 @@ jobs:
424490
- name: Install dependencies (frozen lock profile)
425491
run: bash scripts/ci_sync.sh dev-tools
426492
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
493+
with:
494+
version: v3.16.3
495+
- name: Report Helm version
496+
run: helm version --short
427497
- uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
428498
with:
429499
install_only: true
@@ -459,11 +529,14 @@ jobs:
459529
import re
460530
from pathlib import Path
461531
462-
report_path = Path("docs/benchmark.md")
532+
report_path = Path(".artifacts/benchmark/benchmark.md")
463533
report = report_path.read_text(encoding="utf-8")
464534
lines = [line.strip() for line in report.splitlines() if line.startswith("|")]
465535
if len(lines) < 3:
466-
raise SystemExit("Benchmark results table not found in docs/benchmark.md")
536+
raise SystemExit(
537+
"Benchmark results table not found in "
538+
".artifacts/benchmark/benchmark.md"
539+
)
467540
468541
generated_at_match = re.search(r"Generated: `([^`]+)`", report)
469542
endpoints = {}
@@ -502,12 +575,12 @@ jobs:
502575

503576
terraform-validate:
504577
runs-on: ubuntu-latest
505-
timeout-minutes: 10
578+
timeout-minutes: 20
506579
steps:
507580
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
508581
- uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4.0.1
509582
with:
510-
terraform_version: "1.8.0"
583+
terraform_version: "1.15.4"
511584
- name: Terraform fmt check
512585
run: terraform fmt -check -recursive infrastructure/terraform/
513586
- name: Terraform init
@@ -518,6 +591,18 @@ jobs:
518591
run: |
519592
cd infrastructure/terraform
520593
terraform validate
594+
# h1: hashes in the lock file carry no platform label. This step is the
595+
# guard that linux_amd64 (ubuntu-latest) is actually covered; it uses the
596+
# same three-platform command the module README documents (re-run
597+
# 2026-09-05: no lock rewrite). Three provider zips (~0.7 GB) plus
598+
# terraform init is why this job's timeout-minutes is 20, not 10.
599+
# It has not been observed on a GitHub runner until the owner pushes.
600+
- name: Provider lock covers linux_amd64
601+
run: |
602+
cd infrastructure/terraform
603+
terraform providers lock -platform=linux_amd64 -platform=darwin_arm64 -platform=windows_amd64
604+
git ls-files --error-unmatch .terraform.lock.hcl
605+
git diff --exit-code .terraform.lock.hcl
521606
522607
sdk-ts:
523608
# Audit P1-5: typecheck/tests/build for the TypeScript SDK previously ran

‎.github/workflows/container-attestation.yml‎

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ name: Container Attestation
3030
required: true
3131
type: string
3232

33-
# Top level stays read-only; the write scopes (packages/id-token/attestations)
34-
# are granted only to the two operator-dispatched signing jobs below, so the
35-
# every-PR build-smoke job runs with a read-only token.
33+
# Top level stays read-only. Both operator-dispatched jobs receive only the
34+
# package/OIDC writes needed for signing; attestation write is limited to the
35+
# job that builds its own subject. The every-PR smoke job stays read-only.
3636
permissions:
3737
contents: read
3838

@@ -91,6 +91,8 @@ jobs:
9191
if: ${{ github.event_name == 'workflow_dispatch' && inputs.confirm == 'SIGN' && inputs.mode == 'build-and-sign' }}
9292
runs-on: ubuntu-latest
9393
timeout-minutes: 25
94+
# The production Environment must retain required-reviewer protection.
95+
environment: production
9496
permissions:
9597
contents: read
9698
packages: write
@@ -132,45 +134,75 @@ jobs:
132134
subject-digest: ${{ steps.build.outputs.digest }}
133135
push-to-registry: true
134136

137+
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
138+
with:
139+
version: v3.16.3
140+
141+
- name: Create immutable Helm promotion evidence
142+
env:
143+
IMAGE_REF: ${{ env.IMAGE_REF }}
144+
IMAGE_DIGEST: ${{ steps.build.outputs.digest }}
145+
SOURCE_SHA: ${{ github.sha }}
146+
BUILD_RUN_ID: ${{ github.run_id }}
147+
shell: bash
148+
run: |
149+
set -euo pipefail
150+
python scripts/write_image_promotion_evidence.py \
151+
--image-ref "$IMAGE_REF" \
152+
--image-digest "$IMAGE_DIGEST" \
153+
--source-sha "$SOURCE_SHA" \
154+
--run-id "$BUILD_RUN_ID" \
155+
--chart helm/agentflow \
156+
--output-dir .artifacts/image-promotion
157+
158+
- name: Upload immutable Helm promotion evidence
159+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
160+
with:
161+
name: agentflow-image-promotion-${{ github.sha }}
162+
path: .artifacts/image-promotion/
163+
if-no-files-found: error
164+
retention-days: 14
165+
135166
attest-and-sign:
136167
if: ${{ github.event_name == 'workflow_dispatch' && inputs.confirm == 'SIGN' && inputs.mode == 'sign-existing-digest' }}
137168
runs-on: ubuntu-latest
138169
timeout-minutes: 10
170+
# The production Environment must retain required-reviewer protection.
171+
environment: production
139172
permissions:
140173
contents: read
141174
packages: write
142175
id-token: write
143-
attestations: write
176+
env:
177+
IMAGE_REF: ${{ inputs.image_ref }}
178+
IMAGE_DIGEST: ${{ inputs.image_digest }}
179+
ALLOWED_IMAGE_REF: ghcr.io/${{ github.repository_owner }}/agentflow-api
144180
steps:
145181
- name: Validate digest inputs
146182
shell: bash
147183
run: |
148184
set -euo pipefail
149-
case "${{ inputs.image_digest }}" in
150-
sha256:*) ;;
151-
*) echo "image_digest must be sha256:<digest>" >&2; exit 1 ;;
152-
esac
153-
if [ -z "${{ inputs.image_ref }}" ]; then
185+
if [[ ! "$IMAGE_DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then
186+
echo "image_digest must match sha256 followed by 64 lowercase hex characters" >&2
187+
exit 1
188+
fi
189+
if [[ -z "$IMAGE_REF" ]]; then
154190
echo "image_ref is required for sign-existing-digest mode" >&2
155191
exit 1
156192
fi
157-
case "${{ inputs.image_ref }}" in
193+
case "$IMAGE_REF" in
158194
*@*) echo "image_ref must not include a digest; provide image_digest separately" >&2; exit 1 ;;
159195
*:latest) echo "image_ref must not be a mutable :latest tag" >&2; exit 1 ;;
160196
esac
161-
echo "IMAGE_REF=${{ inputs.image_ref }}" >> "$GITHUB_ENV"
162-
echo "IMAGE_DIGEST=${{ inputs.image_digest }}" >> "$GITHUB_ENV"
197+
if [[ "$IMAGE_REF" != "$ALLOWED_IMAGE_REF" ]]; then
198+
echo "image_ref must match the approved GHCR repository" >&2
199+
exit 1
200+
fi
163201
164202
- uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
165203

166204
- name: Sign image digest with cosign keyless
167-
env:
168-
IMAGE_REF: ${{ env.IMAGE_REF }}
169-
IMAGE_DIGEST: ${{ env.IMAGE_DIGEST }}
170-
run: cosign sign --yes ${IMAGE_REF}@${IMAGE_DIGEST}
205+
run: cosign sign --yes "${IMAGE_REF}@${IMAGE_DIGEST}"
171206

172-
- uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
173-
with:
174-
subject-name: ${{ inputs.image_ref }}
175-
subject-digest: ${{ inputs.image_digest }}
176-
push-to-registry: false
207+
# This job signs an existing digest that it did not build, so it must not create build provenance.
208+
# Build provenance is emitted only by build-push-sign-attest for the image built in that same job.

0 commit comments

Comments
 (0)