mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 10:48:18 +01:00
* fix(projects): tell the truth about cloud presence and separate header state Box-runner heartbeats as cloud but could register bridge presence as local, so /terminal said Cloud offline while the journal shipped work. Infer cloud from box-* versions, force the channel in box-runner, and scope the terminal honesty chip. Project header now shows listing/live as status, not peer links; catalogue invite waits until kickoff/build is idle. Co-authored-by: Cursor <cursoragent@cursor.com> * chore(desktop): bump Fleet Runner to 0.8.33 for presence-channel fix desktop/bridge-subscriber changed so box-* runners register as cloud; the release-drift gate requires a version bump and changelog entry before merge. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
85 lines
3.0 KiB
TypeScript
85 lines
3.0 KiB
TypeScript
// When Loki may ask an owner to list a project publicly — and when it must not.
|
|
//
|
|
// The asking is the load-bearing half of the consent model: a toggle nobody
|
|
// finds collects one answer, and it is no, after which an empty catalogue looks
|
|
// like a broken feature and gets "fixed" by widening the query. So the rule has
|
|
// to be exercised, not just written down.
|
|
//
|
|
// Pure input → boolean, so this runs with no database and no browser.
|
|
// Run: npx tsx scripts/test/listing-invitation.ts
|
|
import { shouldInviteToPublicCatalogue } from "../../src/lib/listing-invitation";
|
|
|
|
let pass = 0;
|
|
let fail = 0;
|
|
function ok(cond: boolean, label: string) {
|
|
if (cond) {
|
|
pass++;
|
|
} else {
|
|
fail++;
|
|
console.error(`✗ ${label}`);
|
|
}
|
|
}
|
|
|
|
/** A project that SHOULD be asked about: active, has a repo, never answered. */
|
|
const eligible = {
|
|
listedPublicly: false,
|
|
dismissedAt: null,
|
|
isActive: true,
|
|
gitUrl: "https://github.com/someone/thing",
|
|
readonly: false,
|
|
};
|
|
|
|
ok(shouldInviteToPublicCatalogue(eligible), "a real, active, unanswered project is asked about");
|
|
|
|
// ── The four ways the answer is already settled ────────────────────────────
|
|
ok(
|
|
!shouldInviteToPublicCatalogue({ ...eligible, listedPublicly: true }),
|
|
"already listed: there is nothing left to ask",
|
|
);
|
|
ok(
|
|
!shouldInviteToPublicCatalogue({ ...eligible, dismissedAt: new Date() }),
|
|
"already declined: no means no, permanently",
|
|
);
|
|
ok(
|
|
!shouldInviteToPublicCatalogue({ ...eligible, dismissedAt: "2026-01-01T00:00:00Z" }),
|
|
"a declined-at timestamp read back as a STRING still silences the prompt",
|
|
);
|
|
ok(
|
|
!shouldInviteToPublicCatalogue({ ...eligible, readonly: true }),
|
|
"viewing someone else's project: never the viewer's decision to take",
|
|
);
|
|
|
|
// ── The readiness bar ──────────────────────────────────────────────────────
|
|
ok(
|
|
!shouldInviteToPublicCatalogue({ ...eligible, gitUrl: null }),
|
|
"no repository: a placeholder is not a project worth a shop window",
|
|
);
|
|
ok(
|
|
!shouldInviteToPublicCatalogue({ ...eligible, gitUrl: " " }),
|
|
"a whitespace-only repo URL is not a repository",
|
|
);
|
|
ok(
|
|
!shouldInviteToPublicCatalogue({ ...eligible, isActive: false }),
|
|
"retired projects are not candidates",
|
|
);
|
|
|
|
// The bar is repo-and-active, NOT has-a-live-site. /fleet's own facets include
|
|
// "Being built" beside "Live", so requiring a deployment would ask only the
|
|
// projects that least need the exposure.
|
|
ok(
|
|
shouldInviteToPublicCatalogue({ ...eligible }),
|
|
"a project with no live URL is still asked — 'being built' belongs in the catalogue",
|
|
);
|
|
|
|
ok(
|
|
!shouldInviteToPublicCatalogue({ ...eligible, buildBusy: true }),
|
|
"kickoff or an active build: catalogue ask waits until the work path is idle",
|
|
);
|
|
ok(
|
|
shouldInviteToPublicCatalogue({ ...eligible, buildBusy: false }),
|
|
"buildBusy false is the same as omitted — still asked",
|
|
);
|
|
|
|
console.log(`${pass} passed, ${fail} failed`);
|
|
process.exit(fail === 0 ? 0 : 1);
|