observability: transport-activity-read — the Activity read-composition — bounded fan-out where per-source failure is a VALUE #830

Closed
opened 2026-08-25 11:00:06 +00:00 by matou-build-agent · 2 comments

Parent

Feature spec: #796 — control-panel observability child spec: activity feed (P12) (DDR 0206).
Design ticket #763; slice-map fan-in #770; wayfinder map #7.
Slice transport-activity-read of docs/slices/observability.yaml; covers spec #796 stories 40–44, 54–61 (composition half).

What to build

The Activity read-composition and its route, following overview.go's shape exactly: an
interface whose methods are each one owner's query, a handler that fans out and composes, and a
projection that re-derives nothing. One route on the existing OpenAPI spec behind the existing auth
gate, generated client consumed by an httpActivityClient.

Fan-out is BOUNDED and per-source failure is a VALUE. Each owner query is bounded by the
requested window and by a per-source deadline; a source that errors or times out contributes a
status, never an exception that fails the read. The composition returns partial results plus
the per-source statuses that name the gap — that is the whole of P12-S3x's truth. The alternative
(silently thinner output) reads as "nothing happened", which is the stale-green lie.

The window is a request bound: each source is asked for its recent events within that window
and returns only those; the composition merges and truncates deterministically by time. The surface
never fetches an unbounded history and never pages by offset.

The horizon is reported, not implied: the read reports the oldest event actually returned and
its source, and makes no statement about retention beyond that. Log handles are carried only
where the owner genuinely has one
, and drill-in intents are the owner's own. The standing
raised alerts ride monitoring's existing query as a separate field, projected not re-classified.
The composition drops, with a control-plane log line, any event whose subject kind it cannot
honour
— the fence's mechanical guard.

Acceptance criteria

  • (story 54) Given the control plane, when the dashboard reads the feed, then a single read returns the merged newest-first events, the standing raised alerts for the band, the per-source answered/missing status, and the horizon — as a thin projection that re-derives nothing and maps faults to the shared Problem body.
  • (story 55) Given a read for today / 7 days / 30 days, then each source is asked for its events within that window and returns only those, and the composition merges and truncates deterministically by time — never an unbounded history and never offset paging.
  • (story 58) Given a fan-out in which one source returns an error or times out, then the composition returns the other sources' events plus a per-source status naming the failed source, since when and how many attempts — the whole read does not fault, and the failed source's absence is never rendered as an empty result.
  • (story 44) Given every source failing (or the read itself faulting), then the shared Problem body is returned so shell's existing unreachable/error posture can render.
  • (story 59) Given the merged result, then the read reports the oldest event actually returned and its source, and makes no statement about retention beyond that.
  • (story 60) Given the read, then the standing raised alerts it carries are monitoring's existing standing-alert query — the same truth Overview's needs-attention queue and the chrome's alert slot already read — projected, not re-classified, with monitoring's own drill-in intent, and never merged into the event rows.
  • (stories 29–30) Given each event, then its operation-log handle is carried only where the owner genuinely has one — no handle is fabricated.
  • (stories 31–32) Given each event, then its drill-in intent is the owning feature's own DrillInIntent (action + owner), reusing the shape the Overview read already returns — the composition maps no owner.
  • (story 48) Given an event whose subject kind the composition cannot honour, then it is dropped with a control-plane log line.
  • (decisions) Given two reads over unchanged records, then the row order is byte-identical.
  • (story 53) Given an unauthenticated caller, then the route is refused by the existing front-door auth gate with no fact disclosed; given an authenticated operator, then it answers.

Blocked by

  • #825 — observability:monitor-recent-events
  • #826 — observability:fleet-recent-events
  • #827 — observability:update-recent-events
  • #828 — observability:backup-recent-events
  • #829 — observability:rescue-recent-events
  • bootstrap:control-plane-tracer (#127 — done, satisfied)

Task manifest

task: observability:transport-activity-read
interface: an `Activity`-shaped read service on `controlapi` following `overview.go`'s shape — one interface
  method per owner query, bounded fan-out with a per-source deadline, per-source status as a value, deterministic
  merge + truncation, the standing-alert field, the horizon report — plus one route on the existing OpenAPI
  spec behind the existing auth gate and a generated-client `httpActivityClient`
seam: 'the Go composition seam over hand-written fakes for the five owners (prior art `overview_integration_test.go`,
  `fleet_integration_test.go`): merge order and its deterministic tie-break; window bounding; the horizon
  report; one source erroring → partial result + named status with the read **not** faulting; all sources
  erroring → the shared Problem body; the standing-alert field carried unmodified; log handles and drill-ins
  carried only where the owner supplied them; an unhonourable subject kind dropped and logged; an unauthenticated
  call refused disclosing nothing'
