An art student of mine once needed a way to electrically control precise small amounts of water. We solved that using:

  1. Water tank and gravity  
  
  2. Medical IV flow regulator¹  
  
  3. Servo hooked up to that IV flow regulator via a 3D-printed part  
  
It worked very well. In medical applications off must be really off, so it was also quite safe in that regard as well. Her 3D-printed part had a little bit too much flex in it, but in principle this works quite well. If it is really, really safety critical I would still recommend a mechanical fallback that protects in case of power loss or when the servo fails open (e.g. bending the hose with the force of a spring if electricity is gone).

¹: see https://www.gvs.com/en/catalog/iv-flow-regulators

> If it is really, really safety critical

Your suggestions should be fine for hardware failure but I'd be more concerned about software failure: what if a bug in your software makes it unresponsive and stuck in the state with the flow open? Maybe a watchdog or some other system running in parallel checking for a heartbeat or a max amount of time water can be flowing?

Good point. In my case the program was so simple and the risk low enough that this wasn't needed. The worst thing thar could have bappened was some minor water damage to an exhibition space.

Also my track record of writing stable, bug free embedded software has been pretty solid as of now. But if human life would be on the line (for example) special precautions like multiple independent failsafe mechanisms are non-negotiable.