@@ -1119,25 +1119,31 @@ export async function resolveCommandSecretRefsViaGateway(params: {
11191119 optionalActivePaths : params . optionalActivePaths ,
11201120 resolutionPolicy,
11211121 } ) ;
1122+ const handledPaths = new Set < string > ( ) ;
1123+ const locallyResolvedPaths = new Set < string > ( ) ;
11221124 for ( const unresolved of analyzed . unresolved ) {
1123- if ( localFallback . targetStatesByPath [ unresolved . path ] !== "resolved_local" ) {
1125+ const localState = localFallback . targetStatesByPath [ unresolved . path ] ;
1126+ if ( localState === "inactive_surface" ) {
1127+ // A partial gateway snapshot can omit inactive refs as well as unresolved refs.
1128+ // Local inactive classification is terminal even though it materializes no value.
1129+ targetStatesByPath [ unresolved . path ] = localState ;
1130+ handledPaths . add ( unresolved . path ) ;
1131+ continue ;
1132+ }
1133+ if ( localState !== "resolved_local" ) {
11241134 continue ;
11251135 }
11261136 setPathExistingStrict (
11271137 resolvedConfig ,
11281138 unresolved . pathSegments ,
11291139 getPath ( localFallback . resolvedConfig , unresolved . pathSegments ) ,
11301140 ) ;
1131- targetStatesByPath [ unresolved . path ] = "resolved_local" ;
1141+ targetStatesByPath [ unresolved . path ] = localState ;
1142+ handledPaths . add ( unresolved . path ) ;
1143+ locallyResolvedPaths . add ( unresolved . path ) ;
11321144 }
1133- const recoveredPaths = new Set (
1134- Object . entries ( localFallback . targetStatesByPath )
1135- . filter ( ( [ , state ] ) => state === "resolved_local" )
1136- . map ( ( [ path ] ) => path ) ,
1137- ) ;
1138- const stillUnresolved = analyzed . unresolved . filter (
1139- ( entry ) => ! recoveredPaths . has ( entry . path ) ,
1140- ) ;
1145+ diagnostics = dedupeDiagnostics ( [ ...diagnostics , ...localFallback . diagnostics ] ) ;
1146+ const stillUnresolved = analyzed . unresolved . filter ( ( entry ) => ! handledPaths . has ( entry . path ) ) ;
11411147 if ( stillUnresolved . length > 0 ) {
11421148 if ( enforcesResolvedSecrets ( mode ) ) {
11431149 throw new Error (
@@ -1149,17 +1155,16 @@ export async function resolveCommandSecretRefsViaGateway(params: {
11491155 }
11501156 diagnostics = dedupeDiagnostics ( [
11511157 ...diagnostics ,
1152- ...localFallback . diagnostics ,
11531158 ...buildUnresolvedDiagnostics ( params . commandName , stillUnresolved , mode ) ,
11541159 ] ) ;
11551160 for ( const unresolved of stillUnresolved ) {
11561161 targetStatesByPath [ unresolved . path ] = "unresolved" ;
11571162 }
1158- } else if ( recoveredPaths . size > 0 ) {
1163+ } else if ( locallyResolvedPaths . size > 0 ) {
11591164 diagnostics = dedupeDiagnostics ( [
11601165 ...diagnostics ,
1161- `${ params . commandName } : resolved ${ recoveredPaths . size } secret ${
1162- recoveredPaths . size === 1 ? "path" : "paths"
1166+ `${ params . commandName } : resolved ${ locallyResolvedPaths . size } secret ${
1167+ locallyResolvedPaths . size === 1 ? "path" : "paths"
11631168 } locally after the gateway snapshot was incomplete.`,
11641169 ] ) ;
11651170 }
0 commit comments