Skip to content
62 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import { pullDetailFromWire, workClient } from "../../../../packages/contracts/src/clients.ts";
5
6/** A pull request's detail as the work service writes it: its own fields in snake_case. */
7const wire = {
8 pull: { number: 7, headCommit: "abc" },
9 issue: null,
10 comments: [],
11 checks: null,
12 overlaps: [],
13 behind: false,
14 lifecycle: null,
15 landing: false,
16 stalled: null,
17 statuses: [],
18 mergeable: "clean",
19 conflicts: [],
20 earlier_checks: [{ id: "chk_1", status: "failed" }],
21 required_checks: [{ name: "CI", state: "failure", description: null, targetUrl: null }],
22 code_owners: { path: ".g1t/CODEOWNERS", required: true, missing: ["@acme/web"] },
23};
24
25test("a pull request's own snake_case fields are read into camelCase", () => {
26 const detail = pullDetailFromWire(wire);
27 assert.deepEqual(detail.earlierChecks, wire.earlier_checks);
28 assert.deepEqual(detail.requiredChecks, wire.required_checks);
29 assert.deepEqual(detail.codeOwners, wire.code_owners);
30 // The snake_case names are gone, and what they hold is untouched.
The contracts no longer describe g1t's own agents, and workspaces can keep their AI providers. Every consumer had already stopped using them, so the TypeScript and Rust contracts drop the workspace-agent, ability, look, skill-library, context, runner-agent and mention modules, the chat and docs RPCs agents posted and read through, the folio agent methods, the agent_waiting notification, agent.asked and memory.changed events, AI credit, token and gateway billing types, model routes and sessions, team agents, agent tokens, plan, review, message and confidence types, command rules, cost caps and confidence rules. The agents:run and models:* scopes are no longer offered by any preset, OAuth default or permission form, but a stored token or grant that names them still reads; and the removed operations are gone from the scope table, so the API's check that every operation has exactly one scope is strict again. What stored data needs in order to parse (old run and credential kinds, an agent team lead, retired rules and webhook events, old guardrail and integration settings) still parses, and a run's token is still PrincipalKind::Agent, which now means a run's token and the @g1t rows written before. The customize, marketplace, skills and claude-plugin contracts stay only until the mobile app drops its Customize screens.31 for (const key of ["earlier_checks", "required_checks", "code_owners"]) assert.ok(!(key in detail), key);
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar32 assert.equal(detail.requiredChecks?.[0]?.targetUrl, null);
33 assert.equal(detail.pull.number, 7);
34});
35
The contracts no longer describe g1t's own agents, and workspaces can keep their AI providers. Every consumer had already stopped using them, so the TypeScript and Rust contracts drop the workspace-agent, ability, look, skill-library, context, runner-agent and mention modules, the chat and docs RPCs agents posted and read through, the folio agent methods, the agent_waiting notification, agent.asked and memory.changed events, AI credit, token and gateway billing types, model routes and sessions, team agents, agent tokens, plan, review, message and confidence types, command rules, cost caps and confidence rules. The agents:run and models:* scopes are no longer offered by any preset, OAuth default or permission form, but a stored token or grant that names them still reads; and the removed operations are gone from the scope table, so the API's check that every operation has exactly one scope is strict again. What stored data needs in order to parse (old run and credential kinds, an agent team lead, retired rules and webhook events, old guardrail and integration settings) still parses, and a run's token is still PrincipalKind::Agent, which now means a run's token and the @g1t rows written before. The customize, marketplace, skills and claude-plugin contracts stay only until the mobile app drops its Customize screens.36test("camelCase is taken as it is", () => {
37 const detail = pullDetailFromWire({ pull: {}, requiredChecks: [{ name: "CI" }], earlierChecks: [] });
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar38 assert.deepEqual(detail.requiredChecks, [{ name: "CI" }]);
The contracts no longer describe g1t's own agents, and workspaces can keep their AI providers. Every consumer had already stopped using them, so the TypeScript and Rust contracts drop the workspace-agent, ability, look, skill-library, context, runner-agent and mention modules, the chat and docs RPCs agents posted and read through, the folio agent methods, the agent_waiting notification, agent.asked and memory.changed events, AI credit, token and gateway billing types, model routes and sessions, team agents, agent tokens, plan, review, message and confidence types, command rules, cost caps and confidence rules. The agents:run and models:* scopes are no longer offered by any preset, OAuth default or permission form, but a stored token or grant that names them still reads; and the removed operations are gone from the scope table, so the API's check that every operation has exactly one scope is strict again. What stored data needs in order to parse (old run and credential kinds, an agent team lead, retired rules and webhook events, old guardrail and integration settings) still parses, and a run's token is still PrincipalKind::Agent, which now means a run's token and the @g1t rows written before. The customize, marketplace, skills and claude-plugin contracts stay only until the mobile app drops its Customize screens.39 assert.deepEqual(detail.earlierChecks, []);
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar40});
41
42test("getPull reads the work service's answer at the edge", async () => {
43 const calls: string[] = [];
44 const service = {
45 fetch: async (url: string) => {
46 calls.push(url);
47 return Response.json({ ok: true, value: wire });
48 },
49 };
50 const found = await workClient(service).getPull({ namespace: "acme", name: "web" }, 7, null);
51 assert.deepEqual(calls, ["https://service/rpc/get_pull"]);
52 assert.ok(found.ok);
53 assert.equal(found.value.requiredChecks?.[0]?.name, "CI");
54 assert.equal(found.value.earlierChecks?.length, 1);
55 assert.deepEqual(found.value.codeOwners?.missing, ["@acme/web"]);
56});
57
58test("getPull passes a refusal through", async () => {
59 const service = { fetch: async () => Response.json({ ok: false, error: { code: "not_found", message: "No such pull request." } }) };
60 const found = await workClient(service).getPull({ namespace: "acme", name: "web" }, 8, null);
61 assert.equal(found.ok, false);
62});