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
32 changes: 17 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,29 @@ jobs:
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
# (granting it is a required step of that upgrade, per the broker). The
# integration suite runs here in full: db 15, a throwaway ACL user, and briefly
# maxmemory, all of which a service container absorbs. Docker Hub's official
# image via Google's mirror: GitHub's shared runners exhaust Hub's anonymous
# The broker's exact engine, Valkey 7.2.14 (broker#85), as on co-processor's
# scratch server. redis-py sends CLIENT SETINFO on every connect, and 7.2 is
# the first engine that has the command, so the ACL checks it: the broker
# grants it to processor with the engine, and the integration suite's user
# mirrors the grant (tests/test_consumer.py), so a denial here is one the
# broker would log too. A 7.0 rollback reverts this pin and that grant together.
# The integration suite runs here in full: db 15, a throwaway ACL user, and
# briefly maxmemory, all of which a service container absorbs. Valkey's image
# via Google's mirror: GitHub's shared runners exhaust Docker Hub's anonymous
# pull limit, and a red main run blocks deploys (#43, tests/test_ci.py). The
# mirror serves only tags it has cached (an old one 404s), and 7.0 is past EOL:
# "manifest unknown" at Initialize containers means 7.0.15 left the cache, not
# a broken commit. The fallback is the runner's apt redis-server: runs-on is
# 24.04 (#81), whose apt redis-server is 7.0.15. Assert the version and wait on
# redis-cli ping (#43).
# broker#85 decides the broker's next Redis; this pin moves with it.
# image is valkey/valkey, the one broker#85 names. The mirror serves only tags
# it has cached: "manifest unknown" at Initialize containers means 7.2.14 left
# the cache, not a broken commit. The fallback is the runner's apt
# valkey-server: runs-on is 24.04 (#81), whose noble-updates carries 7.2.14.
# Assert the version and wait on valkey-cli ping (#43).
# The broker's engine decides this pin; it moves with broker's next one.
services:
redis:
image: mirror.gcr.io/library/redis:7.0.15
image: mirror.gcr.io/valkey/valkey:7.2.14
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-cmd "valkey-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
Expand Down
7 changes: 4 additions & 3 deletions .skills/patching-hosts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ origin deb.nodesource.com follow
origin pkgs.tailscale.com follow
hold tailscale tailscale

# The scratch redis-server (localhost:6379, tests and smoke runs only) holds
# nothing to recover, so it gets no datastore line. Its packages stay the
# default `redis` held step: their postinst restarts it.
# The scratch valkey-server (localhost:6379, tests and smoke runs only; Valkey
# 7.2 since #54) holds nothing to recover, so it gets no datastore line. Its
# packages stay the default `redis` held step, which takes valkey-server and
# valkey-tools: their postinst restarts it.

