observability: backups runs and restores emit a REAL operation log — the capture that #859 assumed already existed #869

Closed
opened 2026-08-26 04:30:31 +00:00 by ben · 2 comments
Owner

Parent / context

Split out of #859 by Ben's 2026-08-26 ruling (see that ticket's ruling comment). #859 asked to "converge the backups log emitters onto the shell open-logs intent" and assumed the work was additive wiring. It is not: there is no backups log to converge. This ticket creates one.

The finding

  • A run persists runRecord{id, at, due, cadence, ref, targets, outcome, evidence, outcomes} — internal/backup/run.go:125-138. No log ref, no captured output.
  • RunRow.Summary / .Detail are generated sentences (projectRun, internal/backup/run.go:427-445), not process output.
  • The engine does shell out — Conn.Run(ctx, argv...) ([]byte, error), internal/backupengine/backupengine.go:60-66 — but that stdout is consumed by the verb and never persisted or streamed. No borg/restic unit, no journald unit, no systemd service behind a run.
  • A restore's only durable trace is one AuditEntry (internal/backup/restore.go:242-256 — "the audit entry is the only trace it leaves"); its Stages detail is computed into RestoreResult and discarded.
  • The LogRef backups hands the activity feed is that audit row's id (internal/backup/recentevents.go:226) — a single row, not a line stream.

Meanwhile the UI already carries the dangling affordances: BackupsSurface.onOpenRunLog() emits a scopeless route intent (dashboard/src/components/backups/BackupsSurface.vue:401-404), and BackupRestoreScreen / BackupRestoreReplacesScreen's open-log / download-log emits reach no listener at all — they fall on the floor.

What to build

Make a backup run and a restore emit a real operation log, in DDR 0203 ruling 5's sense — "bounded, replayable start-to-now, live-tailing while the operation runs" (docs/adr/0203-...md:94-105).

  • Capture the engine's per-verb output (Conn.Run) into the log-stream hub as an operation-log target, keyed by the run's existing ref, for both a scheduled run and a restore.
  • The target is resolvable through the catalogue (LogTarget{Kind: "operation-log"}), with operation_log_aged_out served honestly once it falls out of retention.
  • BackupsSurface re-emits open-logs / download-logs carrying that scope; the shell mounts LogsScreen in place over the Backups tab.
  • The BackupRestore* restore-log affordances reach the composition binding — no backups logs emit falls on the floor.
  • Until the capture exists, any remaining scopeless affordance is disabled with a reason, never routed at something that answers nothing.
  • A regression asserts each converged surface mounts (or downloads), and that a dropped emit fails the test — the floor-drop above was invisible to every existing test.

Blocked by

#868 — the P10 logs transport is never mounted on a real control plane (no production LogCatalogue, and neither WithLogCatalogue nor WithLogStream is in the composition root). There is nowhere for an operation-log target to live until that lands.

Refs

ADR 0027 (the Open/Download promise names backups explicitly), DDR 0203 (logs surface, ruling 5), spec #791, #859 (the ruling), #811 (the per-surface binding this plugs into).

