What is "information leak from test to train" ? Is stratification by target a leak? It's common practice to do procedures such as standardization and even missing value imputation (commonly based on some means) after train/test split - otherwise it is treated as information leak from test to train.
But what sort of "leaks" we are worried about? If I impute "Apple" to empty "device_brand" fields, where "device_os" is "iOS" - and only after that perform train/test split, is it a "leak"?
Another example - in imbalanced classification problems, it's common practice to explicitly preserve class balance while splitting dataset to train/test. But why stratification (preserving class balance) is not considered as info leak by the same reason?
Are there more or less formal rules, what sort of data preprocessing can be done before train/test splitting, and what can't?

The data transformation that you describe is usually not referred to as "imputation", and it will not lead to information leakage. If the value of device brand is determined only by the value of device_os from the same observation, then the procedure for each observation is independent from all other observations, so there cannot be any exchange of information between your test and training data.
In other words, information leakage occurs if the training data is processed in a way that is informed by the test data. The rule of assigning "Apple" to all iOS devices is not something that you have learned from the data, and you don't need information on any other observations to determine the imputed value of a specific observation.
It would be different if you would use another approach to imputation, e.g. multiple imputation, where the imputed value is informed by the whole data, for example by fitting a model to the data to individually predict missing values. In this case, the imputed value depends on the data, and if you do that before the split, the model is trained on information provided by the test data, so there is information leakage.
