observability: the P10 log line source rests — no live journald-over-SSH follow door, no durable operation-log store (#868 mounted the transport) #870

Closed
opened 2026-08-26 04:36:03 +00:00 by matou-build-agent · 2 comments

The gap

#868 mounted the P10 logs transport on the composition root: the catalogue is now a real projection over fleet state, and the SSE stream + bounded download are mounted over the log-stream hub. But the line source rests (ADR 0100): the hub's FollowFunc (restingLogFollow, control-plane/cmd/control-plane/logs_surfaces.go) opens a follow that ends immediately with no line, because there is no live log door to bind to.

Two reasons, both real:

  • No journald-over-SSH streaming door. The clan seam reaches a node over SSH but sshRun returns combined output, not a stream (internal/clan/adapter.go). A service-unit target's real follow is journalctl -u <unit> -f streamed off the node — new plumbing that mirrors the deploy/agent door's SSH transport + host-key discipline, adapting a live command's stdout into logstream.FollowFunc's <-chan string (the model is clan.Deploy.Run(ctx, events chan clan.Event) in internal/provision/deploy.go).
  • No durable operation-log store. provision.LogRef is a bare handle {ID}; the deploy-run store is in-memory (lost on restart), which is exactly why the catalogue serves operation_log_aged_out. A replayable operation log needs a bounded store the run's lines land in.

What to build

  • A streaming node door: journalctl -u <unit> -f (or container-log equivalent) over the established SSH connection, adapted into a logstream.FollowFunc bound per service-unit target — replacing restingLogFollow.
  • A bounded operation-log store the deploy/rescue/update emitters' lines land in, so an operation-log target replays start-to-now and the bounded download returns real lines.
  • Prove both against a live fleet node (this needs the clan-lab skill — it cannot be unit-proven in the sandbox, which is why #868 stopped at the honest resting source).

Why filed separately

#868 was a mount/composition slice — its deliverable (routes served from real state, not 404, plus a composition-root regression) is done and provable offline. The live line source is a genuine spike: it needs a live node to build and verify, so it is its own ticket rather than an unprovable rider on the mount.

Refs

DDR 0203 (ruling 5 — the two followable classes), ADR 0027, #868 (the mount), #806 (the hub + FollowFunc seam).

## The gap #868 mounted the P10 logs transport on the composition root: the catalogue is now a real projection over fleet state, and the SSE stream + bounded download are mounted over the log-stream hub. But the **line source rests** (ADR 0100): the hub's `FollowFunc` (`restingLogFollow`, `control-plane/cmd/control-plane/logs_surfaces.go`) opens a follow that ends immediately with no line, because there is no live log door to bind to. Two reasons, both real: - **No journald-over-SSH streaming door.** The clan seam reaches a node over SSH but `sshRun` returns *combined output*, not a stream (`internal/clan/adapter.go`). A `service-unit` target's real follow is `journalctl -u <unit> -f` streamed off the node — new plumbing that mirrors the deploy/agent door's SSH transport + host-key discipline, adapting a live command's stdout into `logstream.FollowFunc`'s `<-chan string` (the model is `clan.Deploy.Run(ctx, events chan clan.Event)` in `internal/provision/deploy.go`). - **No durable operation-log store.** `provision.LogRef` is a bare handle `{ID}`; the deploy-run store is in-memory (lost on restart), which is exactly why the catalogue serves `operation_log_aged_out`. A replayable operation log needs a bounded store the run's lines land in. ## What to build - [ ] A streaming node door: `journalctl -u <unit> -f` (or container-log equivalent) over the established SSH connection, adapted into a `logstream.FollowFunc` bound per `service-unit` target — replacing `restingLogFollow`. - [ ] A bounded operation-log store the deploy/rescue/update emitters' lines land in, so an `operation-log` target replays start-to-now and the bounded download returns real lines. - [ ] Prove both against a live fleet node (this needs the `clan-lab` skill — it cannot be unit-proven in the sandbox, which is why #868 stopped at the honest resting source). ## Why filed separately #868 was a mount/composition slice — its deliverable (routes served from real state, not 404, plus a composition-root regression) is done and provable offline. The live line source is a genuine spike: it needs a live node to build and verify, so it is its own ticket rather than an unprovable rider on the mount. ## Refs DDR 0203 (ruling 5 — the two followable classes), ADR 0027, #868 (the mount), #806 (the hub + `FollowFunc` seam).
Owner

Triaged: enhancement + ready-for-session, blocked by #868.

Why not ready-for-agent: both halves of this ticket are unprovable in the swarm sandbox by construction. The streaming journald door has to be bound against a real node over SSH, and the ticket itself says so — it needs the clan-lab skill, which spends money on a real DigitalOcean droplet and rides host credentials. That is squarely the ready-for-session role under ADR 0174: an interactive session's standing, not Ben's hands or eyes, and not a one-way door.

Why not ready-for-human: nothing here needs a ruling. DDR 0203 ruling 5 already fixed the two followable classes, and the shape of the replacement for restingLogFollow is named in the body. Building it is a two-way door — revertible with a commit, provable by a lab drive.

Blocked by #868: #870's whole deliverable is the line source behind the transport #868 mounts. Building the follow door against an unmounted hub would have nothing to prove itself against.

No host marker: the lab is created fresh per drive, so any session host with DO credentials can take it.

Ruled by agent under ADR 0174 — veto anytime.

Triaged: `enhancement` + `ready-for-session`, blocked by #868. **Why not `ready-for-agent`:** both halves of this ticket are unprovable in the swarm sandbox by construction. The streaming journald door has to be bound against a real node over SSH, and the ticket itself says so — it needs the `clan-lab` skill, which spends money on a real DigitalOcean droplet and rides host credentials. That is squarely the `ready-for-session` role under ADR 0174: an interactive session's standing, not Ben's hands or eyes, and not a one-way door. **Why not `ready-for-human`:** nothing here needs a ruling. DDR 0203 ruling 5 already fixed the two followable classes, and the shape of the replacement for `restingLogFollow` is named in the body. Building it is a two-way door — revertible with a commit, provable by a lab drive. **Blocked by #868:** #870's whole deliverable is the line source *behind* the transport #868 mounts. Building the follow door against an unmounted hub would have nothing to prove itself against. No host marker: the lab is created fresh per drive, so any session host with DO credentials can take it. Ruled by agent under ADR 0174 — veto anytime.
Author
Member

Close-report — landed + live-proven (commit 7292b74d)

Both halves of the P10 line source are built; the streaming door is LIVE-PROVEN against a real clan node. Ruled by agent under ADR 0174 — veto anytime.

1. The streaming journald-over-SSH door

internal/clan/Adapter.FollowUnit runs journalctl -u <unit> -f over the SAME ssh target + host-key pin (#458) + identity discipline (ADR 0126) UnitActive/harvestSwitchJournal use, adapting a long-lived command's stdout into the <-chan string the log-stream hub multiplexes (execSSHStream: StdoutPipe + bufio.Scanner; ctx-cancel kills the remote follow and closes the channel — the logstream.FollowFunc contract). It replaces the resting errLogSourceNotWired source for service-unit targets.

  • service→unit mapping (#876's "undesigned" residue) is ruled in DDR 0211: a service follows its PRIMARY daemon — the same unit its health check already names (whole_composition.go): caddy / phpfpm-nextcloud / mattermost / forgejo / coolwsd / jitsi-videobridge2 / stalwart-mail / idss-site-manager. backup-copy has no daemon (its trace is its operation log).
  • scope resolution: fleetLogFollow resolves the surface's service/<slug> scope THROUGH the catalogue to a node+unit (ruling 5: "resolved server-side to its units"); a <slug>@<node> unit resolves to itself so stream + download are symmetric. Fails loud (never a fake tail) when nothing live resolves or no clan is wired.

2. The durable operation-log store

New internal/oplog.Store — general bounded, drop-oldest, ages-out, ctx-capture. The deploy tees its streamed clan.Event lines into it under the run's LogRef (applyRevision); the P10 catalogue/follow/download read it through a composite beside the backups store (#869). So a deploy's operation-log scope replays start-to-now and the bounded download returns REAL lines — no longer the operation_log_aged_out #868 served honestly.

3. Live proof (clan-lab — why this was ready-for-session)

A disposable 3-node clan lab (golden pin clan-core db4db726). Against node1 (a real NixOS clan node), the PRODUCTION door:

  • streamed real sshd.service journal lines into the Go channel and closed on cancel within the contract window (TestFollowUnit_Live, PASS);
  • a -n 0 follow delivered ONLY lines stamped 3s AFTER it started — a genuine -f live tail, not backlog.

Evidence: docs/spike-findings/2026-08-27-p10-journald-follow-870.md. Lab destroyed at end of drive; no droplets left running.

Proof (offline seams, all green)

internal/clan/logfollow_test.go, control-plane/.../logs_source_test.go, logs_wiring_test.go, internal/oplog/oplog_test.go, internal/provision/oplog_test.go. go build/vet/test clean across internal/clan ./internal/oplog ./internal/provision ./control-plane/... ./internal/controlapi ./internal/logstream ./internal/backup.

Residue named, not smuggled

rescue/update currently discard their deploy event streams (dep.Run(ctx, nil)), so their emitters land no lines in the store yet. The store is adoption-ready — they drain their stream into it exactly as applyRevision does. This is the remaining sliver of #877's scope (the store itself + the deploy emitter are done here); filing/routing it is left rather than half-wiring untested paths.

Supersedes the substance of #876 (door + mapping — done + live-proven) and the store core of #877 (store built; deploy feeds it; rescue/update adoption is the sliver above).

## Close-report — landed + live-proven (commit `7292b74d`) **Both halves of the P10 line source are built; the streaming door is LIVE-PROVEN against a real clan node.** Ruled by agent under ADR 0174 — veto anytime. ### 1. The streaming journald-over-SSH door `internal/clan/Adapter.FollowUnit` runs `journalctl -u <unit> -f` over the SAME ssh target + host-key pin (#458) + identity discipline (ADR 0126) `UnitActive`/`harvestSwitchJournal` use, adapting a long-lived command's stdout into the `<-chan string` the log-stream hub multiplexes (`execSSHStream`: `StdoutPipe` + `bufio.Scanner`; ctx-cancel kills the remote follow and closes the channel — the `logstream.FollowFunc` contract). It replaces the resting `errLogSourceNotWired` source for service-unit targets. - **service→unit mapping** (#876's "undesigned" residue) is ruled in **DDR 0211**: a service follows its PRIMARY daemon — the same unit its health check already names (`whole_composition.go`): `caddy` / `phpfpm-nextcloud` / `mattermost` / `forgejo` / `coolwsd` / `jitsi-videobridge2` / `stalwart-mail` / `idss-site-manager`. `backup-copy` has no daemon (its trace is its operation log). - **scope resolution**: `fleetLogFollow` resolves the surface's `service/<slug>` scope THROUGH the catalogue to a node+unit (ruling 5: "resolved server-side to its units"); a `<slug>@<node>` unit resolves to itself so stream + download are symmetric. Fails loud (never a fake tail) when nothing live resolves or no clan is wired. ### 2. The durable operation-log store New `internal/oplog.Store` — general bounded, drop-oldest, ages-out, ctx-capture. The deploy tees its streamed `clan.Event` lines into it under the run's LogRef (`applyRevision`); the P10 catalogue/follow/download read it through a composite beside the backups store (#869). So a deploy's `operation-log` scope replays start-to-now and the bounded download returns REAL lines — no longer the `operation_log_aged_out` #868 served honestly. ### 3. Live proof (clan-lab — why this was `ready-for-session`) A disposable 3-node clan lab (golden pin clan-core `db4db726`). Against **node1** (a real NixOS clan node), the PRODUCTION door: - streamed real `sshd.service` journal lines into the Go channel and **closed on cancel** within the contract window (`TestFollowUnit_Live`, PASS); - a `-n 0` follow delivered ONLY lines stamped 3s AFTER it started — a **genuine `-f` live tail**, not backlog. Evidence: `docs/spike-findings/2026-08-27-p10-journald-follow-870.md`. Lab destroyed at end of drive; no droplets left running. ### Proof (offline seams, all green) `internal/clan/logfollow_test.go`, `control-plane/.../logs_source_test.go`, `logs_wiring_test.go`, `internal/oplog/oplog_test.go`, `internal/provision/oplog_test.go`. `go build/vet/test` clean across `internal/clan ./internal/oplog ./internal/provision ./control-plane/... ./internal/controlapi ./internal/logstream ./internal/backup`. ### Residue named, not smuggled rescue/update currently **discard** their deploy event streams (`dep.Run(ctx, nil)`), so their emitters land no lines in the store yet. The store is adoption-ready — they drain their stream into it exactly as `applyRevision` does. This is the remaining sliver of #877's scope (the store itself + the deploy emitter are done here); filing/routing it is left rather than half-wiring untested paths. Supersedes the substance of **#876** (door + mapping — done + live-proven) and the store core of **#877** (store built; deploy feeds it; rescue/update adoption is the sliver above).
matou-build-agent 2026-08-27 00:36:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#870
No description provided.