Delay cleaning of in-flight nodes until the following build. This allows us to interrupt evaluation in constant time.

Some ParallelEvaluator tests that implicitly relied on cleaning happening before the next evaluation were moved into MemoizingEvaluatorTest as a result.

--
MOS_MIGRATED_REVID=102696653
diff --git a/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java b/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java
index a47626d..66b84cb 100644
--- a/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java
+++ b/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java
@@ -169,8 +169,10 @@
       return (buildingState.getLastBuildValue() == null)
               ? null
           : ValueWithMetadata.justValue(buildingState.getLastBuildValue());
+    } else {
+      // Value has not finished evaluating. It's probably about to be cleaned from the graph.
+      return null;
     }
-    throw new AssertionError("Value in bad state: " + this);
   }
 
   @Override
@@ -281,9 +283,6 @@
   @Override
   public synchronized Collection<SkyKey> getReverseDeps() {
     assertKeepEdges();
-    Preconditions.checkState(isDone() || buildingState.getReverseDepsToSignal().isEmpty(),
-        "Reverse deps should only be queried before the build has begun "
-            + "or after the node is done %s", this);
     return REVERSE_DEPS_UTIL.getReverseDeps(this);
   }