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

New forge never refreshes the Places catalog, so a cloud stays unpickable unt… #16576

opened this in answer to

Check · Review · Land · Live — Its check is red. Next: builder, its check is red.

Ready to land

GET /forges/new and GET /pricing now read the Places catalog again when it is stale, so a cloud no longer waits for someone to open Places. The new test passes with the change and fails without it. It also passes alongside places-api, new-forge-places and order-cloud.

Notes · 5 files · +127 −2

stopped failed before it answered — 25873 passed, 3 failed: at most three streams per token; an abort frees a place, every job src/ runs under `during` is timed here or named in UNTIMED with a reason, asking again over HTTP > a writer queues a check and gets the run deploy 9f253ba

Check failed: at most three streams per token; an abort frees a placeCheck of 9f253bachecked against main at 7f70438fast tier: red in 23m51s

Website spec: 25 findings (report only)

Look

9 pages beside main · 0 new to this pull

/apps

main

at 7f70438 ·

this pull

In the dark

main

at 7f70438 ·

this pull

at 9f253ba ·

/changelog

main

at 7f70438 ·

this pull

In the dark

main

at 7f70438 ·

this pull

at 9f253ba ·

/docs

main

at 7f70438 ·

this pull

In the dark

main

at 7f70438 ·

this pull

at 9f253ba ·

/explore

main

at 7f70438 ·

this pull

In the dark

main

at 7f70438 ·

this pull

at 9f253ba ·

/looks/failed

main

at 7f70438 ·

this pull

In the dark

main

at 7f70438 ·

this pull

at 9f253ba ·

/looks/missing

main

at 7f70438 ·

this pull

In the dark

main

at 7f70438 ·

this pull

at 9f253ba ·

/notes

main

at 7f70438 ·

this pull

In the dark

main

at 7f70438 ·

this pull

at 9f253ba ·

/review

main

at 7f70438 ·

this pull

In the dark

main

at 7f70438 ·

this pull

at 9f253ba ·

/security

main

at 7f70438 ·

this pull

In the dark

main

at 7f70438 ·

this pull

at 9f253ba ·

opened this

GET /forges/new and GET /pricing now read the Places catalog again when it is stale, so a cloud no longer waits for someone to open Places.

The new test passes with the change and fails without it. It also passes alongside places-api, new-forge-places and order-cloud. tsc, gate.ts --fix and design-lint are clean. I did not run the full suite, since the forge runs it on push.

  • What it does: refreshForPage(app) in src/actions/places_refresh.ts calls the existing refreshIfDue. It does nothing when the catalog is fresh or was tried within RETRY_MS. When a read is due, the page waits for it for at most PAGE_WAIT_MS (2 s). A slower provider read carries on in the background and the next view sees it.
  • Audit: the read names no user in the audit, the same as a paid order's read.
  • Where it's called: newForgePage calls it before readsFor. pricingPage calls it first thing, so it is now async; server.ts and order-cloud.test.ts already handled that.
  • Test: test/new-forge-refresh.test.ts has an admin with a Hetzner account and a stale, empty catalog. The first GET /forges/new offers Nuremberg instead of "Nowhere can be ordered". A second visit makes no provider calls.
  • Reused: refreshIfDue, isStale and running from places_refresh.ts, readPlaces and seedHetzner's fixtures in the test. I didn't run scripts/similar.ts, because the new function is a three-line wrapper over refreshIfDue.
  • Not done:
    • No forge timer. A timer would also cover a forge nobody visits, but the duties may run on the engine's worker thread and I didn't want to move provider fetches there. It would be a separate change if wanted.
    • No change for /pricing visitors. The page doesn't read the catalog itself today, so the refresh there only keeps the catalog warm. Say if you'd rather I drop it.
    • No review block. The page markup is unchanged.
  • To try: as an admin with a write-allowed cloud account and a catalog read more than 6 h ago, open /forges/new. The cloud is offered on that first load.

Closes #16543

Show 2 earlier items

7 earlier comments
commented

<!-- look-pages d1d4b8731956 --> Look pages for d1d4b87, from the gate:

  • look pages (none): this pull changes src/web/pages/new-forge.ts, src/web/pages/pricing.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

<!-- look-pages 6196e57aa061 --> Look pages for 6196e57, from the gate:

  • look pages (none): "Looks: /forges/new" is not a page of app.looks in forge.json; this pull changes src/web/pages/new-forge.ts, src/web/pages/pricing.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

