The framework docs (inline and on discourse) should distinguish data loaded on hook invocation, vs. data that is updated on demand
Most of the model data available in framework.model is populated on hook invocation -- e.g., it is loaded from the hook environment when a "run" of ops starts, and is not updated until the next hook fires.
There are some exceptions. The hook tool invoked by unit.is_leader actually queries the controller when the hook is run, meaning that we can generally rely on the state being up to date.
We should make it clear which routines (container liveness checks, leadership checks) present charm authors with as up-to-date as possible information, and which routines present data that may not reflect an as yet unprocessed change to the model state.
Container.can_connect is another important one that is "up-to-date".
Duplicate of #767 ? Will add can_connect to my infographic
docs: https://discourse.charmhub.io/t/talking-to-a-workload-control-flow-from-a-to-z/6161
Yeah - my bad on the dup. Let's migrate discussion to that issue since there are more words there. I've posted/quoted @pengale's content on that issue thread.