perf(cli): project recent-results fields in checks get#1353
Merged
Conversation
The default `checks get <id>` screen only renders a narrow recent-results table, but it was fetching full result bodies (metadata, assets, apiCheckResult, browserCheckResult, ...) from /v2/check-results, which can trigger slow paths for result-heavy checks. Now that the backend supports a `fields` query parameter (checkly/monorepo#2384), request only the columns the table needs. - rest: add CheckResultField union, extend ListCheckResultsParams with `fields?`, and normalize the array to a comma-separated query string in getAll() rather than relying on Axios array serialization. - checks get: pass a fixed internal projection (id, startedAt, runLocation, hasErrors, hasFailures, isDegraded, responseTime) for detail/markdown output. No new public flag is added; the projection is internal and fixed. - JSON output intentionally omits `fields` to preserve full `results` entries for existing consumers. - --result drilldown and the --include-attempts window query are unchanged and still request full payloads. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
hwartig
previously approved these changes
Jun 17, 2026
The two `test-global-files-bundling-*/should include global files` tests omitted the `DEFAULT_TEST_TIMEOUT` (180s) that every sibling test in playwright-check.spec.ts passes, so they fell back to vitest's 5000ms default. `parseProject()` does real bundling + tar work that exceeds 5s on the slower windows-latest-x64 CI runner, timing out reliably there (it stays just under 5s on Linux, which is why main looked green). Pass the timeout like the rest of the file. Unrelated to the recent-results projection change, but folded in here because it was blocking this PR's required `test - windows-latest-x64` check and a rerun did not clear it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
hwartig
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Affected Components
Notes for the Reviewer
Now that the backend supports a
fieldsquery parameter onGET /v2/check-results/{checkId}(checkly/monorepo#2384, merged), this is a small additive optimization for the human-facingchecks get <id>path.The default
checks getscreen only renders a narrow recent-results table, yet it was fetching full result bodies (metadata,assets,apiCheckResult,browserCheckResult, …). Asking the API for those wide payloads is unnecessary and can trigger slow paths for result-heavy checks. This change asks the API only for the columns the table actually renders.What changed
rest/check-results.ts: added aCheckResultFieldunion matching the backend-supported field names, extendedListCheckResultsParamswithfields?: CheckResultField[], and normalized the array to a comma-separatedfields=...query string ingetAll()rather than relying on Axios array serialization (backend accepts bothfields=id,startedAtand repeated params; the comma form is the most predictable across HTTP clients).commands/checks/get.ts: passes a fixed internal projection —id, startedAt, runLocation, hasErrors, hasFailures, isDegraded, responseTime— for detail/markdown output. These are exactly whatformatResults()andresolveResultStatus()read.Deliberate product/API choices
checks getaggregates check details, status, analytics, error groups, and results, so a generic--fields/mode flag would be ambiguous. The projection is internal and fixed. Help output is unchanged.fieldsso existing--output jsonconsumers keep fullresultsentries (backwards compatibility). Locked in by a test.--result <id>drilldown is unchanged — it uses the v1 detail endpoint and needs the full result payload for the detail renderer.--include-attemptswindow query is also untouched and still requests full payloads.fieldsis omitted.Tests added
rest/__tests__/check-results.spec.ts—fieldsarray serializes to a comma-separated string; omitted when absent; other params pass through.commands/__tests__/checks-get-results-projection.spec.ts— default + markdown request the projection (withlimit/nextIdunchanged); cursor forwarded;--output jsondoes not sendfields;--resultusescheckResults.getand never callsgetAll.Verification
eslint,prepare:dist(tsc typecheck),prepack(oclif manifest): all clean.checks get --helpsmoke: no new flag, output intact.checks get <id>call (needs a real check ID + authenticated request). Suggested manual check:CHECKLY_ENV=staging checkly checks get <id>and confirm the outgoing request includesfields=id,startedAt,runLocation,hasErrors,hasFailures,isDegraded,responseTimewhile terminal output is unchanged.🤖 Generated with Claude Code