Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

Commit

Chat keeps the work item Ask's page and proposals name

G1T-Session:
ses_01m566357hejh9yeqjbetx23f3
syntaqxcommitted Parent520b0eeBrowse files
2 files+12−100/2 viewed
+8−7
8888 { type: "sources", sources: [] },
8989 ];
9090 const rows = [
91− row("m1", ana, "Open issues in acme/rocket?"),
91+ row("m1", ana, "Open work items in acme/rocket?"),
9292 row("m2", G1T_KEY, "There is no acme/rocket.", { answer: { state: "done", steps } }),
9393 row("m3", ana, "Did you check?"),
9494 ];
151151 });
152152
153153 test("the page an answer is told is the newest question's, as sent from the top bar", () => {
154− const page = { path: "/acme/web/issues/12", repo: { namespace: "acme", name: "web" }, issue: 12, pull: null };
154+ const page = { path: "/acme/-/work/12", repo: null, workspace: "acme", item: 12, pull: null };
155155 assert.deepEqual(latestPage([row("m1", ana, "Q", { page }), row("m2", G1T_KEY, "A", done)]), page);
156156 assert.equal(latestPage([row("m1", ana, "Q", { page }), row("m2", ana, "From chat")]), null);
157− assert.deepEqual(pageFrom({ path: "/acme/web", repo: { namespace: "acme", name: "web" }, issue: -1, extra: true }), {
157+ assert.deepEqual(pageFrom({ path: "/acme/web", repo: { namespace: "acme", name: "web" }, item: -1, extra: true }), {
158158 path: "/acme/web",
159159 repo: { namespace: "acme", name: "web" },
160− issue: null,
160+ workspace: null,
161+ item: null,
161162 pull: null,
162163 time_zone: null,
163164 });
164165 // The browser's time zone is kept when it is one; anything else is dropped.
165166 assert.equal(pageFrom({ path: "/acme", time_zone: "America/Denver" })?.time_zone, "America/Denver");
166167 assert.equal(pageFrom({ path: "/acme", time_zone: "<script>" })?.time_zone, null);
167− assert.deepEqual(pageFrom({ time_zone: "Asia/Kolkata" }), { path: null, repo: null, issue: null, pull: null, time_zone: "Asia/Kolkata" });
168+ assert.deepEqual(pageFrom({ time_zone: "Asia/Kolkata" }), { path: null, repo: null, workspace: null, item: null, pull: null, time_zone: "Asia/Kolkata" });
168169 assert.equal(pageFrom({ path: "https://elsewhere" }), null);
169170 assert.equal(pageFrom("nope"), null);
170171 assert.equal(metaColumn({}), null);
260261 assert.deepEqual(made.state, { id: "proposal_1_0", starting_at: 5, repo_url: "/acme/hello", production_url: "https://hello-acme.g1t.page" });
261262 assert.equal(made.answer.steps!.length, 2);
262263 // A later step merges into the same one; unknown fields are dropped.
263− const started = withProposalState(made.answer, { id: "proposal_1_0", issue: 1, started: true, session_url: "/s", evil: "x" } as never)!;
264+ const started = withProposalState(made.answer, { id: "proposal_1_0", item: 1, started: true, session_url: "/s", evil: "x" } as never)!;
264265 assert.equal(started.answer.steps!.length, 2);
265266 assert.deepEqual(started.answer.steps![1], {
266267 type: "proposal_state",
268269 starting_at: 5,
269270 repo_url: "/acme/hello",
270271 production_url: "https://hello-acme.g1t.page",
271− issue: 1,
272+ item: 1,
272273 started: true,
273274 session_url: "/s",
274275 });
+4−3
6969 }
7070 if (typeof change.repo_url === "string") state.repo_url = change.repo_url.slice(0, 500);
7171 if (typeof change.default_branch === "string") state.default_branch = change.default_branch.slice(0, 200);
72− if (Number.isInteger(change.issue) && change.issue! > 0) state.issue = change.issue;
72+ if (Number.isInteger(change.item) && change.item! > 0) state.item = change.item;
7373 if (typeof change.starting_at === "number") state.starting_at = change.starting_at;
7474 if (change.started === true) state.started = true;
7575 const step = { type: "proposal_state", ...state } as Record<string, unknown>;
225225 repo && typeof repo.namespace === "string" && typeof repo.name === "string" && repo.namespace && repo.name
226226 ? { namespace: repo.namespace.slice(0, 100), name: repo.name.slice(0, 100) }
227227 : null,
228− issue: number(sent.issue),
228+ workspace: typeof sent.workspace === "string" && /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/.test(sent.workspace) ? sent.workspace : null,
229+ item: number(sent.item),
229230 pull: number(sent.pull),
230231 time_zone: typeof sent.time_zone === "string" && /^[A-Za-z][A-Za-z0-9_+\-]*(\/[A-Za-z0-9_+\-]+){0,2}$/.test(sent.time_zone) && sent.time_zone.length <= 64 ? sent.time_zone : null,
231232 };
232− return page.path || page.repo || page.time_zone ? page : null;
233+ return page.path || page.repo || page.workspace || page.time_zone ? page : null;
233234 }
234235
235236 /** What g1t says when nobody chose an AI provider for Ask yet: once, and where to choose one. */

Comments

Sign in to comment.