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

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1ou7ejcd4q is past its budget: trevato/forge: "apps, runs and the crew on the web > the app strip says how long the first preview took, once one has s… #15712

Merged opened this

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

Merged

torque/forge:torque/15710-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 0 commits fork

  • Merged. torque/15710-sentinel-shared-01m23vygyffx5hg2f5vm8r74 was merged into main as 47c971a.

Review

Sign in to review this change.
2 files changed +16 −15
scripts/test-honesty-allow.json +1 −1
@@ -487,7 +487,7 @@
487487 "test/vitals-held-agent.test.ts": {"wait":1},
488488 "test/vitals.test.ts": {"wait":3},
489489 "test/watches.test.ts": {"wait":3},
490 "test/web-apps.test.ts": {"wait":3},
490 "test/web-apps.test.ts": {"wait":2},
491491 "test/web-origins.test.ts": {"timeout":1},
492492 "test/web-ui.test.ts": {"wait":2},
493493 "test/week-doors.test.ts": {"wait":1},
test/web-apps.test.ts +15 −14
@@ -36,12 +36,11 @@ import { spanWords } from "../src/apps/golden_path.ts";
3636 import { getAppByRepo } from "../src/core/apps.ts";
3737 import { createIssue, getIssue } from "../src/core/issues.ts";
3838 import { getRepo, type Repo } from "../src/core/repos.ts";
39 import { isTerminal, listRuns, type Run } from "../src/core/runs.ts";
39 import { listRuns, type Run } from "../src/core/runs.ts";
4040 import { getUserByName, type User } from "../src/core/users.ts";
4141 import { serve, type Servers } from "../src/http/server.ts";
4242 import { quietLogs } from "./helpers/globals.ts";
4343 import { adminCookie } from "./helpers/admin.ts";
44 import { waitFor } from "./helpers/poll.ts";
4544
4645 quietLogs();
4746
@@ -369,12 +368,11 @@ describe("apps, runs and the crew on the web", () => {
369368 test("the App page mounts the live stream on a quiet app, so a push after it was drawn still shows up", async () => {
370369 // Quiet: every run on hello has already finished, nothing is deploying.
371370 await runsOf(hello, () => true);
372 const deadline = Date.now() + 10_000;
373 while (Date.now() < deadline) {
374 const runs = listRuns(app.db, hello.id, { limit: 50 });
375 if (runs.every((run) => isTerminal(run.state))) break;
376 await Bun.sleep(50);
377 }
371 // Do not wait for the real runtime to settle (seconds, and more on a loaded
372 // machine): make the quiet the test is about true in the record.
373 app.db
374 .query("UPDATE run SET state = 'ok' WHERE repo_id = ?1 AND state IN ('queued','running')")
375 .run(hello.id);
378376 const html = await bodyOf(alice, "/alice/hello");
379377 expect(html).toContain('id="live"');
380378 expect(html).toContain('data-repo="/alice/hello"');
@@ -1014,13 +1012,16 @@ describe("apps, runs and the crew on the web", () => {
10141012 });
10151013
10161014 // A real preview may still be deploying and stamp `serving_at` after we clear
1017 // it: let every run settle first, then clear the stamps.
1015 // it, and on a loaded machine it may not settle in any bounded time. So do
1016 // not wait on the runtime: move every real pull's deploy out of the `pull-%`
1017 // environments the pages read, so nothing it does later can be counted.
10181018 const noPreviewServed = async (): Promise<void> => {
1019 const open = () =>
1020 app.db.query("SELECT 1 FROM run WHERE state IN ('queued','running') LIMIT 1").get();
1021 await waitFor(() => open() === null, { every: 25, within: 5_000 });
1022 if (open() !== null) throw new Error(`never came: still waiting while open() !== null`);
1023 app.db.query("UPDATE run SET serving_at = NULL WHERE env LIKE 'pull-%'").run();
1019 app.db
1020 .query(
1021 `UPDATE run SET env = 'moved-' || env, serving_at = NULL
1022 WHERE env LIKE 'pull-%' AND kind = 'deploy'`,
1023 )
1024 .run();
10241025 };
10251026
10261027 test("the app strip says how long the first preview took, once one has served", async () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs