in src/shipit/phase/ShipItAssertValidFilterPhase.php [50:97]
public async function genAssertValid(
keyset<string> $source_roots,
): Awaitable<void> {
$gen_filter = $this->genFilter;
$allows_all = false;
foreach ($source_roots as $root) {
$test_file = $root.'/'.self::TEST_FILE_NAME;
$test_file = Str\replace($test_file, '//', '/');
$changeset = (new ShipItChangeset())
->withDiffs(vec[
shape('path' => $test_file, 'body' => 'junk'),
]);
// @lint-ignore AWAIT_IN_LOOP Need sync
$changeset = await $gen_filter($changeset);
if (C\count($changeset->getDiffs()) !== 1) {
$test_file_is_stripped = ShipItPathFilters::matchesAnyPattern(
$test_file,
$this->strippedFiles,
);
invariant(
$test_file_is_stripped !== null,
"Source root '%s' specified, but is removed by filter; debug: %s\n",
$root,
\var_export($changeset->getDebugMessages(), true),
);
}
if ($root === '' || $root === '.' || $root === './') {
$allows_all = true;
}
}
if ($allows_all || C\is_empty($source_roots)) {
return;
}
$path = '!!!shipit_test_file!!!';
$changeset = (new ShipItChangeset())
->withDiffs(vec[
shape('path' => $path, 'body' => 'junk'),
]);
$changeset = await $gen_filter($changeset);
invariant(
C\is_empty($changeset->getDiffs()),
'Path "%s" is not in a sourceRoot, but passes filter',
$path,
);
}