Document flaky-tests API conventions and pagination#173
Conversation
…ation, Bundle Upload ID Expand the Flaky Tests API reference index page with an "API conventions" section covering behavior that applies across endpoints. Sourced from recurring customer questions: page_token misuse returning 500s, "missing" tests that were actually on later pages, rate-limit expectations for polling automation, and webhook-to-API immediacy. Also documents three things that weren't surfaced anywhere in narrative form: Bundle Upload IDs are support-only, auto-analysis has a default monthly cap during Beta, and the UI's GraphQL endpoint is private. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ea55da9 to
4aaa9a7
Compare
|
Code verification (2026-06-01): 8 confirmed / 0 contradicted / 1 ambiguous / 1 unverifiable
No contradictions. Nothing blocks publishing on a factual-accuracy basis. Two items the author should tighten before merge:
Source #1 — page_size capped at 100 (confirmed)File: const MAX_PAGE_SIZE = 100;
export const PAGE_REQUEST_SCHEMA = z
.object({
page_size: z
.number()
.int()
.min(1)
.max(MAX_PAGE_SIZE)
.openapi({ description: "The number of tests to return per page." }),Reasoning: Source #2 — pagination field names (confirmed)File: page_token: z
.string()
.optional()
.openapi({ description: "The page token to use for pagination. ...", examples: [""] }),
...
next_page_token: z.string().openapi({ ... }),
prev_page_token: z.string().openapi({ ... }),
last_page_token: z.string().openapi({ ... }),Reasoning: Request schema defines Source #3 — list endpoint names (confirmed)File: path: "/flaky-tests/list-quarantined-tests",
...
path: "/flaky-tests/list-unhealthy-tests",
...
path: "/flaky-tests/list-failing-tests",Reasoning: All three endpoint paths exist as registered protected routes, each destructuring Source #4 — first page empty token (confirmed)File: page_token: z
.string()
.optional()
.openapi({
description:
"The page token to use for pagination. This is returned from the previous call to this endpoint. For the first page, this should be empty.",
examples: [""],
}),Reasoning: Source #5 — invalid page_token returns 500 (confirmed, behavioral)File: logger.warn("Global error handler caught an error - returning 500", { ... });
res.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
message: "An unexpected error occurred. Please try again later.",
});Reasoning: The route forwards Source #6 — Bundle Upload ID printed by CLI (confirmed)File: pub fn get_bundle_upload_id_message(bundle_upload_id: &str) -> String {
format!("🏷️ Bundle Upload ID: {}", bundle_upload_id)
}Reasoning: The upload command prints exactly Source #7 — Bundle Upload ID not exposed via public API (confirmed)File: Reasoning: No Source #8 — x-api-token header (confirmed)File: const apiToken = parseResult.data[API_TOKEN_HEADER_KEY];Reasoning: Protected routes read the org token from Source #9 — status_changed webhook / healthy→flaky (ambiguous)File: ### `v2.test_case.status_changed`
Emitted when a test case changes status (e.g., becomes flaky or is resolved), as triggered by a monitor.
| `type` | string | Always `v2.test_case.status_changed` |
| `previous_status` | string | The prior status of the test case |
| `new_status` | string | The updated status of the test case |Reasoning: The PR's " Source #10 — immediate webhook-to-API propagation (unverifiable)File: n/a Reasoning: "There is no eventual-consistency window between the webhook and the read APIs" is a timing guarantee about the backend write/read path, not a name/value/path claim. It cannot be confirmed from the public API schema or route definitions. Needs a backend trace or eng confirmation. Not blocking, but recommend softening unless eng confirms a hard guarantee. |
Reopens the work from #57, which was merged then reverted on 2026-06-01 (it was not ready to merge). Content is unchanged from the original branch; needs content verification against source before re-merging. Reverted merge commit removed from main.