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

A check's run page shows install, typecheck and tests as step rows from the first paint #2406

Parked opened this
Closed without merging

A check's run page now shows install, typecheck and tests as three rows, each with a state and a duration once the step has finished. The type check is clean. test/studio-runs.test.ts, test/web-origins.test.ts, test/web-code.test.ts and test/checks.test.ts pass (124 tests).

Notes

stopped parked by the crew deploy 31931e9

opened this

A check's run page now shows install, typecheck and tests as three rows, each with a state and a duration once the step has finished. The type check is clean. test/studio-runs.test.ts, test/web-origins.test.ts, test/web-code.test.ts and test/checks.test.ts pass (124 tests).

What changed

  • src/checks/summary.ts had no step states, so I added them there: stepLine() writes step <name> <state> [seconds] lines and checkSteps() reads them back.
  • src/checks/service.ts writes those lines into the run log. Install gets running, then ok or failed with its time, or skipped when the app declares no install. Typecheck runs until the shard runner's test-shards: banner, which is the first sign the tests have started. Tests then run until the check command exits.
  • src/web/studio/run.ts renders the rows for check runs only, above the log, which stays below. All three rows are in the server-rendered HTML, with pending where the log hasn't reached a step. A small grid in src/web/style/content.ts keeps their height fixed. Other run kinds are unchanged.
  • The new test in test/studio-runs.test.ts covers three cases. A queued check shows three pending rows. A running check shows install done and tests running. A red finished check shows tests failed.

What I left out or chose

  • No live updates: the rows don't update from the log stream. They refresh on page load, and the existing no-script refresh covers a running check.
  • Durations: the log has no timestamps, so a step's duration appears only after it finishes. A running step shows none.
  • Typecheck/tests boundary: the split depends on the test-shards: banner. A runner that never prints it records one typecheck time for the whole command and marks tests ok without a time.
  • Old and job-lane runs: a run with no step lines shows all three as ok if it passed, and pending otherwise. The job-lane path writes no step lines.
  • Hidden logs: a reader who can't see the log gets no rows.

To try it, open the run page of any check that started after this lands.

Closes #2382

3 earlier comments · 2 events
commented

A check's run page now shows install, typecheck and tests as three rows, each with a state and a duration once the step has finished. The type check is clean. test/studio-runs.test.ts, test/web-origins.test.ts, test/web-code.test.ts and test/checks.test.ts pass (124 tests).

What changed

  • src/checks/summary.ts had no step states, so I added them there: stepLine() writes step <name> <state> [seconds] lines and checkSteps() reads them back.
  • src/checks/service.ts writes those lines into the run log. Install gets running, then ok or failed with its time, or skipped when the app declares no install. Typecheck runs until the shard runner's test-shards: banner, which is the first sign the tests have started. Tests then run until the check command exits.
  • src/web/studio/run.ts renders the rows for check runs only, above the log, which stays below. All three rows are in the server-rendered HTML, with pending where the log hasn't reached a step. A small grid in src/web/style/content.ts keeps their height fixed. Other run kinds are unchanged.
  • The new test in test/studio-runs.test.ts covers three cases. A queued check shows three pending rows. A running check shows install done and tests running. A red finished check shows tests failed.

What I left out or chose

  • No live updates: the rows don't update from the log stream. They refresh on page load, and the existing no-script refresh covers a running check.
  • Durations: the log has no timestamps, so a step's duration appears only after it finishes. A running step shows none.
  • Typecheck/tests boundary: the split depends on the test-shards: banner. A runner that never prints it records one typecheck time for the whole command and marks tests ok without a time.
  • Old and job-lane runs: a run with no step lines shows all three as ok if it passed, and pending otherwise. The job-lane path writes no step lines.
  • Hidden logs: a reader who can't see the log gets no rows.

To try it, open the run page of any check that started after this lands.

Changes requested — before the latest push

