Keep real staged compile errors navigable under warning floods
Native and manual checks / native (ubuntu-24.04) (push) Failing after 30s
Native and manual checks / manual (push) Successful in 28s
Windows editor and software Vulkan / windows-graphics (push) Canceled after 0s
Native and manual checks / native (windows-2025) (push) Canceled after 0s

This commit is contained in:
Emil
2026-09-24 03:34:18 +03:00
parent abd8c21273
commit d7a7a7c3a4
7 changed files with 107 additions and 45 deletions
+19
View File
@@ -50,6 +50,25 @@ void contracts() {
"compile", project);
check(rows.size() == 2 && !rows[0].contains("file") && !rows[1].contains("file"),
"External and traversing sources are never navigable");
const auto snapshot = fs::path("/cache/source-snapshots/verified/Scripts");
rows = editor::parse_build_diagnostics(
"/cache/source-snapshots/verified/Scripts/Nested/Game.cpp:21:3: error: broken\n"
"/cache/source-snapshots/verified/Scripts-other/Game.cpp:4:2: error: outside\n",
"compile", project, snapshot);
check(rows.size() == 2 && rows[0].at("file") == "Scripts/Nested/Game.cpp" &&
!rows[1].contains("file"),
"Only the verified staged Scripts subtree maps back to project source");
const auto nested_snapshot = project / ".faset/cache/source-snapshots/verified/Scripts";
rows = editor::parse_build_diagnostics(
"/project/.faset/cache/source-snapshots/verified/Scripts/Game.cpp:8:2: error: broken\n",
"compile", project, nested_snapshot);
check(rows.size() == 1 && rows[0].at("file") == "Scripts/Game.cpp",
"Project-contained build snapshot does not mask its verified Scripts mapping");
rows = editor::parse_build_diagnostics(
R"(C:\cache\snapshots\verified\Scripts\Game.cpp(17,4): error C2143: syntax error)" "\n",
"compile", windows, path_from_utf8(R"(C:\cache\snapshots\verified\Scripts)"));
check(rows.size() == 1 && rows[0].at("file") == "Scripts/Game.cpp",
"Windows staged source paths keep drive and Unicode navigation support");
rows = editor::parse_build_diagnostics(
"Scripts/../Scripts/Game.cpp:4:2: error: disguised traversal\n"
"Scripts/Game.cpp:4:0: error: invalid column\n",
+10
View File
@@ -232,6 +232,16 @@ int test_main(int argc, char** argv) {
compile_failed.log.find("fixture compile failure") != std::string::npos,
"Failed compiler output retains raw log and structured source location");
fs::remove(config.project_root / "emit-clang-error-and-fail-build");
atomic_write(config.project_root / "flood-warnings-and-fail-build", "fixture\n");
const auto flooded = builds.wait(builds.start_build());
bool retained_error = false;
for (const auto& diagnostic : flooded.diagnostics)
retained_error |= diagnostic.value("severity", "") == "error" &&
diagnostic.value("file", "") == "Scripts/Gameplay.cpp";
check(flooded.state == "failed" && flooded.diagnostics.size() <= 200 &&
retained_error && read_text(last_build) == previous_pointer,
"Compiler errors survive bounded third-party warning floods");
fs::remove(config.project_root / "flood-warnings-and-fail-build");
atomic_write(config.project_root / "fail-unparseable-build", "fixture\n");
const auto generic_failed = builds.wait(builds.start_build());
check(generic_failed.state == "failed" &&
+8
View File
@@ -40,6 +40,14 @@ int tool_main(int argc, char** argv) {
return 0;
}
if (argc > 2 && std::string_view(argv[1]) == "--build") {
if (fs::exists("flood-warnings-and-fail-build")) {
for (int index = 0; index < 250; ++index)
std::cerr << "/external/library.cpp:1:1: warning: dependency warning "
<< index << '\n';
std::cerr << path_to_utf8(fs::current_path() / "Scripts/Gameplay.cpp")
<< ":7:3: error: gameplay error after warnings\n";
return 1;
}
if (fs::exists("emit-clang-error-and-fail-build")) {
std::cerr << path_to_utf8(fs::current_path() / "Scripts/Gameplay.cpp")
<< ":7:3: error: fixture compile failure\n";
+7
View File
@@ -345,6 +345,13 @@ int integration(const fs::path& root) {
source + "\n#error intentional_build_failure\n");
auto failed = service.wait(service.start_build());
require(failed.state == "failed", "Invalid user C++ must fail build");
bool navigable_cpp_error = false;
for (const auto& diagnostic : failed.diagnostics)
navigable_cpp_error |= diagnostic.value("severity", "") == "error" &&
diagnostic.value("file", "") == "Scripts/Gameplay.cpp" &&
diagnostic.value("line", 0) > 0;
require(navigable_cpp_error,
"Real staged C++ compile failure maps to a navigable project source");
require(read_text(config.cache_root / "last_build.json") == last,
"Failed compile preserved last good build");
atomic_write(config.project_root / "Scripts" / "Gameplay.cpp", source);