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

A commit's check in the API says how many screens tall each look is and which phone look scrolls sideways #9490

Merged opened this

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

Merged

Both check routes in the API now carry `looks: [{look, screens, sideways}]`. I ran `tsc`, `scripts/gate.ts` and the tests that cover the change and all passed. I did not run the full suite; the forge's check does that on the push.

shipped production is serving it deploy 3d07d6f

opened this

Both check routes in the API now carry looks: [{look, screens, sideways}]. I ran tsc, scripts/gate.ts and the tests that cover the change and all passed. I did not run the full suite; the forge's check does that on the push.

  • Commit check: GET …/commits/:oid/check reads the looks of the run that answered it. That run's own vitals file wins; if it has none, the commit's filed looks are used. When no run answered (runId is null), the looks come from the commit's filed looks alone.
  • Pull checks: GET …/pulls/:number/checks carries the same looks beside run, taken from the latest run at the pull's head.
  • Shape: screens is the one-decimal string, and "" when the look has no recorded size. sideways is true only for a phone look wider than its window. [] means no file or a reader who may not read runs (mayReadRuns).
  • Same data as the run page: the figures come from the same readLooks and vitalsRows the run page uses, through a new looksOfCheck in src/actions/runs.ts. No new file is written.
  • Test: test/check-looks-api.test.ts writes a vitals file with a size for a run and checks both routes. It expects "2.5" with sideways: true for a wide phone look, "1.3" and false for one that fits, and [] for a run without a file. It fails without the source change.
  • Docs: docs/features/vitals-screens.md names the field.

Left out: no skipped reason in the API output, since the issue asked for {look, screens, sideways} only. A skipped look appears with screens: "".

Closes #9487

commented

Both check routes in the API now carry looks: [{look, screens, sideways}]. I ran tsc, scripts/gate.ts and the tests that cover the change and all passed. I did not run the full suite; the forge's check does that on the push.

  • Commit check: GET …/commits/:oid/check reads the looks of the run that answered it. That run's own vitals file wins; if it has none, the commit's filed looks are used. When no run answered (runId is null), the looks come from the commit's filed looks alone.
  • Pull checks: GET …/pulls/:number/checks carries the same looks beside run, taken from the latest run at the pull's head.
  • Shape: screens is the one-decimal string, and "" when the look has no recorded size. sideways is true only for a phone look wider than its window. [] means no file or a reader who may not read runs (mayReadRuns).
  • Same data as the run page: the figures come from the same readLooks and vitalsRows the run page uses, through a new looksOfCheck in src/actions/runs.ts. No new file is written.
  • Test: test/check-looks-api.test.ts writes a vitals file with a size for a run and checks both routes. It expects "2.5" with sideways: true for a wide phone look, "1.3" and false for one that fits, and [] for a run without a file. It fails without the source change.
  • Docs: docs/features/vitals-screens.md names the field.

Left out: no skipped reason in the API output, since the issue asked for {look, screens, sideways} only. A skipped look appears with screens: "".

commented

The gate failed because no commit message had a "Try:" line. I added an empty follow-up commit with one and pushed it. I couldn't amend the first commit because force pushes are refused. bun scripts/gate.ts now prints nothing locally, which I take to mean it passes. The forge's check will confirm on this push.

What changed in the pull: GET /api/v1/repos/:owner/:name/commits/:oid/check and GET …/pulls/:number/checks now carry looks: [{look, screens, sideways}]. They are built with readLooks and vitalsRows through a new looksOfCheck in src/actions/runs.ts. screens is the one-decimal string, "" without a size, and sideways is true only for a phone look wider than its window. The list is [] when there are no looks or the reader may not read runs. test/check-looks-api.test.ts covers both routes, and docs/features/vitals-screens.md names the field.

Left out: the skipped reason is not in the API output, since the issue asked for those three fields only. A skipped look appears with screens: "".

Try it: on the preview, call GET /api/v1/repos/<owner>/<name>/commits/<oid>/check or GET /api/v1/repos/<owner>/<name>/pulls/<n>/checks and read looks.

Approved

Clean, small, one concept (looksOfCheck). Gated by mayReadRuns, reuses readLooks/vitalsRows, no new write path, no new dependency, doc added in docs/features/vitals-screens.md, not README. Tests cover both routes (screens, sideways, [] without a file). Not covered by a test: the fallback to the commit filed looks, which is optional follow-up.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs