Merge branch 'puter/issue-5-gitea-lifecycle' into puter/issue-14-integration
# Conflicts: # bun.lock # packages/agents/package.json # packages/agents/src/agents/project-manager.ts # packages/backend/convex/agentWorkspace.ts
This commit is contained in:
@@ -223,4 +223,63 @@ describe("projectEvents", () => {
|
||||
const events = await eventsForProject(t, projectId);
|
||||
expect(events.some((e) => e.kind === "agent.completed")).toBe(false);
|
||||
});
|
||||
|
||||
test("Gitea lifecycle persists PR metadata in an event and artifact", async () => {
|
||||
const t = convexTest({ schema, modules });
|
||||
const projectId = await createTestProject(t);
|
||||
const issueId = await t
|
||||
.withIdentity(identityA)
|
||||
.mutation(api.projectIssues.create, {
|
||||
body: "A representative issue body long enough to pass validation",
|
||||
projectId,
|
||||
title: "Representative issue",
|
||||
});
|
||||
await t.mutation(api.agentWorkspace.ensureRun, {
|
||||
daemonId: "daemon-1",
|
||||
issueId,
|
||||
token: FLUE_DB_TOKEN,
|
||||
});
|
||||
|
||||
await t.mutation(api.agentWorkspace.recordGiteaLifecycle, {
|
||||
baseBranch: "main",
|
||||
branch: "work/issue-1",
|
||||
commitSha: "abc123",
|
||||
issueId,
|
||||
pullRequest: {
|
||||
baseBranch: "main",
|
||||
branch: "work/issue-1",
|
||||
number: 5,
|
||||
status: "open",
|
||||
url: "https://git.openputer.com/puter/zopu-code/pulls/5",
|
||||
},
|
||||
status: "pull_request_open",
|
||||
token: FLUE_DB_TOKEN,
|
||||
});
|
||||
|
||||
const events = await eventsForProject(t, projectId);
|
||||
const event = events.find(
|
||||
(item) => item.kind === "gitea.pull_request.created"
|
||||
);
|
||||
expect(event?.data).toMatchObject({
|
||||
branch: "work/issue-1",
|
||||
commitSha: "abc123",
|
||||
pullRequest: {
|
||||
number: 5,
|
||||
status: "open",
|
||||
},
|
||||
status: "pull_request_open",
|
||||
});
|
||||
|
||||
const artifacts = await t.query((ctx) =>
|
||||
ctx.db
|
||||
.query("projectArtifacts")
|
||||
.withIndex("by_project_and_path", (q) =>
|
||||
q.eq("projectId", projectId).eq("path", "artifacts.md")
|
||||
)
|
||||
.unique()
|
||||
);
|
||||
expect(artifacts?.content).toContain(
|
||||
"https://git.openputer.com/puter/zopu-code/pulls/5"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user