mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-24 18:19:05 +02:00
Git expiration created its auth provider with only the issue ID; with a managed GitHub connection that provider throws outside a run ("No managed GitHub identity is available for this run"), so every upstream commit proof failed and was logged as inspection_failed. Expiration now falls back to anonymous access when the provider throws: public repositories verify, private ones stay kept. Upstream verification failures are reported as upstream_commit_unverified, and a managed checkout whose upstream cannot be reached or authenticated as managed_checkout_upstream_unavailable; local proof-store failures keep their own error.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
25 lines
1.4 KiB
TypeScript
25 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { gitExpirationSkipReason, withAnonymousGitFallback } from "../services/git-workspace-expiration.js";
|
|
import { GitCacheRestorationFailure } from "../services/git-workspace-restoration.js";
|
|
|
|
describe("Git expiration upstream access", () => {
|
|
it("falls back to anonymous access when the company identity cannot be resolved", async () => {
|
|
const unavailable = withAnonymousGitFallback(async () => {
|
|
throw new Error("No managed GitHub identity is available for this run");
|
|
});
|
|
await expect(unavailable("https://github.com/example/public")).resolves.toBeNull();
|
|
});
|
|
|
|
it("passes resolved credentials through unchanged", async () => {
|
|
const credential = { env: { GIT_ASKPASS: "/bin/true" }, configArgs: ["-c", "credential.helper="] };
|
|
const resolved = withAnonymousGitFallback(async () => credential);
|
|
await expect(resolved("https://github.com/example/private")).resolves.toBe(credential);
|
|
});
|
|
|
|
it("names upstream verification failures instead of reporting them as inspection failures", () => {
|
|
expect(gitExpirationSkipReason(new GitCacheRestorationFailure())).toBe("upstream_commit_unverified");
|
|
expect(gitExpirationSkipReason(new Error("unpushed_managed_checkout"))).toBe("unpushed_managed_checkout");
|
|
expect(gitExpirationSkipReason(new Error("spawn git ENOENT"))).toBe("inspection_failed");
|
|
});
|
|
});
|