7373 * {@link bareNameRefusal} is the same resolution for a bare address: a bare
7474 * name the resolver refuses is answered `409` naming every candidate (D5), on
7575 * the doors whose own answer was no such `409`.
76+ *
77+ * [ADR-0150 D3, #33386; seat ruling 6884403301] A name two or more packages
78+ * hold, one of them disabled, is judged over the SERVED holders at the doors
79+ * (a disabled package holds no name), the shape the email send took
80+ * (plugin-email `template-loader.ts`):
81+ *
82+ * - a bare name ({@link bareNameAdmission}): one served holder is that
83+ * holder's slot, two or more are refused naming the served holders only,
84+ * and none is no item (the door's own `404`). A slot is `(package, name)`
85+ * and is never re-pointed: a disable only moves which slot the bare name
86+ * reaches;
87+ * - an address naming the disabled holder's namespace is never another
88+ * package's item: `not-held-by-qualifier` naming the served holders, or
89+ * `404` when none remains; `_env` and any other namespace name the served
90+ * holders only.
91+ *
92+ * The durable coordinates stay judged over EVERY holder (amendment 7): the
93+ * engine's slot keys, a run's key, and {@link bareNameRefusal}, which the MCP
94+ * resume door reads to tell a run row's slot. So does the refusal a slot
95+ * carries for the doors that cannot serve from the slot (the definition
96+ * writes): a write targets the name every holder holds.
7697 */
7798
7899import {
@@ -259,6 +280,33 @@ export function bareNameRefusal(
259280 return resolution . status === 'refused' ? resolution : undefined ;
260281}
261282
283+ /**
284+ * [ADR-0150 D3, #33386] A BARE by-name door's admission (see the module note):
285+ * the bare name's `409` naming the served holders when two or more serve it,
286+ * the slot of its one served holder when the name is held by two or more
287+ * packages over every holder (each holder's item is then its own slot), and
288+ * `undefined` otherwise — the bare path, as before, which answers its own
289+ * `404` when no served holder remains. A name held by one package or none is
290+ * judged as {@link bareNameRefusal} judges it, unchanged. Read-only.
291+ */
292+ export function bareNameAdmission (
293+ registry : AutomationAddressRegistry | undefined ,
294+ type : 'flow' | 'connector' ,
295+ name : string ,
296+ ) : AutomationAddressRefusal | AutomationAddressSlot | undefined {
297+ if ( ! registry || ! canResolve ( registry ) ) return undefined ;
298+ const every = resolvePackageScopedName ( registry , { type, name, callerPackageId : null , includeDisabledPackages : true } ) ;
299+ if ( every . status !== 'refused' || holdersOf ( registry , type , name , { includeDisabledPackages : true } ) . length < 2 ) {
300+ return every . status === 'refused' ? { status : 409 , refusal : every } : undefined ;
301+ }
302+ const served = resolvePackageScopedName ( registry , { type, name, callerPackageId : null } ) ;
303+ if ( served . status === 'refused' ) return { status : 409 , refusal : served } ;
304+ if ( served . status === 'resolved' && served . holder . kind === 'package' ) {
305+ return { status : 'slot' , packageId : served . holder . packageId , refusal : every } ;
306+ }
307+ return undefined ;
308+ }
309+
262310/**
263311 * Judge an addressed path's qualifier (see the module note). `undefined`
264312 * admits it: the path is then served as its bare path, whose item is the
@@ -279,14 +327,16 @@ export function admitAutomationAddress(
279327 ? undefined
280328 : { status : 404 , message : `${ noun } '${ name } ' not found in namespace '${ qualifier . namespace } '` } ;
281329 }
282- // [#32183, R4-G] A name two or more packages hold over every holder (the
283- // state #31696 opened for a flow, each holder's flow in its own engine
284- // slot) is judged over every holder, a disabled package's included, so a
285- // disable moves no address of it (`main`'s answer). A one-holder name is
286- // judged over the served holders, as every by-name door is.
330+ // [ADR-0150 D3, #33386] Judged over the served holders, as every by-name
331+ // door is: a disabled package holds no name, so an address naming it is
332+ // never another package's item, and a refusal names the served holders
333+ // only (seat ruling 6884403301, amendments 2 and 6). A name two or more
334+ // packages hold over EVERY holder (the state #31696 opened, each holder's
335+ // item in its own engine slot) is still served from the addressed
336+ // holder's slot: the slots are keyed over every holder (amendment 7).
287337 const everyHolder = holdersOf ( registry , type , name , { includeDisabledPackages : true } ) ;
288338 const shared = everyHolder . length > 1 ;
289- const holders = shared ? everyHolder : holdersOf ( registry , type , name ) ;
339+ const holders = holdersOf ( registry , type , name ) ;
290340 let holder : PackageScopedHolder ;
291341 if ( qualifier . kind === 'environment' ) {
292342 if ( registry . getEnvironmentScopedItem ( type , name ) !== undefined || holders . length === 0 ) return undefined ;
@@ -313,7 +363,9 @@ export function admitAutomationAddress(
313363 // [#31696] A flow name two packages hold: each holder's flow is its own
314364 // slot, and the address names one holder of it. [ADR-0150 D9, #31699]
315365 // So is a connector name: each holder's instance is its own, and the
316- // connection door connects the addressed one.
366+ // connection door connects the addressed one. [#33386] The addressed
367+ // holder is a served one (above); the slot's refusal, for the doors
368+ // that cannot serve from it, stays the name's over every holder.
317369 return ( type === 'flow' || type === 'connector' ) && holder . kind === 'package'
318370 ? { status : 'slot' , packageId : holder . packageId , refusal : bare }
319371 : { status : 409 , refusal : bare } ;
0 commit comments