@@ -15,6 +15,7 @@ const mocks = vi.hoisted(() => ({
1515 listChannelPlugins : vi . fn ( ) ,
1616 listConfiguredAnnounceChannelIdsForConfig : vi . fn ( ( _params : unknown ) => [ "discord" ] ) ,
1717 missingOfficialExternalChannels : new Set < string > ( ) ,
18+ repairHintChannelIdCalls : [ ] as string [ ] [ ] ,
1819 withProgress : vi . fn ( async ( _opts : unknown , run : ( ) => Promise < unknown > ) => await run ( ) ) ,
1920} ) ) ;
2021
@@ -50,8 +51,9 @@ vi.mock("../plugins/official-external-plugin-repair-hints.js", () => ({
5051 channelIds,
5152 } : {
5253 channelIds : string [ ] ;
53- } ) =>
54- channelIds . flatMap ( ( channelId ) =>
54+ } ) => {
55+ mocks . repairHintChannelIdCalls . push ( [ ...channelIds ] ) ;
56+ return channelIds . flatMap ( ( channelId ) =>
5557 mocks . missingOfficialExternalChannels . has ( channelId )
5658 ? [
5759 {
@@ -66,7 +68,8 @@ vi.mock("../plugins/official-external-plugin-repair-hints.js", () => ({
6668 } ,
6769 ]
6870 : [ ] ,
69- ) ,
71+ ) ;
72+ } ,
7073} ) ) ;
7174
7275vi . mock ( "./channels/shared.js" , ( ) => ( {
@@ -216,6 +219,7 @@ describe("channelsStatusCommand SecretRef fallback flow", () => {
216219 mocks . requireValidConfigSnapshot . mockReset ( ) ;
217220 mocks . listChannelPlugins . mockReset ( ) ;
218221 mocks . missingOfficialExternalChannels . clear ( ) ;
222+ mocks . repairHintChannelIdCalls . length = 0 ;
219223 mocks . listConfiguredAnnounceChannelIdsForConfig . mockClear ( ) ;
220224 mocks . listConfiguredAnnounceChannelIdsForConfig . mockReturnValue ( [ "discord" ] ) ;
221225 mocks . withProgress . mockClear ( ) ;
@@ -342,6 +346,44 @@ describe("channelsStatusCommand SecretRef fallback flow", () => {
342346 ) ;
343347 } ) ;
344348
349+ it ( "resolves config-only repair hints only for the requested channel" , async ( ) => {
350+ mocks . callGateway . mockRejectedValue ( new Error ( "gateway closed" ) ) ;
351+ const config = { channels : { feishu : { appId : "cli_xxx" } , matrix : { enabled : true } } } ;
352+ mocks . requireValidConfigSnapshot . mockResolvedValue ( config ) ;
353+ mocks . resolveCommandConfigWithSecrets . mockResolvedValue ( {
354+ resolvedConfig : config ,
355+ effectiveConfig : config ,
356+ diagnostics : [ ] ,
357+ } ) ;
358+ mocks . missingOfficialExternalChannels . add ( "feishu" ) ;
359+ mocks . missingOfficialExternalChannels . add ( "matrix" ) ;
360+ mocks . listChannelPlugins . mockReturnValue ( [ ] ) ;
361+ const { runtime } = createCapturingTestRuntime ( ) ;
362+
363+ await channelsStatusCommand ( { channel : "feishu" , probe : false } , runtime as never ) ;
364+
365+ expect ( mocks . repairHintChannelIdCalls ) . toEqual ( [ [ "feishu" ] ] ) ;
366+ } ) ;
367+
368+ it ( "excludes visible channels from config-only repair-hint resolution" , async ( ) => {
369+ mocks . callGateway . mockRejectedValue ( new Error ( "gateway closed" ) ) ;
370+ const config = {
371+ channels : { discord : { enabled : true } , feishu : { appId : "cli_xxx" } } ,
372+ } ;
373+ mocks . requireValidConfigSnapshot . mockResolvedValue ( config ) ;
374+ mocks . resolveCommandConfigWithSecrets . mockResolvedValue ( {
375+ resolvedConfig : config ,
376+ effectiveConfig : config ,
377+ diagnostics : [ ] ,
378+ } ) ;
379+ mocks . missingOfficialExternalChannels . add ( "feishu" ) ;
380+ const { runtime } = createCapturingTestRuntime ( ) ;
381+
382+ await channelsStatusCommand ( { probe : false } , runtime as never ) ;
383+
384+ expect ( mocks . repairHintChannelIdCalls ) . toEqual ( [ [ "feishu" ] ] ) ;
385+ } ) ;
386+
345387 it ( "keeps JSON fallback structured without rendering config-only text" , async ( ) => {
346388 mocks . callGateway . mockRejectedValue (
347389 new Error (
0 commit comments