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

The cell tests run again where cells exist: the probe's owner is a member (from grokbot) #3688

Merged opened this

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

Merged

grokbot/contain-cell-suites → main 2 commits 1 thread · 1 unresolved

  • Merged. grokbot/contain-cell-suites was merged into main as cead8d3.

Review

Sign in to review this change.
2 files changed +9 −1
test/contain.test.ts +6 −1
@@ -42,6 +42,7 @@ import { AppsRuntime } from "../src/apps/runtime.ts";
4242 import { runAppTty } from "../src/apps/tty.ts";
4343 import { startChecks, type ChecksHandle } from "../src/checks/service.ts";
4444 import { listRuns, type Run } from "../src/core/runs.ts";
45 import { setMember } from "../src/core/roles.ts";
4546 import { createUser, type User } from "../src/core/users.ts";
4647 import type { AppRecord } from "../src/core/apps.ts";
4748 import type { Repo } from "../src/core/repos.ts";
@@ -588,6 +589,8 @@ describe.skipIf(noCells)(
588589 });
589590 if (!m.ok) throw new Error(m.error);
590591 mallory = m.value;
592 // A guest cannot own a repository (docs/ROLES.md): the probe needs one.
593 setMember(app.db, mallory.id, true, alice.id, new Date());
591594
592595 // Another tenant's app, running, with data of its own.
593596 const theirs = await createRepo(app, alice, {
@@ -977,6 +980,8 @@ describe.skipIf(noCells)(
977980 };
978981 const alice = await user("alice", true);
979982 const mallory = await user("mallory");
983 // A guest cannot fork (docs/ROLES.md): the outsider is a member elsewhere.
984 setMember(app.db, mallory.id, true, alice.id, new Date());
980985 const made = await createRepo(app, alice, {
981986 name: "lib",
982987 visibility: "public",
@@ -985,7 +990,7 @@ describe.skipIf(noCells)(
985990 const repo = made.value;
986991
987992 // Something of another tenant's to steal, where an app's data lives.
988 const stolen = envDir(dataDir, "someone-elses-app", "production");
993 const stolen = envDir(dataDir, "someoneelsesapp", "production");
989994 mkdirSync(join(stolen, "data"), { recursive: true });
990995 writeFileSync(join(stolen, "data", "books.txt"), "private");
991996
test/helpers/cell-probe.ts +3
@@ -63,6 +63,9 @@ if (process.argv[2] === "check") {
6363 // A terminal is the app's own client: its app answers it on its port.
6464 if (process.env.FORGE_APP_TTY === "1")
6565 console.log("OWNAPP " + (await attempt(() => answered("http://127.0.0.1:" + process.env.PORT + "/"))));
66 // The sampler sees a cell only at a tick (200 ms here); a check that ends
67 // sooner is never seen. Stay up for several ticks.
68 if (process.env.FORGE_CHECK) await Bun.sleep(1000);

A fixed 1000 ms sleep is tied to the 200 ms tick set in another file. Export that tick as a constant, or derive the sleep from it, so the two cannot drift apart.

6669 } else {
6770 Bun.serve({
6871 port: Number(process.env.PORT),

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs