mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 05:37:19 +01:00
QA's seat read "Cloud sessions are offline" (and "Cloud runner offline" at 1366) while the runner was up. Presence is read per account: the seat's own private builder was what was off, and the words read as the fleet's runner. - /api/builder/presence answers cloudScope: fleet (the account the box's runner works for), private (its own builder) or none. - /terminal's chip and empty state say "Your cloud builder offline" and that it is separate from the runner that builds Loki's own projects; an account with no cloud builder reads "You can't see this cloud runner". - An account not allowed on the cloud is gated, not offline, even before open-tabs answers. Test: scripts/test/terminal-whose-runner.ts.
43 lines
2.1 KiB
TypeScript
43 lines
2.1 KiB
TypeScript
/**
|
|
* /terminal says whose cloud builder is off.
|
|
*
|
|
* QA's seat (2026-11-12) read "Cloud sessions are offline", and at 1366
|
|
* "Cloud runner offline", while the fleet's runner was up. Presence is read
|
|
* per account (docs/architecture/private-builders.md): the seat's own cloud
|
|
* builder was what was off. The words now say which: this account's own
|
|
* builder, or a runner this account cannot see at all.
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
import { cloudBuilderScope } from "../../src/lib/cloud-builder-scope";
|
|
import { EXECUTOR_COPY } from "../../src/config/executor-copy";
|
|
|
|
assert.equal(cloudBuilderScope({ isDefault: true }), "fleet");
|
|
assert.equal(cloudBuilderScope({ isDefault: false, privateBuilder: true }), "private");
|
|
assert.equal(cloudBuilderScope({ isDefault: false, privateBuilder: false }), "none");
|
|
assert.equal(cloudBuilderScope(null), "none");
|
|
|
|
assert.match(EXECUTOR_COPY.terminal.cloudPrivateOfflineHint, /This account's own cloud builder/);
|
|
assert.match(EXECUTOR_COPY.terminal.cloudNotYoursHint, /^You can't see this cloud runner/);
|
|
assert.doesNotMatch(EXECUTOR_COPY.builder.ownCloudOffline, /^Cloud runner offline$/);
|
|
|
|
const read = (p: string) => fs.readFileSync(p, "utf8");
|
|
const presence = read("src/app/api/builder/presence/route.ts");
|
|
assert.match(presence, /cloudScope: user \? cloudBuilderScope\(user\) : null/);
|
|
|
|
const surface = read("src/components/terminal/TerminalSurface.tsx");
|
|
assert.match(
|
|
surface,
|
|
/presence\.cloudScope === "private"\)\s*return EXECUTOR_COPY\.terminal\.cloudPrivateOfflineHint/,
|
|
"the empty terminal names this account's own builder",
|
|
);
|
|
assert.match(surface, /cloudScope === "none"\) return EXECUTOR_COPY\.terminal\.cloudNotYoursHint/);
|
|
assert.match(surface, /label: EXECUTOR_COPY\.builder\.ownCloudOffline/, "the chip too");
|
|
|
|
// Not allowed on the cloud is gated, never "offline", even before open-tabs answers.
|
|
const tabs = read("src/components/terminal/use-terminal-tabs.ts");
|
|
assert.match(tabs, /presence\.cloudBuilderAllowed === false/);
|
|
assert.match(tabs, /const offline = connected === false && tabs\.length === 0 && !gatedMessage;/);
|
|
|
|
console.log("terminal-whose-runner ok");
|