mirror of
https://github.com/block/goose.git
synced 2026-09-01 10:25:49 +00:00
Some checks failed
Canary / Prepare Version (push) Waiting to run
Canary / build-cli-linux (push) Blocked by required conditions
Canary / Upload Install Script (push) Waiting to run
Canary / bundle-macos-arm64 (push) Blocked by required conditions
Canary / bundle-macos-x64 (push) Blocked by required conditions
Canary / bundle-windows (push) Blocked by required conditions
Canary / bundle-windows-cuda (push) Blocked by required conditions
Canary / Release (push) Blocked by required conditions
Unused Dependencies / machete (push) Waiting to run
CI / changes (push) Waiting to run
CI / Check Rust Code Format (push) Blocked by required conditions
CI / Build and Test Rust Project (push) Blocked by required conditions
CI / Check goose-sdk UniFFI (push) Blocked by required conditions
CI / Build and Test TLS Backend (native-tls) (push) Blocked by required conditions
CI / Build and Test TLS Backend (rustls-tls) (push) Blocked by required conditions
CI / Build and Test Roaming Feature (push) Blocked by required conditions
CI / Build Rust Project on Windows (push) Waiting to run
CI / Check MSRV (push) Blocked by required conditions
CI / Lint Rust Code (push) Blocked by required conditions
CI / Check Generated Schemas are Up-to-Date (push) Blocked by required conditions
CI / Check GDK API Reference is Up-to-Date (push) Waiting to run
CI / Test and Lint Electron Desktop App (push) Blocked by required conditions
CI / Test Desktop Updater Install (ubuntu-latest) (push) Blocked by required conditions
CI / Test Desktop Updater Install (windows-latest) (push) Blocked by required conditions
MCP Conformance / Build Conformance Binaries (push) Waiting to run
MCP Conformance / Conformance 2025-11-25 / 0.1.16 (push) Blocked by required conditions
MCP Conformance / Conformance 2025-11-25 / 0.2.0-alpha.10 (push) Blocked by required conditions
MCP Conformance / Conformance 2026-07-28 / 0.2.0-alpha.10 (push) Blocked by required conditions
Create Minor Release PR / check-version-bump-pr (push) Waiting to run
Create Minor Release PR / release (push) Blocked by required conditions
Live Provider Tests / check-fork (push) Waiting to run
Live Provider Tests / changes (push) Blocked by required conditions
Live Provider Tests / Build Binary (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (Code Execution) (push) Blocked by required conditions
Live Provider Tests / Compaction Tests (push) Blocked by required conditions
Publish Docker Image / docker (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Buzz automation / test (push) Has been cancelled
Deploy Documentation / deploy (push) Has been cancelled
Cargo Deny / deny (push) Has been cancelled
Publish Ask AI Bot Docker Image / docker (push) Has been cancelled
215 lines
5.3 KiB
JavaScript
215 lines
5.3 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import test from "node:test";
|
|
|
|
import {
|
|
bestMatchingIssueChannels,
|
|
channelMatchesIssue,
|
|
getOpenIssues,
|
|
getProjectIssues,
|
|
issueReferenceFromChannel,
|
|
readCoreTeam,
|
|
selectRecentQueueEntries,
|
|
} from "./github_manager.mjs";
|
|
|
|
const issue = {
|
|
repository: "aaif-goose/goose",
|
|
number: 123,
|
|
};
|
|
|
|
test("matches current and legacy issue channels", () => {
|
|
assert.equal(
|
|
channelMatchesIssue(
|
|
{
|
|
name: "123 short title",
|
|
description:
|
|
"Discussion for aaif-goose/goose#123: https://github.com/aaif-goose/goose/issues/123",
|
|
},
|
|
issue,
|
|
),
|
|
true,
|
|
);
|
|
assert.equal(
|
|
channelMatchesIssue({ name: "aaif-goose/goose #123" }, issue),
|
|
true,
|
|
);
|
|
assert.equal(channelMatchesIssue({ name: "#123 title" }, issue), true);
|
|
});
|
|
|
|
test("does not match another repository from an explicit reference", () => {
|
|
assert.equal(
|
|
channelMatchesIssue(
|
|
{
|
|
name: "123 title",
|
|
description: "https://github.com/example/elsewhere/issues/123",
|
|
},
|
|
issue,
|
|
),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("parses a legacy channel ending at the issue number", () => {
|
|
assert.deepEqual(
|
|
issueReferenceFromChannel({ name: "aaif-goose/goose #123" }),
|
|
{
|
|
repository: "aaif-goose/goose",
|
|
number: 123,
|
|
kind: null,
|
|
source: "legacy-name",
|
|
},
|
|
);
|
|
});
|
|
|
|
test("prefers an explicit issue channel over a bare numeric name", () => {
|
|
const explicit = {
|
|
channel_id: "explicit",
|
|
name: "123 real issue",
|
|
description: "https://github.com/aaif-goose/goose/issues/123",
|
|
};
|
|
const stray = {
|
|
channel_id: "stray",
|
|
name: "123 followups",
|
|
};
|
|
assert.deepEqual(bestMatchingIssueChannels([stray, explicit], issue), [explicit]);
|
|
});
|
|
|
|
test("does not adopt a pull-request channel", () => {
|
|
assert.equal(
|
|
channelMatchesIssue(
|
|
{
|
|
name: "123 pull request",
|
|
description: "https://github.com/aaif-goose/goose/pull/123",
|
|
},
|
|
issue,
|
|
),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("reports malformed and deferred queue entries", () => {
|
|
const { entries, ignored } = selectRecentQueueEntries(
|
|
[
|
|
{ id: "invalid", created_at: "today", content: "invalid" },
|
|
{ id: "old", created_at: 1, content: "old" },
|
|
{ id: "new", created_at: 2, content: "new" },
|
|
],
|
|
1,
|
|
(message) => [message.content],
|
|
);
|
|
assert.deepEqual(entries.map((entry) => entry.link), ["new"]);
|
|
assert.deepEqual(ignored, [
|
|
{ message_id: "invalid", reason: "invalid-created-at" },
|
|
{
|
|
message_id: "old",
|
|
link: "old",
|
|
reason: "outside-recent-window",
|
|
},
|
|
]);
|
|
});
|
|
|
|
test("retries a project read that changes while being listed", () => {
|
|
let calls = 0;
|
|
const issueItem = {
|
|
content: {
|
|
type: "Issue",
|
|
repository: "aaif-goose/goose",
|
|
number: 123,
|
|
},
|
|
};
|
|
const result = getProjectIssues(
|
|
() => {
|
|
calls += 1;
|
|
return calls === 1
|
|
? { totalCount: 2, items: [issueItem] }
|
|
: { totalCount: 1, items: [issueItem] };
|
|
},
|
|
{
|
|
command: "gh",
|
|
projectNumber: 1,
|
|
projectOwner: "aaif-goose",
|
|
projectLimit: 1000,
|
|
repository: "aaif-goose/goose",
|
|
},
|
|
);
|
|
assert.equal(calls, 2);
|
|
assert.equal(result.byNumber.get(123), issueItem);
|
|
});
|
|
|
|
test("matches project repository names without case sensitivity", () => {
|
|
const issueItem = {
|
|
content: {
|
|
type: "Issue",
|
|
repository: "AAIF-Goose/Goose",
|
|
number: 123,
|
|
},
|
|
};
|
|
const result = getProjectIssues(
|
|
() => ({ totalCount: 1, items: [issueItem] }),
|
|
{
|
|
command: "gh",
|
|
projectNumber: 1,
|
|
projectOwner: "aaif-goose",
|
|
projectLimit: 1000,
|
|
repository: "aaif-goose/goose",
|
|
},
|
|
);
|
|
assert.equal(result.byNumber.get(123), issueItem);
|
|
});
|
|
|
|
test("normalizes paginated REST issues and excludes pull requests", () => {
|
|
const issues = getOpenIssues(
|
|
() => [
|
|
[
|
|
{
|
|
number: 123,
|
|
title: "Issue",
|
|
html_url: "https://github.com/aaif-goose/goose/issues/123",
|
|
assignees: [{ login: "person" }],
|
|
},
|
|
{ number: 124, pull_request: {} },
|
|
],
|
|
],
|
|
{ command: "gh", repository: "aaif-goose/goose" },
|
|
);
|
|
assert.deepEqual(issues, [
|
|
{
|
|
number: 123,
|
|
title: "Issue",
|
|
url: "https://github.com/aaif-goose/goose/issues/123",
|
|
repository: "aaif-goose/goose",
|
|
assignees: [{ login: "person" }],
|
|
},
|
|
]);
|
|
});
|
|
|
|
test("uses one complete core-team schema", (context) => {
|
|
const directory = mkdtempSync(join(tmpdir(), "buzz-core-team-"));
|
|
context.after(() => rmSync(directory, { recursive: true }));
|
|
const path = join(directory, "core-team.json");
|
|
const person = {
|
|
name: "Person",
|
|
github: "person",
|
|
pubkey: "1".repeat(64),
|
|
capacity: 1,
|
|
interest: ["testing"],
|
|
bots: { Bot: "2".repeat(64) },
|
|
};
|
|
writeFileSync(
|
|
path,
|
|
JSON.stringify({ owners: [person], members: [] }),
|
|
);
|
|
|
|
const team = readCoreTeam(path);
|
|
assert.equal(team.people.length, 1);
|
|
assert.equal(team.botsByPerson.get(person.pubkey).length, 1);
|
|
|
|
delete person.capacity;
|
|
writeFileSync(
|
|
path,
|
|
JSON.stringify({ owners: [person], members: [] }),
|
|
);
|
|
assert.throws(() => readCoreTeam(path), /positive capacity/);
|
|
});
|