Code monitors: fix repo-aware creation of code monitors
Created by: camdencheek
With the new optimization passes, we'd fail to create new repo-aware code monitors because we'd have noop jobs in the job tree that were not explicitly allowed. This fixes that and adds a test that ensures that normal queries pass this validation step.
Test plan
Added a test.