@@ -1037,16 +1037,15 @@ describe('#28594 — a definition stored in this environment is refused its pack
10371037 await kernel . shutdown ( ) ;
10381038 } ) ;
10391039
1040- it ( 'control: a configuration fault other than a refused ref (an unknown provider) still fails the boot' , async ( ) => {
1041- // The soft path is the stored entry's refused ref alone; a provider the
1042- // runtime does not offer keeps the fail-loud contract.
1040+ it ( 'control: the host\'s own entry with a configuration fault (an unknown provider) still fails the boot' , async ( ) => {
1041+ // The soft path is a stored entry's alone (#28698): the host's
1042+ // registered declaration, faulty as filed, keeps the fail-loud contract.
10431043 const { factory } = makeRefProvider ( ) ;
1044+ const faulty = { ...hostEntry , provider : 'no_such_provider' } ;
10441045 const err = await rejectionOf (
1045- boot ( [ { ...hostEntry , provider : 'no_such_provider' } ] , {
1046- providerFactory : factory , packageRoot : fixtureRoot , packages, registered,
1047- } ) ,
1046+ boot ( [ { ...faulty } ] , { providerFactory : factory , packageRoot : fixtureRoot , packages, registered : [ faulty ] } ) ,
10481047 ) ;
1049- expect ( err . message ) . toContain ( 'host_pkg' ) ;
1048+ expect ( err . message ) . toContain ( `connector instance 'host_pkg' declares provider 'no_such_provider'` ) ;
10501049 } ) ;
10511050
10521051 it ( 'control: a stored entry carrying its document inline materializes — neither member is reached' , async ( ) => {
@@ -1085,6 +1084,139 @@ describe('#28594 — a definition stored in this environment is refused its pack
10851084 } ) ;
10861085} ) ;
10871086
1087+ // ── #28698 — every configuration fault of a STORED entry is soft at boot ────
1088+ //
1089+ // #28594 made a stored entry's refused ref soft at boot. Every other
1090+ // configuration fault the boot reconcile meets on a stored entry takes the same
1091+ // path (#28698): logged with the record a reload writes, the entry skipped,
1092+ // the host's entries beside it served. The host's own entry with the same fault
1093+ // keeps failing the boot.
1094+
1095+ describe ( '#28698 — a stored entry\'s configuration fault never fails the boot; the host\'s still does' , ( ) => {
1096+ const HOST = 'com.acme.host' ;
1097+ const packages = { [ HOST ] : { source : 'code' } } ;
1098+ const ownedBy = < T extends object > ( item : T , packageId : string ) => ( { ...item , _packageId : packageId } ) ;
1099+ const bearer = { type : 'bearer' , credentialRef : 'OS_TEST_28698_VAULT_REF' } as ConnectorInstanceAuth ;
1100+
1101+ /** A factory that materializes every entry, except one whose providerConfig asks it to refuse. */
1102+ function makeProvider ( ) {
1103+ const calls : string [ ] = [ ] ;
1104+ const factory : ConnectorProviderFactory = ( ctx ) => {
1105+ calls . push ( ctx . name ) ;
1106+ if ( ctx . providerConfig . refuse === true ) throw new Error ( `providerConfig of '${ ctx . name } ' is not valid: refuse is set` ) ;
1107+ return {
1108+ def : { name : ctx . name , label : ctx . label , type : 'api' , authentication : { type : 'none' } , actions : [ { key : 'ping' , label : 'Ping' } ] } as unknown as Connector ,
1109+ handlers : { ping : async ( ) => ( { ok : true } ) } ,
1110+ } ;
1111+ } ;
1112+ return { factory, calls } ;
1113+ }
1114+ const throwingResolver : CredentialResolver = ( ) => { throw new Error ( 'the vault could not be reached' ) ; } ;
1115+
1116+ /** The host's entry served beside every stored fault: registered, so it is the host's. */
1117+ const hostServed = ownedBy ( providerConnector ( 'host_served' ) , HOST ) ;
1118+
1119+ /**
1120+ * One fault, spelled for an entry `name`: what the entry carries, the boot
1121+ * options it needs, and the record text that names it.
1122+ */
1123+ const FAULTS : Array < {
1124+ fault : string ;
1125+ entry : ( name : string ) => Record < string , unknown > ;
1126+ opts ?: Partial < BootOptions > ;
1127+ livePlugin ?: boolean ;
1128+ record : ( name : string ) => string ;
1129+ } > = [
1130+ {
1131+ fault : 'a provider no plugin offers' ,
1132+ entry : ( name ) => providerConnector ( name , { provider : 'no_such_provider' } ) ,
1133+ record : ( name ) => `connector instance '${ name } ' declares provider 'no_such_provider', but no provider factory is registered` ,
1134+ } ,
1135+ {
1136+ fault : 'an invalid retryConfig' ,
1137+ entry : ( name ) => ( { ...providerConnector ( name ) , retryConfig : { maxAttempts : - 3 } } ) ,
1138+ record : ( name ) => `connector instance '${ name } ' (provider 'fake'): retryConfig is not a valid connector retry policy` ,
1139+ } ,
1140+ {
1141+ fault : 'a credential resolver that throws' ,
1142+ entry : ( name ) => providerConnector ( name , { auth : bearer } ) ,
1143+ opts : { credentialResolver : throwingResolver } ,
1144+ record : ( name ) => `connector instance '${ name } ' (provider 'fake'): auth resolution failed` ,
1145+ } ,
1146+ {
1147+ fault : 'a name a plugin connector holds' ,
1148+ entry : ( name ) => providerConnector ( name ) ,
1149+ livePlugin : true ,
1150+ record : ( name ) => `declarative provider-bound instance '${ name } ' collides with a plugin-registered connector` ,
1151+ } ,
1152+ {
1153+ fault : 'a providerConfig its provider refuses' ,
1154+ entry : ( name ) => providerConnector ( name , { providerConfig : { refuse : true } } ) ,
1155+ record : ( name ) => `failed to materialize connector instance '${ name } ' via provider 'fake'` ,
1156+ } ,
1157+ ] ;
1158+
1159+ it . each ( FAULTS . map ( ( f ) => [ f . fault , f ] as const ) ) ( 'a stored entry with %s: the boot starts, the entry is skipped with its record, the host\'s entry serves' , async ( _fault , f ) => {
1160+ const { factory } = makeProvider ( ) ;
1161+ const logged : Array < { msg : string ; meta ?: unknown } > = [ ] ;
1162+ const name = 'stored_faulty' ;
1163+ const kernel = await boot ( [ { ...hostServed } , f . entry ( name ) ] , {
1164+ providerFactory : factory , packages, registered : [ hostServed ] , logged,
1165+ ...( f . livePlugin ? { registerLivePlugin : [ name ] } : { } ) ,
1166+ ...f . opts ,
1167+ } ) ;
1168+ const engine = automationOf ( kernel ) ;
1169+ expect ( engine . getRegisteredConnectors ( ) ) . toContain ( 'host_served' ) ;
1170+ // Skipped: nothing declarative serves the name (a plugin connector may).
1171+ expect ( engine . getConnectorOrigin ( name ) ) . not . toBe ( 'declarative' ) ;
1172+ const record = logged . find ( ( l ) => l . msg . includes ( f . record ( name ) ) ) ;
1173+ expect ( record , `no record names '${ name } ': ${ JSON . stringify ( logged . map ( ( l ) => l . msg ) ) } ` ) . toBeDefined ( ) ;
1174+ await kernel . shutdown ( ) ;
1175+ } ) ;
1176+
1177+ it . each ( FAULTS . map ( ( f ) => [ f . fault , f ] as const ) ) ( 'control: the host\'s own entry with %s still fails the boot' , async ( _fault , f ) => {
1178+ const { factory } = makeProvider ( ) ;
1179+ const name = 'host_faulty' ;
1180+ const faulty = ownedBy ( f . entry ( name ) , HOST ) ;
1181+ const err = await rejectionOf ( boot ( [ { ...faulty } ] , {
1182+ providerFactory : factory , packages, registered : [ faulty ] ,
1183+ ...( f . livePlugin ? { registerLivePlugin : [ name ] } : { } ) ,
1184+ ...f . opts ,
1185+ } ) ) ;
1186+ expect ( err . message ) . toContain ( f . record ( name ) ) ;
1187+ } ) ;
1188+
1189+ it ( 'a stored entry duplicating the host\'s name is skipped with its record; the host\'s entry serves' , async ( ) => {
1190+ const { factory, calls } = makeProvider ( ) ;
1191+ const logged : Array < { msg : string ; meta ?: unknown } > = [ ] ;
1192+ const kernel = await boot (
1193+ [ { ...hostServed } , providerConnector ( 'host_served' , { providerConfig : { other : true } } ) ] ,
1194+ { providerFactory : factory , packages, registered : [ hostServed ] , logged } ,
1195+ ) ;
1196+ expect ( automationOf ( kernel ) . getRegisteredConnectors ( ) ) . toContain ( 'host_served' ) ;
1197+ expect ( calls ) . toEqual ( [ 'host_served' ] ) ;
1198+ expect ( logged . some ( ( l ) => l . msg . includes ( `duplicate declarative connector instance name 'host_served'` ) ) ) . toBe ( true ) ;
1199+ await kernel . shutdown ( ) ;
1200+ } ) ;
1201+
1202+ it ( 'control: two host entries of one name still fail the boot' , async ( ) => {
1203+ const { factory } = makeProvider ( ) ;
1204+ const err = await rejectionOf ( boot ( [ { ...hostServed } , { ...hostServed } ] , {
1205+ providerFactory : factory , packages, registered : [ hostServed ] ,
1206+ } ) ) ;
1207+ expect ( err . message ) . toContain ( `duplicate declarative connector instance name 'host_served'` ) ;
1208+ } ) ;
1209+
1210+ it ( 'control: an INSTALLED package\'s entry with a configuration fault still fails the boot (#28534 unchanged)' , async ( ) => {
1211+ const { factory } = makeProvider ( ) ;
1212+ const installed = ownedBy ( providerConnector ( 'installed_faulty' , { provider : 'no_such_provider' } ) , 'com.acme.installed' ) ;
1213+ const err = await rejectionOf ( boot ( [ installed ] , {
1214+ providerFactory : factory , packages : { ...packages , 'com.acme.installed' : { source : 'marketplace' } } , registered : [ installed ] ,
1215+ } ) ) ;
1216+ expect ( err . message ) . toContain ( `connector instance 'installed_faulty' declares provider 'no_such_provider'` ) ;
1217+ } ) ;
1218+ } ) ;
1219+
10881220// ── #3017 — upstream unavailable: degrade + retry, never a dead boot ─────────
10891221//
10901222// A provider factory that throws the CONNECTOR_UPSTREAM_UNAVAILABLE marker
0 commit comments