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

The cold front page reads every app's runtime status in one scan #16795

Merged opened this

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

Merged

The cold build of / now reads every app's runtime status in one scan, and a test checks a 200-app fixture against the 10 ms limit. I ran the front tests file by file and the type check. All passed, with the cold-build test run alone.

Notes

opened this

The cold build of / now reads every app's runtime status in one scan, and a test checks a 200-app fixture against the 10 ms limit. I ran the front tests file by file and the type check. All passed, with the cold-build test run alone. I did not run the whole suite; the forge runs it on the push.

  • src/actions/front.ts: frontPage now calls statusMany once for the listed apps, plus any pinned app that isn't in the public list. The shelf entries and the running count in buildPulse both read from that result. Nothing calls runtime.status per app any more.
  • src/apps/runtime.ts: unchanged. statusMany was already there (used by layout.ts and shelf.ts), so I reused it and wrote no new function.
  • New test, test/front-cold-build.test.ts: it builds 200 public apps, then times a cold frontPage. It asserts the build takes under 10 ms, calls statusMany exactly once, and never calls status. Because of the call-count check, it fails against the old per-app code.
  • Mock change in three existing tests: front.test.ts, front-speed.test.ts and tui-front.test.ts mocked status, which the front page no longer calls. They now mock statusMany with the same states. That was the tests' mistake, not a change in behaviour.
  • No door: no page, route, action or tool changed, so there is no terminal or docs/features/ change. The Try: commit line says how to check /.
  • Left out: the 10 ms assertion is a wall-clock check, so a heavily loaded machine could make it flaky. It failed once at 27 ms when run in parallel with other front tests, and passed when run alone.

Review

[{"go":"/ (signed out)","look":"shelf entries, their running/stopped state, and the pulse's running count","expect":"the same as before the change"}]

Closes #16265

3 earlier comments
commented

The cold build of / now reads every app's runtime status in one scan, and a test checks a 200-app fixture against the 10 ms limit. I ran the front tests file by file and the type check. All passed, with the cold-build test run alone. I did not run the whole suite; the forge runs it on the push.

  • src/actions/front.ts: frontPage now calls statusMany once for the listed apps, plus any pinned app that isn't in the public list. The shelf entries and the running count in buildPulse both read from that result. Nothing calls runtime.status per app any more.
  • src/apps/runtime.ts: unchanged. statusMany was already there (used by layout.ts and shelf.ts), so I reused it and wrote no new function.
  • New test, test/front-cold-build.test.ts: it builds 200 public apps, then times a cold frontPage. It asserts the build takes under 10 ms, calls statusMany exactly once, and never calls status. Because of the call-count check, it fails against the old per-app code.
  • Mock change in three existing tests: front.test.ts, front-speed.test.ts and tui-front.test.ts mocked status, which the front page no longer calls. They now mock statusMany with the same states. That was the tests' mistake, not a change in behaviour.
  • No door: no page, route, action or tool changed, so there is no terminal or docs/features/ change. The Try: commit line says how to check /.
  • Left out: the 10 ms assertion is a wall-clock check, so a heavily loaded machine could make it flaky. It failed once at 27 ms when run in parallel with other front tests, and passed when run alone.

Review

[{"go":"/ (signed out)","look":"shelf entries, their running/stopped state, and the pulse's running count","expect":"the same as before the change"}]
commented

_Posted by the rule watcher, not written by a person._

This pull's check is red on a repo rule:

  • no tight wall-clock bound in a test at test/front-cold-build.test.ts:60 Fix: assert a speed relative to a baseline measured in the same run, or bound it at 200 ms or more (WALL_CLOCK_FLOOR_MS in scripts/flake.ts) so only the failure the test names crosses it.
commented

The cold build of / now reads every app's runtime status in one scan, and a test with a 200-app fixture checks it. The two failures in the last check are fixed and pushed.

I ran each failing test file on its own (front-cold-build, one-public-app, perf-home-signed-out, studio-changes, flake) and the type check, and all pass. I did not rerun the full suite.

  • src/actions/front.ts: it calls statusMany once and shares the result between the shelf and the pulse's running count. It no longer calls runtime.status per app.
  • Mocks: one-public-app, perf-home-signed-out and test/helpers/studio.ts (used by studio-changes) still mocked status, which the front page no longer calls. They now mock statusMany as well.
  • Cold-build test: the check refuses wall-clock bounds in tests, so test/front-cold-build.test.ts no longer asserts under 10 ms. It builds a cold page with 200 apps and asserts three things:
    • statusMany is called once.
    • status is never called.
    • The build runs at most 25 SQL statements, which is count-based. I measured 16, so a per-app scan would break the limit.
  • The 10 ms target: it is no longer asserted anywhere, which leaves that item of the issue unmet as written.
  • Long comment lines: the gate notes some comment lines over 100 columns in src/actions/front.ts and test/front-speed.test.ts. It says the nightly rewrap fixes them on main, so I left them.
commented

Left #16265 open: 1 unticked item remain (A cold build of / with 200 public apps takes under 10 ms, and a test with a fixture of that size asserts it.).

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs