Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ jobs:
# The node's image, not ubuntu-latest (#81, as broker#88): tests/test_ci.py.
runs-on: ubuntu-24.04
timeout-minutes: 15
# statuses: read for the attest step (#147). Job-level permissions replace the
# workflow's, so it sits here, not above.
permissions:
contents: read
id-token: write
statuses: read
# The broker's exact Redis, 7.0.15 (broker deploy/redis-acl.conf), as on
# co-processor's scratch server. Not a newer 7.x: from 7.2 redis-py's CLIENT
# SETINFO is an ACL denial the broker's grant cannot cover until it upgrades
Expand Down Expand Up @@ -149,7 +152,56 @@ jobs:
UV_INDEX_CO_PYPI_PASSWORD: ${{ steps.auth.outputs.access_token }}
run: uv sync --locked

# The local-gate attestation (#147; skills/shipping-work/references/
# attestation.md). push.sh posts gate/local = success on a commit whose tree
# pre-ship.sh passed. Read on pull requests only. A fast-forward merge puts the
# PR's head on main, status and all, so a read on main's push run (the one
# deploy.sh reads) would skip the suite there. Unread, it runs the whole suite,
# and a refused read can't fail it. Unset reads as not attested.
#
# HEAD is the PR's head: on pull_request, github.sha is the merge commit,
# which nobody gated. The combined status keeps each context's latest state
# (/statuses lists every one ever posted, so a later failure would still
# count). A page is 30 contexts unless more are asked for. A refused read
# fails this step: loud, never a silent skip.
- name: Attested by the local gate?
id: attest
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
HEAD: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
n=$(gh api "repos/${{ github.repository }}/commits/$HEAD/status?per_page=100" \
--jq '[.statuses[] | select(.context == "gate/local" and .state == "success")] | length')
echo "attested=$([ "$n" -gt 0 ] && echo yes || echo no)" | tee -a "$GITHUB_OUTPUT"

# No marker filter: the integration tests are the bus contract. Host-bound
# tests (live tailscaled, installed drop-ins) skip off co-processor.
#
# Skipped only for an attested commit, and never for a bot's PR (Dependabot)
# or a fork's: neither came from a local gate. The reference's `if:`,
# verbatim. Step-level, not job-level: a skipped job reads `skipped`, which
# deploy.sh refuses; a skipped step leaves `test` success. No schedule: under
# merge_mode pr, every commit reaches main through a full push run.
- name: pytest
if: >-
steps.attest.outputs.attested != 'yes'
|| (github.event_name != 'push' && github.event_name != 'pull_request')
|| startsWith(github.ref, 'refs/tags/')
|| (github.event_name == 'pull_request'
&& (github.event.pull_request.user.type == 'Bot'
|| github.event.pull_request.head.repo.full_name != github.repository))
run: uv run pytest

