@@ -1207,11 +1207,11 @@ fn validate_uri_component(value: &str, extra: &[u8]) -> Result<(), &'static str>
12071207
12081208impl RawSpec {
12091209 /// A parsed file is a *spec candidate* when it carries an agent-shaped signal — an identity,
1210- /// lifecycle intent, a `type` , or task blocks. Random TOML/JSON in the tree has none of these
1211- /// and is skipped.
1210+ /// lifecycle intent, the supported `service` type , or task blocks. Random TOML/JSON in the tree
1211+ /// has none of these and is skipped.
12121212 pub ( crate ) fn looks_like_spec ( & self ) -> bool {
12131213 self . identity . is_some ( )
1214- || self . job_type . is_some ( )
1214+ || self . job_type . as_deref ( ) == Some ( "service" )
12151215 || self . retired . is_some ( )
12161216 || self . desired_state . is_some ( )
12171217 || self . desired_state_reason . is_some ( )
@@ -1659,6 +1659,19 @@ mod tests {
16591659 let raw: super :: RawSpec = toml:: from_str ( "unrelated = true" ) . unwrap ( ) ;
16601660 assert ! ( !raw. looks_like_spec( ) ) ;
16611661 }
1662+
1663+ #[ test]
1664+ fn only_service_type_is_a_spec_candidate_by_itself ( ) {
1665+ let esm_manifest: super :: RawSpec = serde_json:: from_str ( r#"{"type":"module"}"# ) . unwrap ( ) ;
1666+ assert ! ( !esm_manifest. looks_like_spec( ) ) ;
1667+
1668+ let service: super :: RawSpec = serde_json:: from_str ( r#"{"type":"service"}"# ) . unwrap ( ) ;
1669+ assert ! ( service. looks_like_spec( ) ) ;
1670+
1671+ let unknown_type_declaration: super :: RawSpec =
1672+ serde_json:: from_str ( r#"{"identity":"worker","type":"module"}"# ) . unwrap ( ) ;
1673+ assert ! ( unknown_type_declaration. looks_like_spec( ) ) ;
1674+ }
16621675 use super :: * ;
16631676
16641677 #[ test]
0 commit comments