Drupal 8 entityQuery No results seemingly randomly... and the fix
So here I was, struggling on a project. I had code for a custom drush command to find nodes needing to be archived and/or published based on field values, and was accomplishing it with entityQuery. Low and behold... The entity query via drush would return no results, however when I executed it anywhere else (execute PHP, form submission, whatever)... it returned 15 results! What the heck was causing this?
Welp... apparently there's access checking on entity queries... which is really annoying if you happen to be building something that has frack all to do with permissions, as it will deny your permission and do so silently... Gross.
So the simple solution: