
Bazel 203: Migrate dev workflows
Ratchet Mechanism
Use a Bazel ratchet mechanism in CI to lock in invariants like type-check fixes so new commits cannot reintroduce previously eliminated build errors.
The ratchet is a mechanical tool to ensure “no backsliding”.

Whenever you tighten the semantics of the build, by ensuring some new invariant holds, you should have a ratchet in place to make sure it stays that way
For example, if you fix some type-check errors, you should make sure the CI system will mark any subsequent changes red if they re-introduce those type-check errors.
Combined with “change one thing at a time” this can give you incredible power to work in a huge codebase.
For example if you just introduce one type-check error code at a time, you can fix only those, and use your ratchet to make sure those don’t come back.
You can then rinse-and-repeat with low risk changes, while ensuring that the system as a whole is eventually converging on the correct behavior.
It feels slow, but this is the same as a gear ratio on a bike: you have incredible “mechanical advantage” to move heavy objects at that slow speed.


