fix: restore repository-scoped Gitea mirror plan

This commit is contained in:
Codex
2026-07-13 15:15:38 +02:00
parent 917c0b6b52
commit e3214917de
2 changed files with 10 additions and 3 deletions
+8 -2
View File
@@ -498,9 +498,13 @@ describe("migrated CLI 执行 guard 与提示清理", () => {
});
test("Gitea 与 mirror 默认 plan 只返回只读 Next", async () => {
const giteaPlan = await runPlatformInfraGiteaCommand({} as never, ["plan", "--target", "NC01", "--raw"]) as Record<string, unknown>;
const nc01MirrorPlan = await runPlatformInfraGiteaCommand({} as never, ["mirror", "plan", "--target", "NC01", "--raw"]) as Record<string, unknown>;
const jd01MirrorPlan = await runPlatformInfraGiteaCommand({} as never, ["mirror", "plan", "--target", "JD01", "--raw"]) as Record<string, unknown>;
const plans = [
await runPlatformInfraGiteaCommand({} as never, ["plan", "--target", "NC01", "--raw"]),
await runPlatformInfraGiteaCommand({} as never, ["mirror", "plan", "--target", "NC01", "--raw"]),
giteaPlan,
nc01MirrorPlan,
jd01MirrorPlan,
] as Record<string, unknown>[];
for (const plan of plans) {
expect(plan.mutation).toBe(false);
@@ -508,6 +512,8 @@ describe("migrated CLI 执行 guard 与提示清理", () => {
expect(JSON.stringify(plan.next)).toContain("status");
expect(JSON.stringify(plan.next)).toContain(PAC_AUTOMATIC_DELIVERY_REFERENCE);
}
expect(JSON.stringify(nc01MirrorPlan.credentials)).toContain("github-upstream:selfmedia-nc01");
expect(JSON.stringify(jd01MirrorPlan.credentials)).not.toContain("github-upstream:selfmedia-nc01");
});
test("PaC history detail 只按唯一 consumer 生成 Next,四类前缀无默认 consumer 回退", () => {
+2 -1
View File
@@ -314,6 +314,7 @@ async function mirrorWebhookCommand(config: UniDeskConfig, args: string[]): Prom
function mirrorPlan(options: CommonOptions): Record<string, unknown> {
const gitea = readGiteaConfig();
const target = resolveCommandTarget(gitea, options.targetId);
const targetRepos = repositoriesForTarget(gitea, target);
return {
ok: true,
action: "platform-infra-gitea-mirror-plan",
@@ -321,7 +322,7 @@ function mirrorPlan(options: CommonOptions): Record<string, unknown> {
target: targetSummary(target),
sourceAuthority: sourceAuthoritySummary(gitea, target),
responsibilities: gitea.sourceAuthority.responsibilities.map(responsibilitySummary),
repositories: repositoriesForTarget(gitea, target).map((repo) => repositorySummary(gitea, repo)),
repositories: targetRepos.map((repo) => repositorySummary(gitea, repo)),
credentials: credentialSummaries(gitea, targetRepos),
next: mirrorReadOnlyNextCommands(target.id),
};