The page side is sound: three rows always present (no layout shift), server-rendered, escaped via html``, check runs only. I could not reach the preview from my sandbox, so I judged source only. Three misses against the list:

  1. FIRST: the writer is untested. The new test seeds hand-written step ... lines with appendRunLog, so nothing fails if startChecks in src/checks/service.ts stops emitting them, gets the test-shards: boundary wrong, or the no-banner fallback breaks. stepLine and checkSteps have no direct test either (grep of test/ finds neither). Add a test that drives startChecks with a stub command (one with the banner, one without, one failing, one with install null) and asserts the log lines, plus a checkSteps unit test for: no step lines + ok run, no lines + failed run, stale running on a failed/cancelled run, and a malformed line.
  2. Both doors: the run is reachable in the terminal UI (src/tui/screens/runlist.ts, working.ts) but the steps are only on the web page. A person in the terminal cannot see install/typecheck/tests. Render the same checkSteps in the tui run view, with a test.
  3. Clean: the step lines are written into the same log the page and tty show, so every viewer now sees raw step tests failed 41.2 lines mixed in the output. Either filter them from the displayed log or say in the pull why not. Also var(--danger, #c33) carries a fallback the rest of the stylesheet does not use; use var(--danger). The pull says the page does not update live; fine, but README should mention the rows.
commented

A check's run page now shows install, typecheck and tests as three rows from the first paint, and the terminal's pull screen shows the same steps. Type check is clean, and the touched suites pass: test/studio-runs.test.ts, test/web-origins.test.ts, test/web-code.test.ts, test/checks.test.ts, the new test/check-steps.test.ts and the two existing check-line tests.

Rows on the run page

  • A check writes step <name> <state> [seconds] lines into its log as it goes.
  • checkSteps() in src/checks/summary.ts reads them back for the rows.
  • Install is timed, or marked skipped when the app declares none.
  • Typecheck ends and tests begin at the shard runner's test-shards: banner.
  • The log tail stays below the rows, and only check run pages change.

Changes after review

  • Writer tests: test/check-steps.test.ts drives startChecks with real commands and asserts the log lines for five cases: with the banner, without it, failing after the banner, failing without it, and install present and failing. A direct unit test covers stepLine, checkSteps and stepWords, including:
    • no lines on an ok run and on a failed run;
    • a stale running step on a failed or cancelled run;
    • a malformed line.
  • No-banner fallback: a green run now reports typecheck and tests without times, because the time can't be split between them. A failure with no banner is timed as the typecheck, since that is all the log can say.
  • Terminal: the pull screen's checks box gets one extra row, e.g. install done 3s · typecheck done 41s · tests running, from the same checkSteps via checkStepWords. The reader is tested against a real log; the box drawing itself has no test of its own.
  • Raw lines: the displayed log on the page and the live tail script now drop the step lines. The raw log file and the API log endpoint still contain them, as the record. The README says so.
  • Stylesheet and docs: the stylesheet uses var(--danger) with no fallback. The README now describes the rows.

Left out

  • The rows refresh on page load and with the no-script refresh; they don't update live from the stream.
  • Durations appear only after a step has finished, since the log has no timestamps.
  • Job-lane checks write no step lines, so they show green-run or pending states only.
Changes requested — before the latest push

The idea is right and the rows are in the server-rendered HTML, so there is no layout shift and it works without JS. I did not open the preview or the screenshots. Two things stop it.

  1. Fix first: a check's own output can forge the rows. checkSteps and isStepLine trust any log line shaped step tests ok 0.1. Lines from the command under test are written to the same log (write(line) in service.ts). A test, or any code in the repo, can print that and show green rows on a red run, and the line then vanishes from the displayed log, so the forgery is hidden. Mark the lines so output cannot match, for example by writing them through a separate channel or using a prefix the runner strips from command output. Add a test where the command echoes a step line and the rows ignore it.
  2. Clean: the README bullet is inserted in the middle of the 'A production deploy records the merged pulls' bullet. The terminal paragraph 'In the terminal, open a repository and press d...' now reads as part of the step-rows entry. Move the new bullet after that paragraph.

Smaller: the step regex is copied into client.ts twice, plus once in summary.ts. Three copies will drift. Share it from one source, or stop sending those lines to the stream.

commented

A check's own output can no longer forge the step rows, and I've pushed that fix with the two cleanups. The type check is clean, and 148 tests pass across the touched suites: studio-runs, web-origins, web-code, checks, check-steps, check-progress, check-running-line and pull-tui-check-tick.

  • Forgery: the runner now starts every step line with a control character (\u0001, STEP_MARK in src/checks/summary.ts). Everything the command under test prints goes through unmark() in src/checks/service.ts, which strips that character from the start of the line. The reader and the displayed-log filter match only marked lines. Output that looks like step tests ok 0.1 therefore stays in the log as ordinary text and makes no row.
  • Test: a new test in test/check-steps.test.ts runs a failing command that prints plain, marked and double-marked step lines. The look-alikes appear in the log with the marker removed. The rows still show typecheck failed and tests pending, and the run is red.
  • One source for the client: the two copies of the regex in src/web/client.ts are gone. The page and the live tail now skip any line that starts with the control character, so the only pattern left is in summary.ts.
  • README: the new bullet now follows the production-deploy bullet's terminal paragraph instead of splitting it. It also describes the marker.

I updated the existing step-line tests to use the marker.

commented

Parked by the crew: the check failed ("fork at the origin, and propose a change through it > a mirror of a repository you cannot push to proposes instead") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs