Program: 52950
Project: 52950
Buggy source:
@Test public void manifestIsUpdatedWhenBuiltLocally() throws Exception {
  DefaultDependencyFileRuleKeyFactory depFilefactory=new DefaultDependencyFileRuleKeyFactory(FIELD_LOADER,fileHashCache,pathResolver,ruleFinder);
  final Genrule genrule=GenruleBuilder.newGenruleBuilder(BuildTargetFactory.newInstance("String_Node_Str")).setOut("String_Node_Str").build(resolver,filesystem);
  final Path input=pathResolver.getRelativePath(Preconditions.checkNotNull(genrule.getSourcePathToOutput()));
  filesystem.writeContentsToPath("String_Node_Str",input);
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleParams params=new FakeBuildRuleParamsBuilder(target).setProjectFilesystem(filesystem).build();
  final Path output=Paths.get("String_Node_Str");
  DepFileBuildRule rule=new DepFileBuildRule(params){
    @AddToRuleKey private final SourcePath path=genrule.getSourcePathToOutput();
    @Override public ImmutableList<Step> getBuildSteps(    BuildContext context,    BuildableContext buildableContext){
      return ImmutableList.of(new WriteFileStep(filesystem,"String_Node_Str",output,false));
    }
    @Override public Predicate<SourcePath> getCoveredByDepFilePredicate(){
      return (      SourcePath path) -> true;
    }
    @Override public Predicate<SourcePath> getExistenceOfInterestPredicate(){
      return (      SourcePath path) -> false;
    }
    @Override public ImmutableList<SourcePath> getInputsAfterBuildingLocally(    BuildContext context){
      return ImmutableList.of(new PathSourcePath(filesystem,input));
    }
    @Override public SourcePath getSourcePathToOutput(){
      return new ExplicitBuildTargetSourcePath(getBuildTarget(),output);
    }
  }
;
  CachingBuildEngine cachingBuildEngine=cachingBuildEngineFactory().setDepFiles(CachingBuildEngine.DepFiles.CACHE).setRuleKeyFactories(RuleKeyFactories.of(defaultRuleKeyFactory,inputBasedRuleKeyFactory,depFilefactory)).build();
  Manifest manifest=Manifest.fromMap(ImmutableMap.of(new RuleKey("String_Node_Str"),ImmutableMap.of("String_Node_Str",HashCode.fromInt(12))));
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
  try (GZIPOutputStream outputStream=new GZIPOutputStream(byteArrayOutputStream)){
    manifest.serialize(outputStream);
  }
   cache.store(ArtifactInfo.builder().addRuleKeys(cachingBuildEngine.getManifestRuleKey(rule,buildContext.getEventBus()).get()).build(),byteArrayOutputStream.toByteArray());
  BuildResult result=cachingBuildEngine.build(buildContext,TestExecutionContext.newInstance(),rule).get();
  assertThat(getSuccess(result),equalTo(BuildRuleSuccessType.BUILT_LOCALLY));
  OnDiskBuildInfo onDiskBuildInfo=buildContext.createOnDiskBuildInfoFor(target,filesystem,buildInfoStore);
  RuleKey depFileRuleKey=onDiskBuildInfo.getRuleKey(BuildInfo.MetadataKey.DEP_FILE_RULE_KEY).get();
  Path fetchedManifest=tmp.newFile("String_Node_Str");
  CacheResult cacheResult=cache.fetch(cachingBuildEngine.getManifestRuleKey(rule,buildContext.getEventBus()).get(),LazyPath.ofInstance(fetchedManifest));
  assertThat(cacheResult.getType(),equalTo(CacheResultType.HIT));
  manifest=loadManifest(fetchedManifest);
  assertThat(manifest.toMap(),equalTo(ImmutableMap.of(depFileRuleKey,ImmutableMap.of(input.toString(),fileHashCache.get(filesystem.resolve(input))),new RuleKey("String_Node_Str"),ImmutableMap.of("String_Node_Str",HashCode.fromInt(12)))));
  Path fetchedArtifact=tmp.newFile("String_Node_Str");
  cacheResult=cache.fetch(depFileRuleKey,LazyPath.ofInstance(fetchedArtifact));
  assertThat(cacheResult.getType(),equalTo(CacheResultType.HIT));
}

Fixed version (ground truth):
@Test public void manifestIsUpdatedWhenBuiltLocally() throws Exception {
  DefaultDependencyFileRuleKeyFactory depFilefactory=new DefaultDependencyFileRuleKeyFactory(FIELD_LOADER,fileHashCache,pathResolver,ruleFinder);
  final Genrule genrule=GenruleBuilder.newGenruleBuilder(BuildTargetFactory.newInstance("String_Node_Str")).setOut("String_Node_Str").build(resolver,filesystem);
  final Path input=pathResolver.getRelativePath(Preconditions.checkNotNull(genrule.getSourcePathToOutput()));
  filesystem.writeContentsToPath("String_Node_Str",input);
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleParams params=new FakeBuildRuleParamsBuilder(target).setProjectFilesystem(filesystem).build();
  final Path output=Paths.get("String_Node_Str");
  DepFileBuildRule rule=new DepFileBuildRule(params){
    @AddToRuleKey private final SourcePath path=genrule.getSourcePathToOutput();
    @Override public ImmutableList<Step> getBuildSteps(    BuildContext context,    BuildableContext buildableContext){
      return ImmutableList.of(new WriteFileStep(filesystem,"String_Node_Str",output,false));
    }
    @Override public Predicate<SourcePath> getCoveredByDepFilePredicate(){
      return (      SourcePath path) -> true;
    }
    @Override public Predicate<SourcePath> getExistenceOfInterestPredicate(){
      return (      SourcePath path) -> false;
    }
    @Override public ImmutableList<SourcePath> getInputsAfterBuildingLocally(    BuildContext context){
      return ImmutableList.of(new PathSourcePath(filesystem,input));
    }
    @Override public SourcePath getSourcePathToOutput(){
      return new ExplicitBuildTargetSourcePath(getBuildTarget(),output);
    }
  }
;
  CachingBuildEngine cachingBuildEngine=cachingBuildEngineFactory().setDepFiles(CachingBuildEngine.DepFiles.CACHE).setRuleKeyFactories(RuleKeyFactories.of(defaultRuleKeyFactory,inputBasedRuleKeyFactory,depFilefactory)).build();
  Manifest manifest=Manifest.fromMap(depFilefactory.buildManifestKey(rule).getRuleKey(),ImmutableMap.of(new RuleKey("String_Node_Str"),ImmutableMap.of("String_Node_Str",HashCode.fromInt(12))));
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
  try (GZIPOutputStream outputStream=new GZIPOutputStream(byteArrayOutputStream)){
    manifest.serialize(outputStream);
  }
   cache.store(ArtifactInfo.builder().addRuleKeys(cachingBuildEngine.getManifestRuleKey(rule,buildContext.getEventBus()).get()).build(),byteArrayOutputStream.toByteArray());
  BuildResult result=cachingBuildEngine.build(buildContext,TestExecutionContext.newInstance(),rule).get();
  assertThat(getSuccess(result),equalTo(BuildRuleSuccessType.BUILT_LOCALLY));
  OnDiskBuildInfo onDiskBuildInfo=buildContext.createOnDiskBuildInfoFor(target,filesystem,buildInfoStore);
  RuleKey depFileRuleKey=onDiskBuildInfo.getRuleKey(BuildInfo.MetadataKey.DEP_FILE_RULE_KEY).get();
  Path fetchedManifest=tmp.newFile("String_Node_Str");
  CacheResult cacheResult=cache.fetch(cachingBuildEngine.getManifestRuleKey(rule,buildContext.getEventBus()).get(),LazyPath.ofInstance(fetchedManifest));
  assertThat(cacheResult.getType(),equalTo(CacheResultType.HIT));
  manifest=loadManifest(fetchedManifest);
  assertThat(manifest.toMap(),equalTo(ImmutableMap.of(depFileRuleKey,ImmutableMap.of(input.toString(),fileHashCache.get(filesystem.resolve(input))),new RuleKey("String_Node_Str"),ImmutableMap.of("String_Node_Str",HashCode.fromInt(12)))));
  Path fetchedArtifact=tmp.newFile("String_Node_Str");
  cacheResult=cache.fetch(depFileRuleKey,LazyPath.ofInstance(fetchedArtifact));
  assertThat(cacheResult.getType(),equalTo(CacheResultType.HIT));
}