fix: resolve voice-call SecretRef inputs (#73632)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
VACInc
2026-05-01 02:21:02 -04:00
committed by GitHub
parent ec1b96cdfa
commit be14820b5d
14 changed files with 189 additions and 13 deletions

View File

@@ -147,6 +147,60 @@ describe("resolvePluginConfigContractsById", () => {
);
});
it("refreshes stale bundled SecretInput contracts from bundled metadata", () => {
mocks.loadPluginManifestRegistryForInstalledIndex.mockReturnValue(
createRegistry([
createPluginRecord({
id: "voice-call",
origin: "bundled",
configContracts: {
compatibilityMigrationPaths: ["plugins.entries.voice-call.config"],
secretInputs: {
paths: [{ path: "twilio.authToken", expected: "string" }],
},
},
}),
]),
);
mocks.findBundledPluginMetadataById.mockReturnValue({
manifest: {
configContracts: {
secretInputs: {
paths: [
{ path: "twilio.authToken", expected: "string" },
{ path: "realtime.providers.*.apiKey", expected: "string" },
],
},
},
},
});
expect(
resolvePluginConfigContractsById({
pluginIds: ["voice-call"],
fallbackToBundledMetadataForResolvedBundled: true,
}),
).toEqual(
new Map([
[
"voice-call",
{
origin: "bundled",
configContracts: {
compatibilityMigrationPaths: ["plugins.entries.voice-call.config"],
secretInputs: {
paths: [
{ path: "twilio.authToken", expected: "string" },
{ path: "realtime.providers.*.apiKey", expected: "string" },
],
},
},
},
],
]),
);
});
it("can hydrate missing contracts for plugin ids known to be bundled by runtime discovery", () => {
mocks.loadPluginManifestRegistryForInstalledIndex.mockReturnValue(
createRegistry([

View File

@@ -143,18 +143,19 @@ export function resolvePluginConfigContractsById(params: {
const existing = matches.get(pluginId);
const shouldHydrateBundledMatch =
existing &&
!existing.configContracts.secretInputs &&
((params.fallbackToBundledMetadataForResolvedBundled && existing.origin === "bundled") ||
fallbackBundledPluginIds.has(pluginId));
if (shouldHydrateBundledMatch) {
const bundled = findBundledPluginMetadataById(pluginId);
if (bundled?.manifest.configContracts?.secretInputs) {
if (bundled?.manifest.configContracts) {
matches.set(pluginId, {
origin: fallbackBundledPluginIds.has(pluginId) ? "bundled" : existing.origin,
configContracts: {
...bundled.manifest.configContracts,
...existing.configContracts,
secretInputs: bundled.manifest.configContracts.secretInputs,
...(bundled.manifest.configContracts.secretInputs
? { secretInputs: bundled.manifest.configContracts.secretInputs }
: {}),
},
});
}