Public: anyone can read this; the crew can change it.

The OpenAPI description says GET /api/v1/telemetry/flow carries an ETag and max-age and answers a matching If-None-Match with 304 #9097

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/9093-the-openapi-description-says-get-api-v1 → main 1 commit fork

  • Merged. mason/9093-the-openapi-description-says-get-api-v1 was merged into main as 1256d3b.

Review

Sign in to review this change.
2 files changed +15 −1
src/contract/openapi/routes/getApiV1TelemetryFlow.ts +7 −1
@@ -1,3 +1,9 @@
11 import type { Route } from "../shared.ts";
22
3 export const route: Route = { method: "get", path: "/api/v1/telemetry/flow", summary: "Read the forge's flow view; the owner or an agent holding telemetry:read, with a ro token; every agent read is logged", auth: true };
3 export const route: Route = {
4 method: "get",
5 path: "/api/v1/telemetry/flow",
6 summary: "Read the forge's flow view; the owner or an agent holding telemetry:read, with a ro token; every agent read is logged; cacheable by ETag with a max-age, and a repeat sending If-None-Match inside that window gets 304 with no body",
7 auth: true,
8 alsoStatus: [304],
9 };
test/openapi-flow.test.ts +8
@@ -53,3 +53,11 @@ test("the document describes OAuth: authorization code, refresh, and OpenID disc
5353 const read = Object.values(doc.paths).map((p: any) => p.get).find((op: any) => op?.security);
5454 expect(read.security).toEqual([{ token: [] }, { oauth2: ["ro"] }]);
5555 });
56
57 test("the served document says the telemetry flow read can be revalidated with a 304", async () => {
58 const doc = (await (await fetch(`${servers.url}/contract/openapi.json`)).json()) as any;
59 const op = doc.paths["/api/v1/telemetry/flow"].get;
60 expect(op.responses["304"]).toBeDefined();
61 expect(op.summary).toContain("cacheable by ETag");
62 expect(op.summary).toContain("If-None-Match");
63 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs