fix(feishu): keep top-level appSecret SecretRef active for the implicit default account (#96965)

When a Feishu channel has top-level appId/appSecret using SecretRef
format and sub-accounts with their own inline appSecret, the secrets
resolver marks the top-level SecretRef as inactive because
isBaseFieldActiveForChannelSurface only checks whether any explicit
account inherits the field.

Feishu account listing always creates an implicit default account from
top-level credentials.  The fix detects this implicit default account
and keeps the top-level appSecret active accordingly, without changing
the shared channel secret helper semantics for other channels.

Fixes #96929

Signed-off-by: 赵旺0668001248 <0668001248@duomai.com>
This commit is contained in:
zw-xysk
2026-06-29 09:40:41 +08:00
committed by GitHub
parent 69b0604f31
commit 4e7992cc9b
2 changed files with 77 additions and 9 deletions
@@ -416,7 +416,9 @@ describe("secrets runtime externalized channel SecretRef audit", () => {
enabled: true,
tts: {
providers: {
openai: { apiKey: inactiveExecRef("DISCORD_DISABLED_VOICE_TTS_API_KEY") },
openai: {
apiKey: inactiveExecRef("DISCORD_DISABLED_VOICE_TTS_API_KEY"),
},
},
},
},
@@ -541,4 +543,36 @@ describe("secrets runtime externalized channel SecretRef audit", () => {
]);
expectMetadataBackedContractsWereUsed();
});
it("resolves Feishu top-level appSecret SecretRef for the implicit default account", async () => {
const records = configureExternalChannelRecords(["feishu"]);
const snapshot = await prepareSecretsRuntimeSnapshot({
config: asConfig({
channels: {
feishu: {
enabled: true,
appId: "cli_default",
appSecret: ref("FEISHU_APP_SECRET"),
accounts: {
"resource-shrimp": {
enabled: true,
appId: "cli_resource",
appSecret: "inline-secret-here", // pragma: allowlist secret
},
},
},
},
}),
env: { FEISHU_APP_SECRET: "default-secret" },
includeAuthStoreRefs: false,
loadablePluginOrigins: externalChannelOrigins(records),
});
expectResolvedPaths(snapshot.config, {
"channels.feishu.appSecret": "default-secret",
"channels.feishu.accounts.resource-shrimp.appSecret": "inline-secret-here",
});
expect(snapshot.warnings).toStrictEqual([]);
expectMetadataBackedContractsWereUsed(["feishu"]);
});
});