@@ -12,6 +12,7 @@ import type {
1212import type { PluginInstallRecord } from "../config/types.plugins.js" ;
1313import {
1414 pinActivePluginChannelRegistry ,
15+ pinActivePluginHttpRouteRegistry ,
1516 resetPluginRuntimeStateForTest ,
1617 setActivePluginRegistry ,
1718} from "../plugins/runtime.js" ;
@@ -172,7 +173,7 @@ describe("buildGatewayReloadPlan", () => {
172173 {
173174 pluginId : "browser" ,
174175 pluginName : "Browser" ,
175- registration : { restartPrefixes : [ "browser" ] } ,
176+ registration : { restartPrefixes : [ "browser" ] , hotPrefixes : [ "browser.profiles" ] } ,
176177 source : "test" ,
177178 } ,
178179 {
@@ -214,6 +215,28 @@ describe("buildGatewayReloadPlan", () => {
214215 expect ( plan . hotReasons ) . toStrictEqual ( [ ] ) ;
215216 } ) ;
216217
218+ it ( "hot-reloads browser profile config under the broad browser restart rule" , ( ) => {
219+ const path = "browser.profiles.sandbox.cdpUrl" ;
220+ const plan = buildGatewayReloadPlan ( [ path ] ) ;
221+
222+ expect ( plan . restartGateway ) . toBe ( false ) ;
223+ expect ( plan . restartReasons ) . toStrictEqual ( [ ] ) ;
224+ expect ( plan . hotReasons ) . toEqual ( [ path ] ) ;
225+ expect ( plan . noopPaths ) . toStrictEqual ( [ ] ) ;
226+ expect ( resolveConfigReloadMetadata ( path ) . kind ) . toBe ( "hot" ) ;
227+ } ) ;
228+
229+ it ( "keeps Gateway reload policy when an agent activates a scoped registry" , ( ) => {
230+ pinActivePluginHttpRouteRegistry ( registry ) ;
231+ setActivePluginRegistry ( emptyRegistry ) ;
232+
233+ const path = "browser.profiles.sandbox.cdpUrl" ;
234+ expect ( buildGatewayReloadPlan ( [ path ] ) ) . toMatchObject ( {
235+ restartGateway : false ,
236+ hotReasons : [ path ] ,
237+ } ) ;
238+ } ) ;
239+
217240 it ( "restarts the Gmail watcher for hooks.gmail changes" , ( ) => {
218241 const plan = buildGatewayReloadPlan ( [ "hooks.gmail.account" ] ) ;
219242 expect ( plan . restartGateway ) . toBe ( false ) ;
@@ -513,6 +536,16 @@ describe("buildGatewayReloadPlan", () => {
513536 expectRestartGateway : true ,
514537 expectRestartReason : "browser.enabled" ,
515538 } ,
539+ {
540+ path : "browser.defaultProfile" ,
541+ expectRestartGateway : true ,
542+ expectRestartReason : "browser.defaultProfile" ,
543+ } ,
544+ {
545+ path : "browser.profiles.sandbox.cdpUrl" ,
546+ expectRestartGateway : false ,
547+ expectHotPath : "browser.profiles.sandbox.cdpUrl" ,
548+ } ,
516549 {
517550 path : "gateway.channelHealthCheckMinutes" ,
518551 expectRestartGateway : false ,
0 commit comments