# --- owners ---------------------------------------------------------------
# The release is an extract with no git origin: its uv.lock is this repo's,
Expand Down
2 changes: 1 addition & 1 deletion .socraticodecontextartifacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
{
"name": "ci-workflow",
"path": "./.github/workflows/ci.yml",
"description": "GitHub Actions: lint, then the full suite against redis 7.0.15 from mirror.gcr.io, with keyless WIF to co-pypi-reader, which mints the co-pypi index token for uv sync."
"description": "GitHub Actions: lint, then the full suite against valkey 7.2.14 from mirror.gcr.io, with keyless WIF to co-pypi-reader, which mints the co-pypi index token for uv sync."
},
{
"name": "project-config",
Expand Down
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Python 3.12, uv, hatchling src layout, pytest, ruff.
|---|---|
| VM | exe.dev `co-processor` (8 GB, 2 vCPU), tag `processor` |
| Broker | `broker:6379`, by MagicDNS name, never by address. Tailscale runs `--accept-dns=true`, with an OOM drop-in for tailscaled: [docs/NETWORK.md](docs/NETWORK.md#tailscale-dns) |
| Scratch bus | `redis-server` on `localhost:6379` — tests and smoke runs only |
| Scratch bus | `valkey-server` on `localhost:6379` — tests and smoke runs only |
| 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 (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) |
| CI | [.github/workflows/ci.yml](.github/workflows/ci.yml): lint (ruff, shellcheck), then the full suite (an attested PR: integration only, #147) against `valkey:7.2.14`, 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 Expand Up @@ -77,7 +77,7 @@ Never edit sibling repos (`cannobserv`, `broker`, `watcher`, `replicator`, `arch
```bash
bash scripts/co-pypi.sh uv sync # install deps (co-core from the co-pypi index)
uv run pytest # tests
uv run pytest -m integration # bus tests against the scratch redis-server
uv run pytest -m integration # bus tests against the scratch valkey-server
uv run ruff check . && uv run ruff format --check .
bash scripts/shellcheck.sh # our shell scripts, as CI's lint step
scripts/deploy.sh [<build>] # ship: CI green, then build a release from origin/main, switch, verify (as exedev)
Expand Down
4 changes: 2 additions & 2 deletions docs/DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ What Processor pins and how each pin moves: the CI workflow's actions and images

| 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). 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) |
| 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 `valkey/valkey:7.2.14` (the broker's engine since broker#85, which grants `processor` the CLIENT SETINFO redis-py sends; #54), 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
Expand Down Expand Up @@ -77,7 +77,7 @@ git push origin main # GitHub marks the PR merged
- A major passes `tests/test_ci.py`'s floor (`ACTIONS`) as it is. Raising the floor is a PR of its own: never push to Dependabot's branch, since Dependabot stops rebasing a PR someone else has pushed to.
- **No deploy:** an action bump touches `.github/` alone, which is outside `RUNTIME_*` ([MONITORING.md § The drift check](MONITORING.md#the-drift-check)).

**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.
**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 bus fallback, 24.04's apt `valkey-server`, is 7.2.14 (`noble-updates`). `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

Expand Down
6 changes: 3 additions & 3 deletions docs/PATCHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Keeping `co-processor`'s packages current: the posture and its two lanes, the we

Posture **`automatic`** since #113 (operator, 2026-11-03; `scheduled` from #77), under gregoryfoster/skills `patching-hosts` ([skills/patching-hosts](../skills/patching-hosts/SKILL.md)), read from the knob [.skills/patching-hosts](../.skills/patching-hosts). Two lanes (the skill's policy.md):

- **Security, daily and unattended.** `apt-daily-upgrade.timer` runs `unattended-upgrade` on `-security` (and the release pocket and ESM security, its stock origins) at **13:00 + up to 60 min UTC**, with needrestart listing restarts and performing none, and `Automatic-Reboot "false"`. Nothing restarts `processor` and nothing reboots: a maintainer script's own restart still happens (the scratch `redis-server`'s). A `-security` libssl or libc leaves the service on the old library until the next deploy, attended run or reboot: the attended run's step 6 picks it up.
- **Security, daily and unattended.** `apt-daily-upgrade.timer` runs `unattended-upgrade` on `-security` (and the release pocket and ESM security, its stock origins) at **13:00 + up to 60 min UTC**, with needrestart listing restarts and performing none, and `Automatic-Reboot "false"`. Nothing restarts `processor` and nothing reboots: a maintainer script's own restart still happens (the scratch `valkey-server`'s). A `-security` libssl or libc leaves the service on the old library until the next deploy, attended run or reboot: the attended run's step 6 picks it up.
- **Maintenance, weekly and attended** (`cadence weekly`). The owner approves a run **every week**, in **`Tue 05:00–10:00` UTC**: Monday night Pacific, 21:00–02:00 PST or 22:00–03:00 PDT (operator, 2026-10-26). It takes the security lane's set plus `-updates` plus the followed origins, `--lane maintenance`, and any reboot or restart due. The window opens as the broker's closes (`Mon 23:00–05:00`, CannObserv/broker#67). Both VMs hold the bus link, so the hosts never patch at once and a flap stays attributable to one host. Each run is approved in this repo's session, like the first.

**The timers are moved, not only unmasked.** `apply.sh` refuses any step whose span meets `apt-daily-upgrade.timer`'s range, its calendar time plus its random delay, and refuses while either apt service runs. The stock `06:00` + 60 min sits inside the window, so the drop-ins below move it to 13:00, and `apt-daily.timer` (stock: any hour) to 12:00 + 30 min, before it. `tests/test_apt_automatic.py` holds both outside every knob window: a window change that meets them fails CI. **Never a bare `apt-get upgrade`:** it takes every origin. The skill's [run.md](../skills/patching-hosts/references/run.md) is the procedure; this section is what is particular to this host.
Expand All @@ -27,7 +27,7 @@ Posture **`automatic`** since #113 (operator, 2026-11-03; `scheduled` from #77),
| `origin deb.nodesource.com follow` | Node, agent tooling ([§ Patching Node](#patching-node)) |
| `origin pkgs.tailscale.com follow`, `hold tailscale tailscale` | Its postinst restarts tailscaled, the only path to the broker, so it is a held step approved on its own |
| `owner /srv/processor/live self` | The release has no git origin; its `uv.lock` is this repo's ([§ The lock audit](DEPENDENCIES.md#the-lock-audit)) |
| no `datastore` | The scratch `redis-server` holds test data only. It stays the skill's default `redis` held step, because its postinst restarts it |
| no `datastore` | The scratch `valkey-server` (Valkey 7.2 since #54) holds test data only. It stays the skill's default `redis` held step, which takes `valkey-server` and `valkey-tools`, because its postinst restarts it |
| no `quiet` | `processor-drift.timer` ticks drift (`OnUnitActiveSec=1h`), and liveness runs inside the service |

**Host files** (compared after each deploy, installed by hand):
Expand Down Expand Up @@ -63,7 +63,7 @@ The first unattended run reads in `journalctl -u apt-daily-upgrade` and `/var/lo
**This host's run** (each sudo step approved in this repo's session; `<run>` = `/var/backups/patching-hosts-<UTC>`). Run the scripts under `skills/patching-hosts/scripts/` from the deploy checkout's root, pulled: each defaults its knob to `.skills/patching-hosts` at `git rev-parse --show-toplevel`, or else the working directory, and with no knob found it falls back to `automatic`, report-only.

1. `sudo apt-get update`. The maintenance dry run reads the host's lists, which `apt-daily.timer` last refreshed between 12:00 and 12:30 UTC the day before (gregoryfoster/skills#467).
2. `probe.sh --lane maintenance --dry-run-into <dir>`, in the background: 0 findings expected, beside a `lists:stale` risk that reads the security archive's own publish date, not when the lists were refreshed (2026-10-26). Read the `redis-server` candidate; it must still be a `7.0.15` build, not Valkey, until #54.
2. `probe.sh --lane maintenance --dry-run-into <dir>`, in the background: 0 findings expected, beside a `lists:stale` risk that reads the security archive's own publish date, not when the lists were refreshed (2026-10-26). Read the `valkey-server` candidate; it must be a `7.2` build, the broker's line (#54). Expect the probe to read the scratch server as engine `valkey`, in use, not `dormant` (the skill's `references/datastores.md`; first checked on this host at the 2026-12-01 run).
3. The needrestart proof, as above.
4. `apply.sh --approve --step bulk --lane maintenance --dry-run <dir>`, in the background, within 24 h of the dry run. It restarts nothing. With no data store there is no recovery point: `recovery-point.sh` refuses ("nothing to dump"), and the bulk records the before-versions, the rollback path, in the `<run>` it creates and prints.
5. Held steps, each approved, each `apply.sh --approve --step <name> --run <run>`:
Expand Down
2 changes: 1 addition & 1 deletion docs/PROVISIONING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The broker node never holds `processor`'s plaintext; since broker#72 its hourly

```bash
REDISCLI_AUTH="$(sed -n 's|^CO_PROCESSOR_BUS_URL=redis://processor:\([^@]*\)@.*|\1|p' /etc/processor/.env)" \
redis-cli -h broker --user processor PING # PONG
valkey-cli -h broker --user processor PING # PONG
```
4. Then create the group right away (below).

Expand Down
13 changes: 11 additions & 2 deletions docs/specs/2026-09-29-processor-service-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ on `co-processor`.
(cannobserv#530, v0.41.0). The outcome record of a stored output logs
`output_created` as a log signal only (Section 4).

**Amended 2026-11-27 (the broker's engine is Valkey 7.2.14, processor#54):**
- The broker moved from Redis 7.0.15 to Valkey 7.2.14 (CannObserv/broker#85).
redis-py sends `CLIENT SETINFO` on every connect; 7.2 is the first engine
that has the command, so the ACL checks it, and the broker grants `processor`
`+client|setinfo` with the engine (Section 2's grants).
Processor's code is unchanged.
- The scratch bus on `co-processor` is `valkey-server` 7.2.14, and CI's service
image is `mirror.gcr.io/valkey/valkey:7.2.14` (Section 8).

---

## Why a new service
Expand Down Expand Up @@ -282,7 +291,7 @@ processor-version pin on the command; no job API — the bus is the interface.

| Principal | Resource | Grant |
|---|---|---|
| ACL user `processor` | `content.process` | `+xreadgroup +xack +xautoclaim +xgroup\|create +xlen +xrange +xinfo\|stream +info +ping` |
| ACL user `processor` | `content.process` | `+xreadgroup +xack +xautoclaim +xgroup\|create +xlen +xrange +xinfo\|stream +info +client\|setinfo +ping` |
| ACL user `processor` | `content.derived`, `content.process.dlq` | selector `(+xadd ~content.derived ~content.process.dlq)` |
| ACL user `processor` | `content.process.dlq` | selector `(+xdel ~content.process.dlq)` |
| `co-gcs-processor-writer` | `gs://co-gcs-processor` | `objectCreator` + `objectViewer`; **no delete** — append-only, never deleted |
Expand Down Expand Up @@ -838,7 +847,7 @@ TDD, red first.
(default `exeuntu` image, which ships Claude Code) through exe.dev with
`EXE_API_TOKEN`. **Never the `observo-worker` tag**: Observo's rowless-VM
orphan sweep reaps by it (`exe.ls(tag=observo-worker)`).
4. First-boot setup: uv + Python 3.12, `redis-server` (scratch bus), the
4. First-boot setup: uv + Python 3.12, `valkey-server` (scratch bus), the
Tailscale package, `/etc/processor/` (700). No secrets in the setup script,
and no backslashes — `/exec` unescapes them.
5. Join the tailnet with the one-time key, piped over SSH stdin (never argv or
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ asyncio_default_fixture_loop_scope = "function"
tmp_path_retention_count = 1
tmp_path_retention_policy = "failed"
markers = [
"integration: needs the scratch redis-server on localhost:6379",
"integration: needs the scratch valkey-server on localhost:6379",
]

[tool.ruff]
Expand Down
Loading