## Parent / context Split out of **#859** by Ben's 2026-08-26 ruling (see that ticket's ruling comment). #859 asked to "converge the backups log emitters onto the shell open-logs intent" and assumed the work was additive wiring. It is not: **there is no backups log to converge.** This ticket creates one. ## The finding - A run persists `runRecord{id, at, due, cadence, ref, targets, outcome, evidence, outcomes}` — `internal/backup/run.go:125-138`. **No log ref, no captured output.** - `RunRow.Summary` / `.Detail` are *generated sentences* (`projectRun`, `internal/backup/run.go:427-445`), not process output. - The engine does shell out — `Conn.Run(ctx, argv...) ([]byte, error)`, `internal/backupengine/backupengine.go:60-66` — but that stdout is consumed by the verb and **never persisted or streamed**. No borg/restic unit, no journald unit, no systemd service behind a run. - A restore's only durable trace is one `AuditEntry` (`internal/backup/restore.go:242-256` — "the audit entry is the only trace it leaves"); its `Stages` detail is computed into `RestoreResult` and discarded. - The LogRef backups hands the activity feed is that audit row's id (`internal/backup/recentevents.go:226`) — a single row, not a line stream. Meanwhile the UI already carries the dangling affordances: `BackupsSurface.onOpenRunLog()` emits a **scopeless** route intent (`dashboard/src/components/backups/BackupsSurface.vue:401-404`), and `BackupRestoreScreen` / `BackupRestoreReplacesScreen`'s `open-log` / `download-log` emits reach **no listener at all** — they fall on the floor. ## What to build Make a backup run and a restore emit a real **operation log**, in DDR 0203 ruling 5's sense — "bounded, replayable start-to-now, live-tailing while the operation runs" (`docs/adr/0203-...md:94-105`). - [ ] Capture the engine's per-verb output (`Conn.Run`) into the log-stream hub as an `operation-log` target, keyed by the run's existing ref, for both a scheduled run and a restore. - [ ] The target is resolvable through the catalogue (`LogTarget{Kind: "operation-log"}`), with `operation_log_aged_out` served honestly once it falls out of retention. - [ ] `BackupsSurface` re-emits `open-logs` / `download-logs` carrying that scope; the shell mounts `LogsScreen` in place over the Backups tab. - [ ] The `BackupRestore*` restore-log affordances reach the composition binding — **no backups logs emit falls on the floor**. - [ ] Until the capture exists, any remaining scopeless affordance is **disabled with a reason**, never routed at something that answers nothing. - [ ] A regression asserts each converged surface mounts (or downloads), and that a dropped emit fails the test — the floor-drop above was invisible to every existing test. ## Blocked by **#868** — the P10 logs transport is never mounted on a real control plane (no production `LogCatalogue`, and neither `WithLogCatalogue` nor `WithLogStream` is in the composition root). There is nowhere for an operation-log target to live until that lands. ## Refs ADR 0027 (the Open/Download promise names backups explicitly), DDR 0203 (logs surface, ruling 5), spec #791, #859 (the ruling), #811 (the per-surface binding this plugs into).