# Exactly when the step above skips. pre-ship.sh deselects every integration
# test, so the gate never ran this tier: an attested PR still checks the bus
# contract against the broker's Redis here (tests/test_ci.py).
- name: pytest (integration)
if: >-
!(steps.attest.outputs.attested != 'yes'
|| (github.event_name != 'push' && github.event_name != 'pull_request')
|| startsWith(github.ref, 'refs/tags/')
|| (github.event_name == 'pull_request'
&& (github.event.pull_request.user.type == 'Bot'
|| github.event.pull_request.head.repo.full_name != github.repository)))
run: uv run pytest -m integration
6 changes: 6 additions & 0 deletions .skills/attest-local-gate
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# push.sh runs the gate on the exact tree, pushes only what passes, then posts the
# commit status gate/local = success on the pushed SHA (#147, skills#688). CI's
# `test` job reads it on a PR only and skips the suite the gate ran, never the
# integration tier (docs/DEPENDENCIES.md § Local-gate attestation). Trust, not
# proof: never a required status. Read from the commit, not the work tree.
on
2 changes: 1 addition & 1 deletion .skills/doc-sections
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ AGENTS.md: the co-core pin and the co-pypi index under Environment & Tooling (py
docs/DEPENDENCIES.md "Bumping co-core", docs/DEPENDENCIES.md "Extraction dependencies": pyproject.toml, uv.lock, the co-pypi index and scripts/co-pypi.sh, LOCAL_GENERATION
docs/DEPLOYMENT.md "Deploy a change: `scripts/deploy.sh`", docs/MONITORING.md "The drift check", docs/MONITORING.md "Liveness": deploy/ units, scripts/deploy.sh, processor.drift.RUNTIME_*
docs/PATCHING.md "Patching", docs/PATCHING.md "The patch-due check", docs/PATCHING.md "Node.js (agent tooling only)": .skills/patching-hosts, deploy/apt/, the apt timers' drop-ins, deploy/needrestart.conf.d/, deploy/nodesource.sh, src/processor/patching.py
docs/DEPENDENCIES.md "CI pins and Dependabot", docs/DEPENDENCIES.md "Shell lint", docs/DEPENDENCIES.md "The lock audit": .github/, scripts/shellcheck.sh, scripts/audit_lock.sh, .githooks/
docs/DEPENDENCIES.md "CI pins and Dependabot", docs/DEPENDENCIES.md "Local-gate attestation", docs/DEPENDENCIES.md "Shell lint", docs/DEPENDENCIES.md "The lock audit": .github/, scripts/shellcheck.sh, scripts/audit_lock.sh, .githooks/
docs/SKILLS.md: the inventory, the refresh hook, Merging under pr and the doc-check lists (skills/, .claude/, .gitmodules, the .skills/ knobs)
docs/SOCRATICODE.md: the store, the index scope and the context manifest (.socraticode.json, .socraticodecontextartifacts.json, .socraticodeignore, .claude/settings.json's env block)
1 change: 1 addition & 0 deletions .skills/doc-sensitive-paths
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ deploy_command
doc-sensitive-paths
doc-sections
gate-stamp-inputs
attest-local-gate

# Semantic search (docs/SOCRATICODE.md).
.socraticode.json
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Python 3.12, uv, hatchling src layout, pytest, ruff.
| Input | `gs://co-gcs-blobs` (Replicator's raw blobs), read-only |
| Output | `gs://co-gcs-processor/blobs/<sha256>.bin`, write-if-absent, **never deleted** |
| Service | systemd unit `processor` ([deploy/processor.service](deploy/processor.service)), as user `processor` (no sudo, not in `docker`, no home), from `/srv/processor/live` → `releases/<build>`, a read-only release `scripts/deploy.sh` builds from a commit on `origin/main` (#2). **Never from a checkout**. [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) |
| CI | [.github/workflows/ci.yml](.github/workflows/ci.yml): lint (ruff, shellcheck), then the full suite against `redis:7.0.15`, the broker's, pulled from `mirror.gcr.io`, never anonymously from Docker Hub (#43). Pins, keyless WIF to `co-pypi-reader`, Dependabot (`github-actions` only): [docs/DEPENDENCIES.md](docs/DEPENDENCIES.md#ci-pins-and-dependabot); shell lint: [§ Shell lint](docs/DEPENDENCIES.md#shell-lint) |
| CI | [.github/workflows/ci.yml](.github/workflows/ci.yml): lint (ruff, shellcheck), then the full suite (an attested PR: integration only, #147) against `redis:7.0.15`, the broker's, pulled from `mirror.gcr.io`, never anonymously from Docker Hub (#43). Pins, keyless WIF to `co-pypi-reader`, Dependabot (`github-actions` only): [docs/DEPENDENCIES.md](docs/DEPENDENCIES.md#ci-pins-and-dependabot); shell lint: [§ Shell lint](docs/DEPENDENCIES.md#shell-lint) |
| Lock audit | [.github/workflows/audit.yml](.github/workflows/audit.yml), report-only, outside the deploy gate: [docs/DEPENDENCIES.md](docs/DEPENDENCIES.md#the-lock-audit) |
| Status | Check-ins: drift (`processor-drift.timer`, hourly), liveness (`processor run`, 5 min), disk headroom ([deploy/disk-gc/disk-gc.conf](deploy/disk-gc/disk-gc.conf)): [docs/MONITORING.md](docs/MONITORING.md) |
| Patching | `automatic` (knob `.skills/patching-hosts`, #113): `-security` daily by unattended-upgrades; the rest in one approved run a week, `Tue 05:00–10:00` UTC. Never a bare `apt-get upgrade`. [docs/PATCHING.md](docs/PATCHING.md#patching) |
Expand Down
18 changes: 14 additions & 4 deletions docs/DEPENDENCIES.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Dependencies and CI

What Processor pins and how each pin moves: the CI workflow's actions and images, shellcheck, the lock audit, co-core, the extraction stack, certifi. The deploy's CI gate: [DEPLOYMENT.md](DEPLOYMENT.md#the-ci-gate).
What Processor pins and how each pin moves: the CI workflow's actions and images, the local-gate attestation, shellcheck, the lock audit, co-core, the extraction stack, certifi. The deploy's CI gate: [DEPLOYMENT.md](DEPLOYMENT.md#the-ci-gate).

## At a glance

| Thing | Value |
|---|---|
| CI | GitHub Actions [.github/workflows/ci.yml](../.github/workflows/ci.yml) on `ubuntu-24.04`, the node's image: lint (ruff, shellcheck), then the full suite against `redis:7.0.15` (the broker's, not 7.2: CLIENT SETINFO; upstream EOL, the next is broker#85's call), pulled from `mirror.gcr.io`, never anonymously from Docker Hub (#43). Keyless WIF to `co-pypi-reader`, whose token only `uv sync` gets (#121), needs the org variable `GCP_WIF_PROVIDER` shared with this repo and a `roles/iam.workloadIdentityUser` binding for `principalSet://…/attribute.repository/CannObserv/processor`. Actions SHA-pinned; Dependabot version updates `github-actions` only, `uv` security updates landed by hand ([§ below](#ci-pins-and-dependabot), #80). Shell lint, with an opt-in pre-commit hook: [§ below](#shell-lint) (#81) |
| CI | GitHub Actions [.github/workflows/ci.yml](../.github/workflows/ci.yml) on `ubuntu-24.04`, the node's image: lint (ruff, shellcheck), then the full suite against `redis:7.0.15` (the broker's, not 7.2: CLIENT SETINFO; upstream EOL, the next is broker#85's call), pulled from `mirror.gcr.io`, never anonymously from Docker Hub (#43). An attested PR runs only the integration tier ([§ below](#local-gate-attestation), #147). Keyless WIF to `co-pypi-reader`, whose token only `uv sync` gets (#121), needs the org variable `GCP_WIF_PROVIDER` shared with this repo and a `roles/iam.workloadIdentityUser` binding for `principalSet://…/attribute.repository/CannObserv/processor`. Actions SHA-pinned; Dependabot version updates `github-actions` only, `uv` security updates landed by hand ([§ below](#ci-pins-and-dependabot), #80). Shell lint, with an opt-in pre-commit hook: [§ below](#shell-lint) (#81) |
| Lock audit | [.github/workflows/audit.yml](../.github/workflows/audit.yml): `uv audit --frozen`, report-only, outside the deploy gate (#73). The weekly patch window reads the live lock (#75): [§ below](#the-lock-audit) |

## CI pins and Dependabot

Ported from broker#88 and broker#90 (#80).

**Pins.** Every `uses:` in `ci.yml` and `audit.yml` takes the form `owner/action@<40-hex sha> # vX.Y.Z`. A tag can be moved, and setup-uv publishes no floating major since v8. As of #80, with setup-uv moved by #110 (Dependabot's first PR here):
**Pins.** Every `uses:` in `ci.yml` and `audit.yml` takes the form `owner/action@<40-hex sha> # vX.Y.Z`. A tag can be moved, and setup-uv publishes no floating major since v8. As of #80, with setup-uv moved by #110 (Dependabot's first PR here) and #148:

| Action | Pin |
|---|---|
| `actions/checkout` | v7.0.1 |
| `astral-sh/setup-uv` | v10.3.3 |
| `astral-sh/setup-uv` | v10.4.0 |
| `google-github-actions/auth` | v3.0.0 |

These are broker's majors (operator, 2026-10-29). `tests/test_dependabot.py` holds the form. `tests/test_ci.py` holds each major to a floor, so a Dependabot major passes and a downgrade fails. `tests/test_lock_audit.py` holds `audit.yml`'s pins equal to `ci.yml`'s.
Expand Down Expand Up @@ -79,6 +79,16 @@ git push origin main # GitHub marks the PR merged

**The runner image.** Every job in `ci.yml` and `audit.yml` runs on `ubuntu-24.04`, co-processor's image, not `ubuntu-latest`. That is 26.04 now: main's run 41003391205 (2026-10-30) ran on `ubuntu-26.04` (#81, as broker#88). The shell lint and the suite then run on the node's userland, and `test`'s Redis fallback, 24.04's apt `redis-server`, is 7.0.15. `tests/test_ci.py` holds every `runs-on` to one image, and on co-processor holds that image to `/etc/os-release`. So a node upgrade fails the suite there until the pins move with it.

## Local-gate attestation

Adopted in #147 from `shipping-work` (gregoryfoster/skills#688; the reference is `skills/shipping-work/references/attestation.md`). The repo is public, so it saves no billed minutes; it is the cohort's shape (CannObserv/status's).

- **The push.** `.skills/attest-local-gate` is committed `on`, so `push.sh` runs `pre-ship.sh` on a clean tree, pushes only what passes, then posts the commit status `gate/local` = `success` on the pushed SHA. It needs `GH_TOKEN`'s **Commit statuses: Read and write**.
- **CI reads it on a PR only.** `test`'s `attest` step reads the head's combined status (`statuses: read` on the job, since a job's `permissions` replace the workflow's). When attested, the `pytest` step skips. A bot's PR, a fork's, a manual run and a tag never skip.
- **The integration tier always runs.** `pre-ship.sh` deselects `integration`, so an attested PR runs `pytest -m integration` instead: the bus contract against the broker's Redis. `tests/test_ci.py` evaluates both `if:`s over each trigger: exactly one runs.
- **Step-level, so the deploy gate is unchanged.** A push to `main` reads nothing and runs the whole suite, and a skipped step leaves `test` `success` ([DEPLOYMENT.md § The CI gate](DEPLOYMENT.md#the-ci-gate)). No schedule: every commit reaches `main` through that run.
- **Trust, not proof.** Anyone with push access can post `gate/local`. Never make it a required status. Never post it by hand.

## Shell lint

Ported from broker#112 (#81). `scripts/shellcheck.sh` lints this repo's own shell scripts: every tracked `*.sh` and `.githooks/*`.
Expand Down
1 change: 1 addition & 0 deletions docs/DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ A stop mid-reclaim finishes the command in hand and leaves the rest pending. A c
**A deploy needs the commit's CI to have passed** (#34, ported from status#11). Before anything is built, `deploy.sh` asks GitHub's Actions API about the commit. It refuses unless `lint`, `test` and any other job in the run all succeeded. The refusal names each job that didn't, with its conclusion, and links the run. A refused deploy changes nothing.

- **Which run.** The newest `push` run of `ci.yml` on `main` for exactly that commit. Every FF merge also has a `pull_request` run on the same SHA, and that one doesn't count, nor does a `workflow_dispatch` run. A re-run counts, since GitHub reports a run's latest attempt.
- That run always runs the full suite. The local-gate attestation skips the suite only on a PR's run ([DEPENDENCIES.md § Local-gate attestation](DEPENDENCIES.md#local-gate-attestation), #147).
- **The run and every job in it must be `success`.** A `skipped` job leaves the run's own conclusion `success`, so the gate reads the jobs too.
- `CI_JOBS` in `deploy.sh` (`lint test`) is a floor, and `tests/test_deploy.py` holds `ci.yml` to it. Any other job counts without being named there.
- A job renamed in `ci.yml` must be renamed in `CI_JOBS`. A build from before the rename then lacks the new name, so rolling back to it needs `--skip-ci`.
Expand Down
3 changes: 2 additions & 1 deletion docs/SKILLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Vendored by [`managing-skills`](../skills/managing-skills/SKILL.md): one git sub
| `skills/<name>` | agentskills.io discovery: a symlink `../skills-vendor/<owner>-<repo>/skills/<name>`, or a committed override |
| `.claude/skills/<name>` | Claude Code discovery: always `../../skills/<name>`, so an override shadows the vendor copy in both systems |
| `.skills/doctor.sh` | A real file, not a symlink (it would dangle exactly when needed). Re-links dangling vendor symlinks by initialising the submodules; `reviewing-*` / `shipping-*` run it as preflight |
| `.skills/merge_mode`, `deploy_command`, `doc-sensitive-paths`, `doc-sections`, `gate-stamp-inputs` | `shipping-work`'s knobs (#115): [§ Shipping](#shipping-shipping-work). [tests/test_shipping_knobs.py](../tests/test_shipping_knobs.py) reads the first two through the skill's own readers |
| `.skills/merge_mode`, `deploy_command`, `doc-sensitive-paths`, `doc-sections`, `gate-stamp-inputs`, `attest-local-gate` | `shipping-work`'s knobs (#115, #147): [§ Shipping](#shipping-shipping-work). [tests/test_shipping_knobs.py](../tests/test_shipping_knobs.py) reads `merge_mode`, `deploy_command` and `attest-local-gate` through the skill's own readers |
| `.claude/hooks/gh-env.sh`, `scripts/env-value.sh` | Ours, not vendored: `GH_TOKEN` from `.env`, as data, for the session's `gh` calls (the refresh hook finds its own: [§ Refresh](#refresh)). A replica of [gregoryfoster/skills#334](https://github.com/gregoryfoster/skills/issues/334)'s `using-github-cli`; adopt that once it ships, and the hook becomes its vendor symlink |
| `.claude/hooks/context-budget-guard.sh`, `.github/workflows/context-cadence.yml`, `.gitattributes`, `.skills/context-*` | `curating-context`'s write guard, weekly measurement and ledger (#126): [§ Context budget](#context-budget) |
| `.skills/worktree_venv` | `none`: each worktree provisions its own `.venv` (`using-git-worktrees` → *Venv linking*). Set when this checkout was the unit's `WorkingDirectory=`; since #2 the unit runs a release, and the knob stays only so worktrees never share the checkout's venv |
Expand Down Expand Up @@ -81,6 +81,7 @@ One skill since #115, which detects the stack: `Detected: toolchain uv`, with no
| `deploy_command` | `setsid -w scripts/deploy.sh` | The release deploy (#2). `-w` keeps the deploy's exit code (broker#123). The skill appends the pushed SHA |
| `doc-sensitive-paths`, `doc-sections` | tailored | Committed together, or every hit says which half is the default. A dead entry, a missing doc or a missing heading fails `tests/test_shipping_knobs.py` |
| `gate-stamp-inputs` | `.env` | Replaces the default, so `.env` is named again (`tests/test_child.py` probes it). `.wheelhouse/*` left with #121: no untracked file decides which co-core installs |
| `attest-local-gate` | `on` | `push.sh` gates the exact tree, then posts `gate/local` on the pushed SHA (#147). An attested PR's CI skips the suite but not the integration tier: [DEPENDENCIES.md § Local-gate attestation](DEPENDENCIES.md#local-gate-attestation). Ship from a clean tree, submodules included |
| `import-targets`, `pre-ship-uv-args` | absent | The default `processor` is right, and CI's `uv run pytest` takes no group |

### Merging under `pr`
Expand Down
Loading
Loading