A stale Places catalog is now read again before /forges/new renders, and in the terminal's New forge. The SQL-statement budget check was failing because /pricing also did this refresh, which put it over its budget. I removed the refresh from /pricing.

After this change test/page-budget.test.ts and test/new-forge-refresh.test.ts pass, and bun x tsc --noEmit is clean. I ran no other tests.

  • What changed:
    • /pricing: the page is back to how it was on main. It did the refresh check on every visit, which added three SQL statements (13 against a budget of 10). Before this change it only had its first-page numbers on main, not a refresh.
    • isStale: it now reads the read and try times only when a listed cloud account exists. /forges/new went from 14 to 12 statements, still inside its budget of 14.
  • Doc and comment: docs/features/places-read-on-visit.md and the refreshForPage comment no longer name Pricing.
  • Not done: I didn't raise the /pricing budget. Even with the cheaper check, the refresh would still cost it one statement, and the issue is about New forge, not Pricing. Refreshing on Pricing visits would be a separate decision.
  • To try it: as an admin with a cloud account whose catalog is older than six hours, open /forges/new and the cloud's place is offered. The same happens in the terminal's New forge once it has re-read the catalog.
commented

That background task was the broad fast.ts test run. I started it by mistake, then killed it, and it is no longer running. I didn't restart it.

I ran the targeted tests instead and they pass. That was the TUI new-forge, places and pricing tests plus test/new-forge-refresh.test.ts (54 pass), and the feature and docs tests (194 pass). The work is pushed, and the pull description in my last message still stands.

commented

This feedback is on a297545, an older commit, and the branch already answers it. The latest commit, efe111b, carries the line "No look: the page's markup is unchanged; only when the Places catalog is read moved, so no look page shows a difference". The earlier "Looks: /forges/new" line didn't count because /forges/new isn't one of the pages in forge.json's looks.

I made no new change and pushed nothing. The gate's note that it couldn't trace the route of /settings/security/controls is its own, not something from this diff. It will keep saying so until a reviewer decides, and that decision is the reviewer's.

Nothing else is outstanding. The pull's behavior, test and docs are as described in my last description.

commented

This pull's check has now failed three times (31s, 13m, 23m) while main's full check passes. Before the next push, read the failing test in the latest check run, fix the cause in this change, and run that test locally until it passes. No requeues or skipped tests; one push, one green check.

commented

This pull makes GET /forges/new read the Places catalog again when it is stale, so a cloud no longer stays unpickable until someone opens Places. It also makes the same read in the terminal's New forge screen, which fills in its place list once the read finishes. Pricing no longer reads the catalog on a visit, which an earlier push of this pull had made it do; that cost it SQL statements, and the change that dropped it is described under "the fix" below. The last check failed on two tests, both caused by this change. I ran them locally until they passed before pushing.

What failed and why

  • timers-named: the page's 2 s wait used a bare setTimeout in src/actions/places_refresh.ts. It now runs inside during("places-page-wait", …), like every other server timer.
  • new-forge-pick-150: the page ran one more SQL statement than its budget of 20, because the "is the catalog stale?" check listed the cloud accounts a second time. I did not touch the test, which was right.

The fix

  • refreshForPage in src/actions/places_refresh.ts skips the check for 10 s (LOOK_MS) after it finds the catalog fresh. A busy page spends no statement on it per visit, and a stale catalog is still read on the first visit that finds it so.
  • When a read is due, refreshForPage starts the refresh directly instead of asking refreshIfDue to check staleness a second time.
  • A cloud account added within 10 s of a fresh check waits up to 10 s for its first catalog read.

Checks run

  • tsc and gate.ts --fix are clean.
  • new-forge*, pricing*, tui-newforge*, timers-named, places-api and order-cloud pass: 138 tests, 0 fail. The places-api and order-cloud run was before the final edit; those two files were not rerun after it.
  • scripts/fast.ts named 3603 files for this diff, so I ran the covering files above instead. The full suite runs on the forge's check.

How to try it: open /forges/new as an admin with a cloud account whose catalog is stale. The place is offered on the first visit, and a second visit makes no provider call.

🤖 Generated with Claude Code

commented

The 8:18 PM push still failed its check (23m, 4th red in a row) while main's full check is green. Before any next push: post here the exact failing test, the error, and why it fails only on this branch. Then reproduce and fix it locally and push once. If it isn't green after that, close this pull and reopen a narrower one for #16543.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs