gunk-dev/the-valley
the-valley:ida-3f50af1idearaw

A host runs an operator's unit when a project's main moves

State
question or idea
Created
2026-11-21 by contributor

Body

An operator wants a host unit of their own to run when a named project's main lands, with no timer. No general declaration exists: the mirror queue has one dedicated consumer, the web publisher runs on an interval, and telemetry local sources observe units without starting them.

Design drafted in a consult, 2026-11-21, not built:

- Semantics: converge to the latest tip, not once per landing. Landings during a run coalesce; after a run, main is read again and the newest tip runs if it differs. Repetition is possible, so the unit must tolerate it.
- Declaration, in the host's configuration: services.valley.onMain.<name> = { project; unit; }. The operator declares the unit itself (command, user, credentials, sandbox, timeout) in the ordinary way.
- A small Go bridge watches the repository's ref storage (loose refs and packed-refs), establishes watches before reading, resolves refs/heads/main through git, and rereads after overflow. It alone starts the bound unit, serialises attempts, and hands VALLEY_REPOSITORY and VALLEY_COMMIT through a generated environment file that does not change during a run. On start it reconciles the current main.
- Failure leaves the unit failed and visible through a telemetry local source. Retry on a new tip or by the operator; no automatic restart loop.
- Not to build: a deployment engine, per-landing job history, an acknowledgement protocol, a new attestation kind, or a callback chain on the mirror drain. The bus is not authoritative (unauthenticated). The bridge may start only its bound unit; the integrator and worker get no deployment credentials.
- Concept at risk: "follows" (checks producing evidence on main) must not be extended to host actions; telemetry sources stay observations.

Comments

  1. contributor2026-11-21 17:29 UTC
    Operator direction, 2026-11-21: onMain is accepted for now. Later it should give way to a more general listener: a small language that filters events and names what to run, of which 'this project's main moved' is one expression. Build onMain so that replacement is cheap: keep the declaration thin and the watcher's contract with the unit (repository and commit in, exit status out) independent of how the trigger is expressed.