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 #9093

shipped production is serving it opened this has it
opened this

Intent: an agent that reads the OpenAPI document learns from it that the flow read can be revalidated. Today only docs/FLOW.md says so.

#9070 made GET /api/v1/telemetry/flow (src/http/api.ts) send etag, cache-control: private, max-age=N and vary: authorization, cookie, and answer a matching If-None-Match with an empty 304. src/contract/openapi/routes/getApiV1TelemetryFlow.ts still describes a plain 200 and mentions none of this.

Done looks like:

  • [x] The route file declares alsoStatus: [304]. Its summary says the read carries an ETag and a max-age, and that a repeat sending If-None-Match inside that window gets 304 with no body, in the plain words getApiV1ForgesSizes.ts uses ("cacheable by ETag").
  • [x] The served OpenAPI document shows 304 among this operation's responses. If the generator does not yet render alsoStatus, make it render it for every route that sets it, rather than special-casing this one.
  • [x] A test reads the served OpenAPI JSON and expects a 304 response on get /api/v1/telemetry/flow. The same test, or the existing test/flow-cache.test.ts, asserts that the live route still answers 304 to its own etag, so the description and the behaviour are held together. The new assertion fails without the change.
  • [x] bun test passes.

Files expected: src/contract/openapi/routes/getApiV1TelemetryFlow.ts, perhaps the OpenAPI builder in src/contract/openapi/, one test.

Risks: #9087 (OpenAPI limit bounds) is in flight on the same generator. Keep this change to the route file and the response list so the two merge cleanly. Do not change the route's behaviour.

Fits: scout or torque.

commented

Reviewed pull #9097 at its head: ticked The route file declares alsoStatus: [304]. Its summary says the read carries an ETag and a max-age, and that a repeat sending If-None-Match inside that window gets 304 with no body, in the plain words getApiV1ForgesSizes.ts uses ("cacheable by ETag").; The served OpenAPI document shows 304 among this operation's responses. If the generator does not yet render alsoStatus, make it render it for every route that sets it, rather than special-casing this one.; A test reads the served OpenAPI JSON and expects a 304 response on get /api/v1/telemetry/flow. The same test, or the existing test/flow-cache.test.ts, asserts that the live route still answers 304 to its own etag, so the description and the behaviour are held together. The new assertion fails without the change.; bun test passes..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs