Publish curated projectbrain source from 0244fbf232898e6dc076ff2159d96a6da55ab5b5

This commit is contained in:
Public Source Publisher committed 2026-10-06 22:49:00 +00:00
1 parent eca2891b07
commit d5c9615684
10 files changed
+170 -31

No files matched your search

+27 -1
View File
@@ -301,7 +301,7 @@ databaseDescribe("autonomy database write isolation", () => {
vi.spyOn(GiteaClient.prototype, "getBranch").mockResolvedValue({ name: "chatgpt/existing", commit: { id: head, message: "Repair" }, protected: false });
vi.spyOn(GiteaClient.prototype, "getContents").mockResolvedValue({ type: "file", path: "src/feature.ts", name: "feature.ts", sha: "file-sha", size: 4, encoding: "base64", content: "dGVzdA==" });
const write = vi.spyOn(GiteaClient.prototype, "updateFile").mockResolvedValue({});
vi.spyOn(GiteaClient.prototype, "listActionRuns").mockResolvedValue({ total_count: 2, workflow_runs: [
const actionRuns = vi.spyOn(GiteaClient.prototype, "listActionRuns").mockResolvedValue({ total_count: 2, workflow_runs: [
{ id: 2, run_number: 2, display_title: "Managed validation / full", path: ".gitea/workflows/managed-validation.yml", event: "pull_request", head_sha: head, head_branch: "chatgpt/existing", status: "completed", conclusion: "success", html_url: "https://gitea.example.com/runs/2" },
{ id: 3, run_number: 3, display_title: "CI", path: ".gitea/workflows/ci.yml", event: "pull_request", head_sha: head, head_branch: "chatgpt/existing", status: "completed", conclusion: "success", html_url: "https://gitea.example.com/runs/3" },
] });
@@ -323,6 +323,32 @@ databaseDescribe("autonomy database write isolation", () => {
expect(repaired.spec.validationResults).toEqual([]);
const synced = await client.callTool({ name: "sync_feature_validation", arguments: { project_id: slug, delivery_id: delivery.id } });
expect(synced.isError, JSON.stringify(synced.content)).not.toBe(true);
actionRuns.mockResolvedValue({ total_count: 1, workflow_runs: [
{ id: 4, run_number: 4, display_title: "Managed validation / full", path: ".gitea/workflows/managed-validation.yml", event: "pull_request", head_sha: "c".repeat(40), head_branch: "chatgpt/existing", status: "completed", conclusion: "success", html_url: "https://gitea.example.com/runs/4" },
] });
const stalePrRun = await client.callTool({ name: "merge_feature_delivery", arguments: { project_id: slug, delivery_id: delivery.id, expected_head_sha: head, delete_branch: false } });
expect(stalePrRun.isError, JSON.stringify(stalePrRun.content)).toBe(true);
expect(merge).not.toHaveBeenCalled();
actionRuns.mockResolvedValue({ total_count: 1, workflow_runs: [
{ id: 5, run_number: 5, display_title: "Managed validation / full", path: ".gitea/workflows/managed-validation.yml", event: "workflow_dispatch", head_sha: head, head_branch: "chatgpt/existing", status: "completed", conclusion: "success", html_url: "https://gitea.example.com/runs/5" },
] });
const dispatchOnly = await client.callTool({ name: "merge_feature_delivery", arguments: { project_id: slug, delivery_id: delivery.id, expected_head_sha: head, delete_branch: false } });
expect(dispatchOnly.isError, JSON.stringify(dispatchOnly.content)).toBe(true);
expect(merge).not.toHaveBeenCalled();
actionRuns.mockResolvedValue({ total_count: 1, workflow_runs: [
{ id: 6, run_number: 6, display_title: "Managed validation / full", path: ".gitea/workflows/managed-validation.yml", event: "pull_request", head_sha: head, head_branch: "chatgpt/existing", status: "completed", conclusion: "failure", html_url: "https://gitea.example.com/runs/6" },
] });
const failedPrFull = await client.callTool({ name: "merge_feature_delivery", arguments: { project_id: slug, delivery_id: delivery.id, expected_head_sha: head, delete_branch: false } });
expect(failedPrFull.isError, JSON.stringify(failedPrFull.content)).toBe(true);
expect(merge).not.toHaveBeenCalled();
actionRuns.mockResolvedValue({ total_count: 2, workflow_runs: [
{ id: 2, run_number: 2, display_title: "Managed validation / full", path: ".gitea/workflows/managed-validation.yml", event: "pull_request", head_sha: head, head_branch: "chatgpt/existing", status: "completed", conclusion: "success", html_url: "https://gitea.example.com/runs/2" },
{ id: 3, run_number: 3, display_title: "CI", path: ".gitea/workflows/ci.yml", event: "pull_request", head_sha: head, head_branch: "chatgpt/existing", status: "completed", conclusion: "success", html_url: "https://gitea.example.com/runs/3" },
] });
const merged = await client.callTool({ name: "merge_feature_delivery", arguments: { project_id: slug, delivery_id: delivery.id, expected_head_sha: head, delete_branch: false } });
expect(merged.isError, JSON.stringify(merged.content)).not.toBe(true);
expect(merge).toHaveBeenCalledTimes(1);