Correct behavior in find_green_parent_sha

Summary:
The "find a valid parent sha" behavior was flawed in two ways:

- It would find builds which had no valid shas (thus returning no value and causing the build to have no sha)
- It was not restricting queries to the actual project

Fixes T15701

Reviewers: vishal

Reviewed By: vishal

Maniphest Tasks: T15701

Differential Revision: https://tails.corp.dropbox.com/D63064