Refactor: scheduler: improve unpacking of action history task and interval
Functionize checking whether a given history entry can affect resource state,
mainly to leave a note about a possible future change.
Do the task and interval checks early, to avoid needless work if we have to
return.