






















@@ -4,7 +4,9 @@ import { validateConfigObjectRaw } from "../config/validation.js";
44import { SecretRefSchema as GatewaySecretRefSchema } from "../gateway/protocol/schema/primitives.js";
55import { buildSecretInputSchema } from "../plugin-sdk/secret-input-schema.js";
66import {
7+INVALID_FILE_SECRET_REF_IDS,
78INVALID_EXEC_SECRET_REF_IDS,
9+VALID_FILE_SECRET_REF_IDS,
810VALID_EXEC_SECRET_REF_IDS,
911} from "../test-utils/secret-ref-test-vectors.js";
1012import {
@@ -13,7 +15,7 @@ import {
1315TALK_TEST_PROVIDER_ID,
1416} from "../test-utils/talk-test-provider.js";
1517import { isSecretsApplyPlan } from "./plan.js";
16-import { isValidExecSecretRefId } from "./ref-contract.js";
18+import { isValidExecSecretRefId, isValidFileSecretRefId } from "./ref-contract.js";
1719import { materializePathTokens, parsePathPattern } from "./target-registry-pattern.js";
1820import { canonicalizeSecretTargetCoverageId } from "./target-registry-test-helpers.js";
1921import { listSecretTargetRegistryEntries } from "./target-registry.js";
@@ -39,6 +41,21 @@ describe("exec SecretRef id parity", () => {
3941return result.ok;
4042}
414344+function configAcceptsFileRef(id: string): boolean {
45+const result = validateConfigObjectRaw({
46+models: {
47+providers: {
48+openai: {
49+baseUrl: "https://api.openai.com/v1",
50+apiKey: { source: "file", provider: "default", id },
51+models: [{ id: "gpt-5", name: "gpt-5" }],
52+},
53+},
54+},
55+});
56+return result.ok;
57+}
58+4259function planAcceptsExecRef(id: string): boolean {
4360return isSecretsApplyPlan({
4461version: 1,
@@ -57,6 +74,17 @@ describe("exec SecretRef id parity", () => {
5774});
5875}
597677+for (const id of [...VALID_FILE_SECRET_REF_IDS, ...INVALID_FILE_SECRET_REF_IDS]) {
78+it(`keeps config/gateway/plugin parity for file id "${id}"`, () => {
79+const expected = isValidFileSecretRefId(id);
80+expect(configAcceptsFileRef(id)).toBe(expected);
81+expect(validateGatewaySecretRef({ source: "file", provider: "default", id })).toBe(expected);
82+expect(
83+pluginSdkSecretInput.safeParse({ source: "file", provider: "default", id }).success,
84+).toBe(expected);
85+});
86+}
87+6088for (const id of [...VALID_EXEC_SECRET_REF_IDS, ...INVALID_EXEC_SECRET_REF_IDS]) {
6189it(`keeps config/plan/gateway/plugin parity for exec id "${id}"`, () => {
6290const expected = isValidExecSecretRefId(id);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。