How to compute a ratio
Convert both colors to relative luminance, then (L1 + 0.05) / (L2 + 0.05). The result is the ratio; compare it to 4.5 for body text.
Where this usually breaks
Placeholder gray text on a light background, and any state conveyed only by a hue shift. Both are cheap to fix and both appear in every audit.