  Galactic scale tests have proven to be powerful tools in constraining
fundamental physics in previously under-explored regions of parameter space.
The astrophysical regime which they probe is inherently complicated, and the
inference methods used to make these constraints should be robust to baryonic
effects. Previous analyses have assumed simple empirical models for
astrophysical noise without detailed calibration or justification. We outline a
framework for assessing the reliability of such methods by constructing and
testing more advanced baryonic models using cosmological hydrodynamical
simulations. As a case study, we use the Horizon-AGN simulation to investigate
warping of stellar disks and offsets between gas and stars within galaxies,
which are powerful probes of screened fifth forces. We show that the degree of
`U'-shaped warping of galaxies is well modelled by Gaussian random noise, but
that the magnitude of the gas-star offset is correlated with the virial radius
of the host halo. By incorporating this correlation we confirm recent results
ruling out astrophysically relevant Hu-Sawicki $f(R)$ gravity, and identify a
$\sim 30\%$ systematic uncertainty due to baryonic physics. Such an analysis
must be performed case-by-case for future galactic tests of fundamental
physics.
