fix: 修复 Secret 同步成功返回

This commit is contained in:
Codex
2026-07-12 18:08:35 +02:00
parent 5c6bc728cb
commit 0a0b7a919e
2 changed files with 21 additions and 8 deletions
@@ -3,6 +3,7 @@ import { describe, expect, test } from "bun:test";
import { parseSecretSyncOptions } from "./agentrun/control-plane";
import type { SecretSyncOptions } from "./agentrun/options";
import { compactAgentRunSecretSyncPayload, renderAgentRunSecretSyncResult } from "./agentrun/secret-sync-output";
import { confirmedSecretSyncPlan } from "./agentrun/trigger";
const options = (output: SecretSyncOptions["output"], overrides: Partial<SecretSyncOptions> = {}): SecretSyncOptions => ({
confirm: false,
@@ -124,6 +125,16 @@ function blockedFixture(): Record<string, unknown> {
}
describe("AgentRun secret-sync bounded output", () => {
test("confirmed sync reports all written secrets without stale provider classification", () => {
const items = [{ id: "provider-gpt-pika-auth-json" }, { id: "provider-gpt-pika-config" }];
expect(confirmedSecretSyncPlan(items, 2)).toEqual({
secretCount: 2,
items,
writableSecretCount: 2,
valuesPrinted: false,
});
});
test("parses compact machine output and explicit disclosure options", () => {
expect(parseSecretSyncOptions(["--node", "NC01", "--lane", "nc01-v02", "--dry-run", "-o", "yaml"])).toEqual({
confirm: false,
+10 -8
View File
@@ -288,14 +288,7 @@ export async function secretSync(config: UniDeskConfig, options: SecretSyncOptio
configPath,
target: compactAgentRunLaneStatusTarget(spec),
filter: options.secretIds.length === 0 ? null : { secretIds: options.secretIds, selected: sources.map((source) => source.id) },
plan: {
secretCount: plan.length,
items: plan,
providerSecretWriteSkippedCount: providerValues.length,
providerSecretClassification: "exact-target-ref",
writableNonProviderSecretCount: syncValues.length,
valuesPrinted: false,
},
plan: confirmedSecretSyncPlan(plan, syncValues.length),
result: payload,
capture: compactCapture(result, { full: result.exitCode !== 0, stdoutTailChars: 3000, stderrTailChars: 3000 }),
next: {
@@ -305,6 +298,15 @@ export async function secretSync(config: UniDeskConfig, options: SecretSyncOptio
};
}
export function confirmedSecretSyncPlan(items: readonly Record<string, unknown>[], writableSecretCount: number): Record<string, unknown> {
return {
secretCount: items.length,
items,
writableSecretCount,
valuesPrinted: false,
};
}
export async function exposeAgentRun(_config: UniDeskConfig, options: ConfirmOptions): Promise<Record<string, unknown>> {
const clientConfig = readAgentRunClientConfig();
const exposure = clientConfig.publicExposure;