acceptance:
- given: five owners each answering for a 7-day window
  when: the activity read is served
  then: one read returns the merged newest-first events, the standing alerts, the per-source statuses
    and the horizon
- given: one source erroring or timing out
  when: the activity read is served
  then: the other sources' events return plus a status naming the failed source, since when and how many
    attempts — the read does not fault
- given: every source failing
  when: the activity read is served
  then: the shared Problem body is returned
- given: two reads over unchanged records
  when: both are served
  then: the row order is byte-identical
- given: an event whose subject kind cannot be honoured
  when: the composition runs
  then: it is dropped with a control-plane log line
- given: an unauthenticated caller
  when: the route is requested
  then: it is refused with no fact disclosed
depends_on:
- monitor-recent-events
- fleet-recent-events
- update-recent-events
- backup-recent-events
- rescue-recent-events
- bootstrap:control-plane-tracer
out_of_scope:
- an event store, a bus or feed-side persistence
- paging, infinite scroll or export
- the surface itself (`dashboard-activity-surface`)
- re-classifying any owner's outcome, severity or problem flag
- fabricating a log handle or mapping an owner's drill-in
needs_human_decision: []

Emitted by /to-tickets over docs/slices/observability.yaml in an unattended session under ADR 0174 (two-way-door posture — Ben's veto is asynchronous, never blocking). Advances #797.

## Parent Feature spec: **#796** — control-panel observability child spec: activity feed (P12) (DDR 0206). Design ticket #763; slice-map fan-in **#770**; wayfinder map #7. Slice `transport-activity-read` of `docs/slices/observability.yaml`; covers spec #796 stories 40–44, 54–61 (composition half). ## What to build The `Activity` read-composition and its route, following `overview.go`'s shape **exactly**: an interface whose methods are each one owner's query, a handler that fans out and composes, and a projection that re-derives nothing. One route on the existing OpenAPI spec behind the existing auth gate, generated client consumed by an `httpActivityClient`. **Fan-out is BOUNDED and per-source failure is a VALUE.** Each owner query is bounded by the requested window and by a per-source deadline; a source that errors or times out contributes a **status**, never an exception that fails the read. The composition returns partial results **plus** the per-source statuses that name the gap — that is the whole of P12-S3x's truth. The alternative (silently thinner output) reads as "nothing happened", which is the stale-green lie. **The window is a request bound**: each source is asked for its recent events *within that window* and returns only those; the composition merges and truncates deterministically by time. The surface never fetches an unbounded history and never pages by offset. **The horizon is reported, not implied**: the read reports the oldest event actually returned and its source, and makes no statement about retention beyond that. **Log handles are carried only where the owner genuinely has one**, and **drill-in intents are the owner's own**. The standing raised alerts ride monitoring's existing query as a **separate field**, projected not re-classified. The composition **drops, with a control-plane log line, any event whose subject kind it cannot honour** — the fence's mechanical guard. ## Acceptance criteria - [ ] (story 54) Given the control plane, when the dashboard reads the feed, then a **single read** returns the merged newest-first events, the standing raised alerts for the band, the per-source answered/missing status, and the horizon — as a thin projection that re-derives nothing and maps faults to the shared Problem body. - [ ] (story 55) Given a read for *today* / *7 days* / *30 days*, then each source is asked for its events **within that window** and returns only those, and the composition merges and truncates deterministically by time — never an unbounded history and never offset paging. - [ ] (story 58) Given a fan-out in which one source returns an error or times out, then the composition returns the other sources' events **plus** a per-source status naming the failed source, since when and how many attempts — **the whole read does not fault**, and the failed source's absence is never rendered as an empty result. - [ ] (story 44) Given **every** source failing (or the read itself faulting), then the shared Problem body is returned so shell's existing unreachable/error posture can render. - [ ] (story 59) Given the merged result, then the read reports the oldest event actually returned and its source, and makes **no** statement about retention beyond that. - [ ] (story 60) Given the read, then the standing raised alerts it carries are monitoring's existing standing-alert query — the same truth Overview's needs-attention queue and the chrome's alert slot already read — projected, **not re-classified**, with monitoring's own drill-in intent, and **never merged into the event rows**. - [ ] (stories 29–30) Given each event, then its operation-log handle is carried only where the owner genuinely has one — no handle is fabricated. - [ ] (stories 31–32) Given each event, then its drill-in intent is the owning feature's own `DrillInIntent` (action + owner), reusing the shape the Overview read already returns — the composition maps no owner. - [ ] (story 48) Given an event whose subject kind the composition cannot honour, then it is **dropped with a control-plane log line**. - [ ] (decisions) Given two reads over unchanged records, then the row order is byte-identical. - [ ] (story 53) Given an unauthenticated caller, then the route is refused by the existing front-door auth gate with **no fact disclosed**; given an authenticated operator, then it answers. ## Blocked by - #825 — `observability:monitor-recent-events` - #826 — `observability:fleet-recent-events` - #827 — `observability:update-recent-events` - #828 — `observability:backup-recent-events` - #829 — `observability:rescue-recent-events` - `bootstrap:control-plane-tracer` (#127 — done, satisfied) ## Task manifest ```yaml task: observability:transport-activity-read interface: an `Activity`-shaped read service on `controlapi` following `overview.go`'s shape — one interface method per owner query, bounded fan-out with a per-source deadline, per-source status as a value, deterministic merge + truncation, the standing-alert field, the horizon report — plus one route on the existing OpenAPI spec behind the existing auth gate and a generated-client `httpActivityClient` seam: 'the Go composition seam over hand-written fakes for the five owners (prior art `overview_integration_test.go`, `fleet_integration_test.go`): merge order and its deterministic tie-break; window bounding; the horizon report; one source erroring → partial result + named status with the read **not** faulting; all sources erroring → the shared Problem body; the standing-alert field carried unmodified; log handles and drill-ins carried only where the owner supplied them; an unhonourable subject kind dropped and logged; an unauthenticated call refused disclosing nothing' acceptance: - given: five owners each answering for a 7-day window when: the activity read is served then: one read returns the merged newest-first events, the standing alerts, the per-source statuses and the horizon - given: one source erroring or timing out when: the activity read is served then: the other sources' events return plus a status naming the failed source, since when and how many attempts — the read does not fault - given: every source failing when: the activity read is served then: the shared Problem body is returned - given: two reads over unchanged records when: both are served then: the row order is byte-identical - given: an event whose subject kind cannot be honoured when: the composition runs then: it is dropped with a control-plane log line - given: an unauthenticated caller when: the route is requested then: it is refused with no fact disclosed depends_on: - monitor-recent-events - fleet-recent-events - update-recent-events - backup-recent-events - rescue-recent-events - bootstrap:control-plane-tracer out_of_scope: - an event store, a bus or feed-side persistence - paging, infinite scroll or export - the surface itself (`dashboard-activity-surface`) - re-classifying any owner's outcome, severity or problem flag - fabricating a log handle or mapping an owner's drill-in needs_human_decision: [] ``` --- *Emitted by `/to-tickets` over `docs/slices/observability.yaml` in an unattended session under ADR 0174 (two-way-door posture — Ben's veto is asynchronous, never blocking). Advances #797.*
Author
Member

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

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

close-report for #830 — status success

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

envelope
{
  "issue": 830,
  "status": "success",
  "commits": [
    "1a3e517"
  ],
  "changed_files": [
    "STATUS.md",
    "dashboard/src/lib/activity.ts",
    "dashboard/src/lib/api/activityClient.ts",
    "dashboard/src/lib/api/generated.ts",
    "dashboard/tests/unit/activityLive.test.ts",
    "internal/controlapi/activity.go",
    "internal/controlapi/activity_integration_test.go",
    "packages/openapi-spec/openapi.yaml",
    "packages/openapi-spec/tests/unit/spec.test.ts"
  ],
  "tests": [
    {
      "command": "go test -race ./internal/controlapi/ -run TestActivity",
      "exit_code": 0
    },
    {
      "command": "go test -count=1 ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/opsevent/",
      "exit_code": 0
    },
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/controlapi/activity.go internal/controlapi/activity_integration_test.go",
      "exit_code": 0
    },
    {
      "command": "node packages/openapi-spec/scripts/generate-client.mjs --check",
      "exit_code": 0
    },
    {
      "command": "CI=true npx vitest run (dashboard, 1084 tests)",
      "exit_code": 0
    },
    {
      "command": "CI=true npx vitest run (openapi-spec, 7 tests)",
      "exit_code": 0
    },
    {
      "command": "npx vue-tsc -p tsconfig.json --noEmit (dashboard)",
      "exit_code": 0
    },
    {
      "command": "npx eslint src/lib/activity.ts src/lib/api/activityClient.ts tests/unit/activityLive.test.ts",
      "exit_code": 0
    },
    {
      "command": "pre-push gate: .sandcastle/gate.sh --prepush (full Go seam build/vet/lint/test)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "story 54 — a single read returns the merged newest-first events, standing alerts, per-source status and horizon, a thin projection mapping faults to the Problem body": "internal/controlapi/activity.go (serve/fanOut compose Activity{Events,StandingAlerts,Sources,Horizon} via opsevent.Merge); TestActivityHandler_ComposesTheChronologyFromEveryOwner",
    "story 55 — each source asked within the window, merged and truncated deterministically by time, never unbounded/offset": "resolveActivityWindow resolves today/7d/30d to an absolute opsevent.Window before fan-out; opsevent.Merge total order + MaxRows truncation; TestActivityHandler_WindowIsARequestBound",
    "story 58 — one source erroring/timing out returns the other sources' events plus a per-source status naming the failed source, since when and how many attempts; the read does not fault; the absence is never an empty result": "fetchSource retries under a per-source deadline and returns ActivitySourceStatus{answered:false,since,attempts}; TestActivityHandler_OneSourceFailingIsAValueNotAFault + TestActivityHandler_TimeoutIsAValueNotAFault",
    "story 44 — every source failing (or the read faulting) returns the shared Problem body": "serve returns writeProblem 500 when answered==0; TestActivityHandler_EverySourceFailingReturnsTheProblemBody",
    "story 59 — the read reports the oldest event returned and its source, no statement beyond that": "horizonOf reports ActivityHorizon{oldest,source} from the truncated merge; asserted in TestActivityHandler_ComposesTheChronologyFromEveryOwner and the zero-horizon case",
    "story 60 — standing raised alerts are monitoring's existing query, projected not re-classified, with monitoring's own drill-in intent, never merged into the event rows": "standingAlerts() reads svc.StandingAlerts() carried in the separate standing_alerts field; TestActivityHandler_ComposesTheChronologyFromEveryOwner asserts no leak into events",
    "stories 29-30 — the operation-log handle carried only where the owner has one, never fabricated": "projectEvents carries e.LogRef verbatim (log_ref omitempty); seed data proves handles present only on monitoring/updates rows",
    "stories 31-32 — each event's drill-in is the owning feature's own DrillInIntent, reusing the Overview shape; the composition maps no owner": "projectEvents copies opsevent.DrillIn verbatim into ActivityDrillIn; asserted in the compose test and activityLive.test.ts",
    "story 48 — an event whose subject kind cannot be honoured is dropped with a control-plane log line": "opsevent.Merge(h.log, ...) drops+logs the zero-value Subject; TestActivityHandler_UnhonourableSubjectKindIsDropped",
    "decisions — two reads over unchanged records are byte-identical": "opsevent.Merge total order; TestActivityHandler_RowOrderIsByteIdenticalAcrossReads",
    "story 53 — an unauthenticated caller is refused by the existing front-door auth gate disclosing no fact; an authenticated operator answers": "the route is registered on the shared /api/v1 mux (NewHandler) which sits behind the community door's forward_auth (DDR 0172, internal/controlapi/authgate.go) exactly as overview/fleet; no route-level auth and no pre-gate disclosure added — structural, the same posture every controlapi read ships"
  },
  "summary": "Built the controlapi Activity read-composition (bounded fan-out with per-source status as a value, deterministic merge, horizon, standing-alert band) plus its OpenAPI route, regenerated client and HttpActivityClient, completing the engineering of the P12 activity feed.",
  "reason": "",
  "blockers": []
}
**close-report** for #830 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 830, "status": "success", "commits": [ "1a3e517" ], "changed_files": [ "STATUS.md", "dashboard/src/lib/activity.ts", "dashboard/src/lib/api/activityClient.ts", "dashboard/src/lib/api/generated.ts", "dashboard/tests/unit/activityLive.test.ts", "internal/controlapi/activity.go", "internal/controlapi/activity_integration_test.go", "packages/openapi-spec/openapi.yaml", "packages/openapi-spec/tests/unit/spec.test.ts" ], "tests": [ { "command": "go test -race ./internal/controlapi/ -run TestActivity", "exit_code": 0 }, { "command": "go test -count=1 ./internal/controlapi/", "exit_code": 0 }, { "command": "go test ./internal/opsevent/", "exit_code": 0 }, { "command": "go build ./...", "exit_code": 0 }, { "command": "go vet ./internal/controlapi/", "exit_code": 0 }, { "command": "gofmt -l internal/controlapi/activity.go internal/controlapi/activity_integration_test.go", "exit_code": 0 }, { "command": "node packages/openapi-spec/scripts/generate-client.mjs --check", "exit_code": 0 }, { "command": "CI=true npx vitest run (dashboard, 1084 tests)", "exit_code": 0 }, { "command": "CI=true npx vitest run (openapi-spec, 7 tests)", "exit_code": 0 }, { "command": "npx vue-tsc -p tsconfig.json --noEmit (dashboard)", "exit_code": 0 }, { "command": "npx eslint src/lib/activity.ts src/lib/api/activityClient.ts tests/unit/activityLive.test.ts", "exit_code": 0 }, { "command": "pre-push gate: .sandcastle/gate.sh --prepush (full Go seam build/vet/lint/test)", "exit_code": 0 } ], "criteria": { "story 54 — a single read returns the merged newest-first events, standing alerts, per-source status and horizon, a thin projection mapping faults to the Problem body": "internal/controlapi/activity.go (serve/fanOut compose Activity{Events,StandingAlerts,Sources,Horizon} via opsevent.Merge); TestActivityHandler_ComposesTheChronologyFromEveryOwner", "story 55 — each source asked within the window, merged and truncated deterministically by time, never unbounded/offset": "resolveActivityWindow resolves today/7d/30d to an absolute opsevent.Window before fan-out; opsevent.Merge total order + MaxRows truncation; TestActivityHandler_WindowIsARequestBound", "story 58 — one source erroring/timing out returns the other sources' events plus a per-source status naming the failed source, since when and how many attempts; the read does not fault; the absence is never an empty result": "fetchSource retries under a per-source deadline and returns ActivitySourceStatus{answered:false,since,attempts}; TestActivityHandler_OneSourceFailingIsAValueNotAFault + TestActivityHandler_TimeoutIsAValueNotAFault", "story 44 — every source failing (or the read faulting) returns the shared Problem body": "serve returns writeProblem 500 when answered==0; TestActivityHandler_EverySourceFailingReturnsTheProblemBody", "story 59 — the read reports the oldest event returned and its source, no statement beyond that": "horizonOf reports ActivityHorizon{oldest,source} from the truncated merge; asserted in TestActivityHandler_ComposesTheChronologyFromEveryOwner and the zero-horizon case", "story 60 — standing raised alerts are monitoring's existing query, projected not re-classified, with monitoring's own drill-in intent, never merged into the event rows": "standingAlerts() reads svc.StandingAlerts() carried in the separate standing_alerts field; TestActivityHandler_ComposesTheChronologyFromEveryOwner asserts no leak into events", "stories 29-30 — the operation-log handle carried only where the owner has one, never fabricated": "projectEvents carries e.LogRef verbatim (log_ref omitempty); seed data proves handles present only on monitoring/updates rows", "stories 31-32 — each event's drill-in is the owning feature's own DrillInIntent, reusing the Overview shape; the composition maps no owner": "projectEvents copies opsevent.DrillIn verbatim into ActivityDrillIn; asserted in the compose test and activityLive.test.ts", "story 48 — an event whose subject kind cannot be honoured is dropped with a control-plane log line": "opsevent.Merge(h.log, ...) drops+logs the zero-value Subject; TestActivityHandler_UnhonourableSubjectKindIsDropped", "decisions — two reads over unchanged records are byte-identical": "opsevent.Merge total order; TestActivityHandler_RowOrderIsByteIdenticalAcrossReads", "story 53 — an unauthenticated caller is refused by the existing front-door auth gate disclosing no fact; an authenticated operator answers": "the route is registered on the shared /api/v1 mux (NewHandler) which sits behind the community door's forward_auth (DDR 0172, internal/controlapi/authgate.go) exactly as overview/fleet; no route-level auth and no pre-gate disclosure added — structural, the same posture every controlapi read ships" }, "summary": "Built the controlapi Activity read-composition (bounded fan-out with per-source status as a value, deterministic merge, horizon, standing-alert band) plus its OpenAPI route, regenerated client and HttpActivityClient, completing the engineering of the P12 activity feed.", "reason": "", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#830
No description provided.