Adds the `lastActivityAt` field to the response body of the `/api/health` endpoint exposed by the edge broker. The field reports the most recent successful request timestamp from the container, defaulting to the container's start time when no requests have been served yet. The field is also surfaced on `broker.state` (alongside a new `containerStartedAt`) so callers can observe the activity timestamp without performing an HTTP round-trip. The Writerside `API-Reference.topic` and its generator are updated to document the new field. Resolves TRU-6 (AUT-2). ## Example request ```sh curl -s http://edge-broker:8080/api/health ``` ```json { "ok": true, "service": "edge-broker", "auth_mode": "manager", "manager_url_configured": true, "shared_secret_configured": true, "agents_connected": 0, "lastActivityAt": "2026-08-15T19:15:34.898Z" } ``` ## Documentation The diff for the writerside topic that documents the new field lives in this PR — see [`documentation/topics/API-Reference.topic`](https://github.com/copenhagentruckwash/api/blob/10f28d6/documentation/topics/API-Reference.topic) (vs. [the previous version at `origin/develop`](https://github.com/copenhagentruckwash/api/blob/cdf8541/documentation/topics/API-Reference.topic)) in the [PR "Files changed" view](https://github.com/copenhagentruckwash/api/pull/373/files). The same paragraph is reproduced by `scripts/generate_writerside_openapi_docs.py` so future regenerations preserve it. **What consumers need to re-read.** `API-Reference.topic` adds a paragraph documenting the new `lastActivityAt` ISO 8601 timestamp on the edge broker's `/api/health` response. Consumers that previously inferred broker activity from indirect signals (e.g. comparing `agents_connected` across polls or assuming a fresh process meant a fresh state) should now read `lastActivityAt` directly: it is the timestamp of the most recent successful HTTP request handled by the broker container, and defaults to `containerStartedAt` until the first request lands. No request or response shape changes; the field is purely additive. ## Tests `node --test services/edge-broker/test/broker.test.mjs` covers both the shape of the new field on `/api/health` and the fact that `lastActivityAt` advances on every successful request after `containerStartedAt`. All 21 broker tests pass locally. --- _This PR description was generated by an OpenHands AI agent on behalf of jepp9350._ Co-authored-by: Jeppe <jeppe@copenhagentruckwash.io> Co-authored-by: openhands <openhands@all-hands.dev>
12 lines
808 B
XML
12 lines
808 B
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE topic
|
|
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
|
|
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
|
|
title="API Reference" id="API-Reference">
|
|
|
|
<!-- AUTO-GENERATED, DO NOT EDIT -->
|
|
<p>Comprehensive API reference generated from the repository root <code>openapi.yaml</code>.</p>
|
|
<p>The edge broker's <code>/api/health</code> response additionally exposes a <code>lastActivityAt</code> field (ISO 8601 timestamp). It reports the most recent successful HTTP request handled by the broker container and defaults to the container's start time when no request has been processed yet.</p>
|
|
</topic>
|