From fc190d6cc59639311ac4cbe28e53daa2092e49c4 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 6 Apr 2026 14:23:26 +0000 Subject: [PATCH 1/2] Fix linker errors and compiler warnings in CI Add missing EditorPanel.cpp and ARPGDungeonSystem.cpp to test sources, fix format specifier for uint64_t, suppress unused-variable warnings from disabled debug draw macros, and fix unsigned >= 0 comparisons. https://claude.ai/code/session_01GWZkHNsStxny6ZNZjFosjY --- .github/badges/files.json | 8 ++++---- .github/badges/loc-breakdown.json | 18 +++++++++--------- .github/badges/loc.json | 12 ++++++------ SparkEditor/Source/Prefabs/PrefabManager.cpp | 3 ++- .../Source/Engine/AI/AIDebugRenderer.cpp | 4 ++-- Tests/CMakeLists.txt | 2 ++ Tests/TestCoreAndBuildSystems.cpp | 7 +++---- Tests/TestEditorSubsystems.cpp | 2 +- Tests/TestOpenWorldModule.cpp | 2 +- wiki/Codebase-Statistics.md | 6 +++--- wiki/Home.md | 2 +- 11 files changed, 34 insertions(+), 32 deletions(-) diff --git a/.github/badges/files.json b/.github/badges/files.json index e6ff8b76..52a7aeea 100644 --- a/.github/badges/files.json +++ b/.github/badges/files.json @@ -1,6 +1,6 @@ { - "schemaVersion": 1, - "label": "source files", - "message": "1574", - "color": "green" + "schemaVersion": 1, + "label": "source files", + "message": "1574", + "color": "green" } diff --git a/.github/badges/loc-breakdown.json b/.github/badges/loc-breakdown.json index f33035f6..fceaf43a 100644 --- a/.github/badges/loc-breakdown.json +++ b/.github/badges/loc-breakdown.json @@ -1,11 +1,11 @@ { - "schemaVersion": 1, - "total": 510938, - "files": 1574, - "engine": 261074, - "editor": 85302, - "game": 57841, - "tests": 104330, - "tools": 2391, - "updated": "2026-04-06T13:14:10Z" + "schemaVersion": 1, + "total": 510938, + "files": 1574, + "engine": 261074, + "editor": 85303, + "game": 57841, + "tests": 104329, + "tools": 2391, + "updated": "2026-04-06T14:24:43Z" } diff --git a/.github/badges/loc.json b/.github/badges/loc.json index 703141ee..02ae6ccd 100644 --- a/.github/badges/loc.json +++ b/.github/badges/loc.json @@ -1,8 +1,8 @@ { - "schemaVersion": 1, - "label": "C++ lines of code", - "message": "510938", - "color": "blue", - "namedLogo": "cplusplus", - "logoColor": "white" + "schemaVersion": 1, + "label": "C++ lines of code", + "message": "510938", + "color": "blue", + "namedLogo": "cplusplus", + "logoColor": "white" } diff --git a/SparkEditor/Source/Prefabs/PrefabManager.cpp b/SparkEditor/Source/Prefabs/PrefabManager.cpp index a1bfb0b9..7e2c84da 100644 --- a/SparkEditor/Source/Prefabs/PrefabManager.cpp +++ b/SparkEditor/Source/Prefabs/PrefabManager.cpp @@ -10,6 +10,7 @@ #include "Utils/LogMacros.h" #include "Utils/Validate.h" #include +#include #include #include #include @@ -79,7 +80,7 @@ namespace SparkEditor } m_prefabs[prefabName] = std::move(prefab); - SPARK_LOG_INFO(Spark::LogCategory::Editor, "Created prefab from entity %llu: '%s'", entityId, + SPARK_LOG_INFO(Spark::LogCategory::Editor, "Created prefab from entity %" PRIu64 ": '%s'", entityId, prefabName.c_str()); NotifyPrefabsChanged(); return &m_prefabs[prefabName]; diff --git a/SparkEngine/Source/Engine/AI/AIDebugRenderer.cpp b/SparkEngine/Source/Engine/AI/AIDebugRenderer.cpp index ff149c23..424afe0f 100644 --- a/SparkEngine/Source/Engine/AI/AIDebugRenderer.cpp +++ b/SparkEngine/Source/Engine/AI/AIDebugRenderer.cpp @@ -254,7 +254,7 @@ namespace Spark::AI from.y += 0.1f; to.y += 0.1f; - DebugColor segColor = (i < currentIndex) ? visitedColor : pathColor; + [[maybe_unused]] DebugColor segColor = (i < currentIndex) ? visitedColor : pathColor; DEBUG_DRAW_LINE(from, to, segColor); } @@ -263,7 +263,7 @@ namespace Spark::AI XMFLOAT3 pos = path[i].position; pos.y += 0.1f; - DebugColor color = (i == currentIndex) ? activeColor : pathColor; + [[maybe_unused]] DebugColor color = (i == currentIndex) ? activeColor : pathColor; float size = (i == currentIndex) ? 0.3f : 0.15f; DEBUG_DRAW_SPHERE(pos, size, color); } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index fca5a4a6..0c558519 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -460,11 +460,13 @@ if(TARGET imgui) "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Hero/ARPGHeroSystem.cpp" "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Combat/ARPGCombatSystem.cpp" "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Loot/ARPGLootSystem.cpp" + "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Dungeon/ARPGDungeonSystem.cpp" "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Core/ARPGEngineSystems.cpp" ) # Editor sources that require ImGui target_sources(SparkTests PRIVATE + "${CMAKE_SOURCE_DIR}/SparkEditor/Source/Core/EditorPanel.cpp" "${CMAKE_SOURCE_DIR}/SparkEditor/Source/Core/EditorTheme.cpp" "${CMAKE_SOURCE_DIR}/SparkEditor/Source/Search/CommandPalette.cpp" "${CMAKE_SOURCE_DIR}/SparkEditor/Source/LevelStreaming/LevelStreamingSystem.cpp" diff --git a/Tests/TestCoreAndBuildSystems.cpp b/Tests/TestCoreAndBuildSystems.cpp index 3c240f20..1767a90b 100644 --- a/Tests/TestCoreAndBuildSystems.cpp +++ b/Tests/TestCoreAndBuildSystems.cpp @@ -203,8 +203,7 @@ TEST(CSGSystem_UnionCombinesFaces) auto result = csg.Union(*a, *b); // Union should at least return a valid solid (faces may vary by implementation) - EXPECT_TRUE(result.operation == Spark::LevelDesign::CSGOperation::Additive || - result.faces.size() >= 0); + EXPECT_TRUE(result.operation == Spark::LevelDesign::CSGOperation::Additive); csg.ClearAll(); } @@ -400,14 +399,14 @@ TEST(Reflection_TypeRegistryCount) auto& reg = Spark::TypeRegistry::Get(); // Registry exists and has some count (may be zero or populated by static init) size_t count = reg.GetTypeCount(); - EXPECT_TRUE(count >= 0); // Always true, but confirms no crash + (void)count; // confirms no crash } TEST(Reflection_ComponentFactoryCount) { auto& factory = Spark::ComponentFactory::Get(); size_t count = factory.GetRegisteredCount(); - EXPECT_TRUE(count >= 0); + (void)count; // confirms no crash } TEST(Reflection_ComponentFactoryGetNames) diff --git a/Tests/TestEditorSubsystems.cpp b/Tests/TestEditorSubsystems.cpp index 2fb1d4d5..641dfd0b 100644 --- a/Tests/TestEditorSubsystems.cpp +++ b/Tests/TestEditorSubsystems.cpp @@ -755,7 +755,7 @@ TEST(ProjectManager_RecentProjects) auto recent = pm.GetRecentProjects(); // May be empty — just verify it returns without crashing - EXPECT_TRUE(recent.size() >= 0); + (void)recent; // just verify it returns without crashing pm.Shutdown(); } diff --git a/Tests/TestOpenWorldModule.cpp b/Tests/TestOpenWorldModule.cpp index f684f644..5125459b 100644 --- a/Tests/TestOpenWorldModule.cpp +++ b/Tests/TestOpenWorldModule.cpp @@ -504,7 +504,7 @@ TEST(Gated_OWWildlife_HuntAnimal) wildlife.Initialize(nullptr); auto drops = wildlife.HuntAnimal(1); // Hunting should produce some resource drops - EXPECT_TRUE(drops.size() >= 0); // may be empty if animal not found + (void)drops; // may be empty if animal not found, just verify no crash } TEST(Gated_OWWildlife_Strings) diff --git a/wiki/Codebase-Statistics.md b/wiki/Codebase-Statistics.md index 1229db5d..77ae730c 100644 --- a/wiki/Codebase-Statistics.md +++ b/wiki/Codebase-Statistics.md @@ -9,9 +9,9 @@ Comprehensive metrics and analysis of the SparkEngine codebase. Updated 2026-04- | Section | Lines | |---------|------:| | **SparkEngine/Source** | 261074 | -| **SparkEditor/Source** | 85302 | +| **SparkEditor/Source** | 85303 | | **GameModules** | 57841 | -| **Tests** | 104330 | +| **Tests** | 104329 | | **SparkConsole/src** | 1858 | | **SparkShaderCompiler/src** | 533 | | **Total C++ (excl. ThirdParty)** | **~510938** | @@ -99,7 +99,7 @@ Comprehensive metrics and analysis of the SparkEngine codebase. Updated 2026-04- | Metric | Count | |--------|------:| | Editor panel classes | 59 | -| Total editor lines | 85302 | +| Total editor lines | 85303 | ## Testing Metrics diff --git a/wiki/Home.md b/wiki/Home.md index e47e0ad2..632a96f8 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -185,5 +185,5 @@ SparkEngine is licensed under the [Spark Open License](https://github.com/Krilli | Test files | 337 | | Test cases | 4290+ | | Wiki pages | 117 | -| *Last synced* | *2026-04-06 13:09* | +| *Last synced* | *2026-04-06 14:23* | From 2a34460eeeb96464d9fc1b07465f5d2bfc6f857a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 6 Apr 2026 16:50:42 +0000 Subject: [PATCH 2/2] Fix EditorLogger self-deadlock that caused test suite to hang forever EditorLogger::Initialize() held m_mutex then called AddTarget() and Log(), both of which try to acquire m_mutex again. Since std::mutex is not recursive, this deadlocked on the first EditorLogger test (test #92), blocking all remaining ~3970 tests and making the suite appear to run "over an hour." Fix: push targets directly in Initialize() instead of calling AddTarget(), and move the Log() call outside the locked section. Remove the Log() call from Shutdown() which had the same deadlock pattern. Result: full test suite (4060 tests) now completes in ~14 seconds. https://claude.ai/code/session_01A9dweScVNKtmEFiSBdupKX --- SparkEditor/Source/Core/EditorLogger.cpp | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/SparkEditor/Source/Core/EditorLogger.cpp b/SparkEditor/Source/Core/EditorLogger.cpp index d813f05d..b341a219 100644 --- a/SparkEditor/Source/Core/EditorLogger.cpp +++ b/SparkEditor/Source/Core/EditorLogger.cpp @@ -110,25 +110,25 @@ namespace SparkEditor bool EditorLogger::Initialize(const std::string& logDirectory, size_t maxMemoryEntries) { - std::lock_guard lock(m_mutex); - - if (m_initialized) { - return true; - } + std::lock_guard lock(m_mutex); - // Add console target - AddTarget(std::make_unique()); + if (m_initialized) + { + return true; + } - // Add memory target - AddTarget(std::make_unique(maxMemoryEntries)); + // Push targets directly — calling AddTarget() would deadlock on m_mutex + m_targets.push_back(std::make_unique()); + m_targets.push_back(std::make_unique(maxMemoryEntries)); - // Add file target - std::string logFile = logDirectory + "/editor.log"; - AddTarget(std::make_unique(logFile)); + std::string logFile = logDirectory + "/editor.log"; + m_targets.push_back(std::make_unique(logFile)); - m_initialized = true; + m_initialized = true; + } + // Log after releasing m_mutex — Log() acquires it internally Log(LogLevel::INFO, "Logger", "Editor logger initialized"); return true; } @@ -142,7 +142,7 @@ namespace SparkEditor return; } - Log(LogLevel::INFO, "Logger", "Editor logger shutting down"); + // Don't call Log() here — it would deadlock on m_mutex // Flush all targets for (auto& target : m_targets)