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.
| Merge branch 'worktree-agent-a1b995daa94e4e1b7' | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { workOwner } from "../../../../packages/contracts/src/work.ts"; | |
| 5 | import { madeByG1t, openedBy } from "./opened-by.ts"; | |
| 6 | ||
| 7 | const syntaqx = { id: "usr_1", username: "syntaqx" }; | |
| 8 | const g1t = { id: "usr_g1t_agent", username: "g1t", kind: "agent" as const }; | |
| 9 | ||
| 10 | test("a pull request g1t made shows g1t, requested by whoever asked", () => { | |
| 11 | const pull = { agent: "g1t", branch: null, author: g1t, requestedBy: syntaqx }; | |
| 12 | assert.equal(madeByG1t(pull), true); | |
| 13 | assert.deepEqual(openedBy(pull), { name: "g1t", requestedBy: "syntaqx" }); | |
| 14 | // It is theirs to manage, as their own would be. | |
| 15 | assert.equal(workOwner(pull).id, "usr_1"); | |
| 16 | }); | |
| 17 | ||
| 18 | test("anything else shows its author", () => { | |
| 19 | // Someone's own agent. | |
| 20 | assert.deepEqual(openedBy({ author: syntaqx, requestedBy: null }), { name: "syntaqx", requestedBy: null }); | |
| 21 | // A branch pushed to the repository, even with g1t named on it. | |
| 22 | assert.equal(madeByG1t({ agent: "g1t", branch: "fix-login" }), false); | |
| 23 | assert.equal(workOwner({ author: syntaqx, requestedBy: null }).id, "usr_1"); | |
| 24 | }); | |
| 25 | ||
| 26 | test("work g1t started itself names nobody as asking", () => { | |
| 27 | const pull = { author: { id: "g1t", username: "g1t", kind: "system" as const }, requestedBy: null }; | |
| 28 | assert.deepEqual(openedBy(pull), { name: "g1t", requestedBy: null }); | |
| 29 | assert.equal(workOwner(pull).username, "g1t"); | |
| 30 | }); |
This file's history is long; its oldest lines are credited to the oldest commit read.