swarm-claim host=elitebook-distributed-server-03 run=10600
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=10600 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #869 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 869,
  "status": "success",
  "commits": [
    "e28bbe4abcac217d36dfac0930a0b4f446893eea"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/compose.go",
    "control-plane/cmd/control-plane/logs_wiring.go",
    "control-plane/cmd/control-plane/logs_wiring_test.go",
    "control-plane/cmd/control-plane/resting_composition.go",
    "control-plane/cmd/control-plane/whole_composition.go",
    "dashboard/src/components/backups/BackupRestoreReplacesScreen.vue",
    "dashboard/src/components/backups/BackupRestoreScreen.vue",
    "dashboard/src/components/backups/BackupRunFailedScreen.vue",
    "dashboard/src/components/backups/BackupsSurface.vue",
    "dashboard/src/lib/api/generated.ts",
    "dashboard/src/lib/backups.ts",
    "dashboard/tests/unit/backupPerTargetHonesty.test.ts",
    "dashboard/tests/unit/backupRestore.test.ts",
    "dashboard/tests/unit/backupRestoreReplaces.test.ts",
    "dashboard/tests/unit/dashboardComposition.test.ts",
    "docs/slices/observability.yaml",
    "internal/backup/backup.go",
    "internal/backup/oplog.go",
    "internal/backup/oplog_test.go",
    "internal/backup/pertarget.go",
    "internal/backup/restore.go",
    "internal/backup/restore_inplace.go",
    "internal/backup/run.go",
    "internal/backupengine/conn.go",
    "internal/backupengine/conn_capture_test.go",
    "packages/openapi-spec/openapi.yaml"
  ],
  "tests": [
    {
      "command": "go test ./internal/backup/... ./internal/backupengine/... ./internal/controlapi/... ./control-plane/cmd/control-plane/...",
      "exit_code": 0
    },
    {
      "command": "go build ./... && go vet ./... && golangci-lint run ./...",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/backup internal/backupengine control-plane/cmd/control-plane",
      "exit_code": 0
    },
    {
      "command": "pnpm --filter @idss/openapi-spec run check:client",
      "exit_code": 0
    },
    {
      "command": "pnpm run lint",
      "exit_code": 0
    },
    {
      "command": "cd dashboard && pnpm exec vitest run tests/unit/backupRestore.test.ts tests/unit/backupRestoreReplaces.test.ts tests/unit/backupPerTargetHonesty.test.ts tests/unit/dashboardComposition.test.ts",
      "exit_code": 0
    },
    {
      "command": "node scripts/check-slices-yaml.mjs",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Capture the engine's per-verb output (Conn.Run) into the log-stream hub as an operation-log target, keyed by the run's ref, for a scheduled run and a restore": "internal/backup/oplog.go (OperationLog store + WithCapture/CaptureOutput ctx seam); internal/backupengine/conn.go CmdConn.Run tees per-verb output; internal/backup/run.go fire() + restore.go/restore_inplace.go mint operation-log/backup/<id> scope and thread capture; regressions internal/backup/oplog_test.go (TestScheduledRun_EmitsARetainedOperationLog, TestRestoreToAlternateDevice_EmitsARetainedOperationLog) + internal/backupengine/conn_capture_test.go",
    "The target is resolvable through the catalogue (LogTarget{Kind: operation-log}), with operation_log_aged_out served honestly once out of retention": "control-plane/cmd/control-plane/logs_wiring.go fleetLogCatalogue.resolveOperationLog consults the oplog; logs_wiring_test.go TestFleetLogCatalogueResolvesRetainedBackupOperationLog asserts a retained scope resolves to a finished operation-log target and an aged-out one carries operation_log_aged_out",
    "BackupsSurface re-emits open-logs / download-logs carrying that scope; the shell mounts LogsScreen in place over the Backups tab": "dashboard/src/components/backups/BackupsSurface.vue declares + relays open-logs/download-logs; dashboardComposition.test.ts EMITTERS table now includes ['backups', BackupsSurface, 'operation-log/backup/run-chat-1'] asserting LogsScreen mounts in place",
    "The BackupRestore* restore-log affordances reach the composition binding — no backups logs emit falls on the floor": "BackupRestoreScreen.vue / BackupRestoreReplacesScreen.vue / BackupRunFailedScreen.vue emit open-log/download-log with the LogRef; BackupsSurface mounts relay @open-log/@download-log; backupRestore.test.ts 'relays the restore screen open-log / download-log onto the shell logs intent' + backupPerTargetHonesty.test.ts asserts the surface emits open-logs",
    "Until the capture exists, any remaining scopeless affordance is disabled with a reason, never routed at nothing": "each log button is :disabled=!logRef with a :title reason; backupRestore.test.ts 'disables the restore-log affordance when the restore captured no log' + backupPerTargetHonesty.test.ts 'disables Open run log when the run captured no operation log' assert disabled + no emit",
    "A regression asserts each converged surface mounts (or downloads), and that a dropped emit fails the test": "dashboardComposition.test.ts (backups open-logs mounts LogsScreen, download-logs records scope, mounts nothing); backupRestore.test.ts + backupPerTargetHonesty.test.ts assert the surface RELAYS the child emit (a dropped/scopeless emit fails these); Go logs_wiring_test.go TestBackupOperationLog_ReplaysThroughFollowAndDownload asserts follow replay + bounded download + 404 for aged-out"
  },
  "summary": "A backup run and a restore now capture the engine's per-verb output into a bounded, ages-out backups operation log the P10 catalogue resolves, and the Backups surfaces open/download it in place — the capture #859 assumed already existed.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #869 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 869, "status": "success", "commits": [ "e28bbe4abcac217d36dfac0930a0b4f446893eea" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/compose.go", "control-plane/cmd/control-plane/logs_wiring.go", "control-plane/cmd/control-plane/logs_wiring_test.go", "control-plane/cmd/control-plane/resting_composition.go", "control-plane/cmd/control-plane/whole_composition.go", "dashboard/src/components/backups/BackupRestoreReplacesScreen.vue", "dashboard/src/components/backups/BackupRestoreScreen.vue", "dashboard/src/components/backups/BackupRunFailedScreen.vue", "dashboard/src/components/backups/BackupsSurface.vue", "dashboard/src/lib/api/generated.ts", "dashboard/src/lib/backups.ts", "dashboard/tests/unit/backupPerTargetHonesty.test.ts", "dashboard/tests/unit/backupRestore.test.ts", "dashboard/tests/unit/backupRestoreReplaces.test.ts", "dashboard/tests/unit/dashboardComposition.test.ts", "docs/slices/observability.yaml", "internal/backup/backup.go", "internal/backup/oplog.go", "internal/backup/oplog_test.go", "internal/backup/pertarget.go", "internal/backup/restore.go", "internal/backup/restore_inplace.go", "internal/backup/run.go", "internal/backupengine/conn.go", "internal/backupengine/conn_capture_test.go", "packages/openapi-spec/openapi.yaml" ], "tests": [ { "command": "go test ./internal/backup/... ./internal/backupengine/... ./internal/controlapi/... ./control-plane/cmd/control-plane/...", "exit_code": 0 }, { "command": "go build ./... && go vet ./... && golangci-lint run ./...", "exit_code": 0 }, { "command": "gofmt -l internal/backup internal/backupengine control-plane/cmd/control-plane", "exit_code": 0 }, { "command": "pnpm --filter @idss/openapi-spec run check:client", "exit_code": 0 }, { "command": "pnpm run lint", "exit_code": 0 }, { "command": "cd dashboard && pnpm exec vitest run tests/unit/backupRestore.test.ts tests/unit/backupRestoreReplaces.test.ts tests/unit/backupPerTargetHonesty.test.ts tests/unit/dashboardComposition.test.ts", "exit_code": 0 }, { "command": "node scripts/check-slices-yaml.mjs", "exit_code": 0 } ], "criteria": { "Capture the engine's per-verb output (Conn.Run) into the log-stream hub as an operation-log target, keyed by the run's ref, for a scheduled run and a restore": "internal/backup/oplog.go (OperationLog store + WithCapture/CaptureOutput ctx seam); internal/backupengine/conn.go CmdConn.Run tees per-verb output; internal/backup/run.go fire() + restore.go/restore_inplace.go mint operation-log/backup/<id> scope and thread capture; regressions internal/backup/oplog_test.go (TestScheduledRun_EmitsARetainedOperationLog, TestRestoreToAlternateDevice_EmitsARetainedOperationLog) + internal/backupengine/conn_capture_test.go", "The target is resolvable through the catalogue (LogTarget{Kind: operation-log}), with operation_log_aged_out served honestly once out of retention": "control-plane/cmd/control-plane/logs_wiring.go fleetLogCatalogue.resolveOperationLog consults the oplog; logs_wiring_test.go TestFleetLogCatalogueResolvesRetainedBackupOperationLog asserts a retained scope resolves to a finished operation-log target and an aged-out one carries operation_log_aged_out", "BackupsSurface re-emits open-logs / download-logs carrying that scope; the shell mounts LogsScreen in place over the Backups tab": "dashboard/src/components/backups/BackupsSurface.vue declares + relays open-logs/download-logs; dashboardComposition.test.ts EMITTERS table now includes ['backups', BackupsSurface, 'operation-log/backup/run-chat-1'] asserting LogsScreen mounts in place", "The BackupRestore* restore-log affordances reach the composition binding — no backups logs emit falls on the floor": "BackupRestoreScreen.vue / BackupRestoreReplacesScreen.vue / BackupRunFailedScreen.vue emit open-log/download-log with the LogRef; BackupsSurface mounts relay @open-log/@download-log; backupRestore.test.ts 'relays the restore screen open-log / download-log onto the shell logs intent' + backupPerTargetHonesty.test.ts asserts the surface emits open-logs", "Until the capture exists, any remaining scopeless affordance is disabled with a reason, never routed at nothing": "each log button is :disabled=!logRef with a :title reason; backupRestore.test.ts 'disables the restore-log affordance when the restore captured no log' + backupPerTargetHonesty.test.ts 'disables Open run log when the run captured no operation log' assert disabled + no emit", "A regression asserts each converged surface mounts (or downloads), and that a dropped emit fails the test": "dashboardComposition.test.ts (backups open-logs mounts LogsScreen, download-logs records scope, mounts nothing); backupRestore.test.ts + backupPerTargetHonesty.test.ts assert the surface RELAYS the child emit (a dropped/scopeless emit fails these); Go logs_wiring_test.go TestBackupOperationLog_ReplaysThroughFollowAndDownload asserts follow replay + bounded download + 404 for aged-out" }, "summary": "A backup run and a restore now capture the engine's per-verb output into a bounded, ages-out backups operation log the P10 catalogue resolves, and the Backups surfaces open/download it in place — the capture #859 assumed already existed.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
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#869
No description provided.