Skip to content

Claude/add error handling u zgsj#501

Merged
Krilliac merged 3 commits into
Workingfrom
claude/add-error-handling-uZgsj
Apr 19, 2026
Merged

Claude/add error handling u zgsj#501
Krilliac merged 3 commits into
Workingfrom
claude/add-error-handling-uZgsj

Conversation

@Krilliac

Copy link
Copy Markdown
Owner

No description provided.

claude added 3 commits April 18, 2026 23:16
Converted silent early-returns into actionable WARN/ERROR log entries
in several hot-path loaders so runtime bugs surface instead of being
swallowed:

- EntityArchetypeLoader: log when GetComponentRaw returns null, when
  TypeInfo lookup misses, when archetype property names don't match
  any reflected field, and include the registered archetype count in
  the 'archetype not found' warning.
- SaveSystem::ReadFromFile: log the path + errno on open failure, on
  negative tellg(), on a truncated file (<8 bytes), and on invalid or
  truncated magic header. Deserialize lambda now logs when
  GetComponentRaw returns null instead of silently skipping property
  restore.
- SceneManager::SavePrefab/LoadPrefab: log out-of-range nodeIndex and
  include path + errno on open failure (previously silent false/-1).
- SoundEffect::LoadFromFile: include the filename (and errno) in the
  open-failure log, and log bytes-expected vs bytes-read on a short
  read (previously silent E_FAIL).

All additions use the existing SPARK_LOG_* macros; no new
infrastructure. Builds clean under linux-gcc-release.
Converted additional silent early-returns and swallowed parse errors
into SPARK_LOG_* calls so runtime failures surface in logs instead of
being hidden:

- AI/NavMesh: log path+errno on open failure; log bad magic / unsupported
  version when parsing .snav files.
- Modding/ModSystem: log path+errno on manifest open failure and log when
  the JSON root is not an object.
- Replay/ReplaySystem: log path+errno on open failures (Save/Load); log
  invalid magic with expected vs got bytes.
- Animation/AnimationSystem: log path+errno on LoadAnimations open
  failure; log bad magic with printable bytes when .sanim header is
  wrong.
- Graphics/ModelLoading: BindMesh/BindMaterial now emit SPARK_LOG_ONCE
  warnings for missing/not-loaded assets, wrong-type assets, and
  missing GPU buffers (rate-limited so a persistently missing mesh
  doesn't spam the log).
- Audio/OpenALAudioEngine: replaced fprintf(stderr, ...) with
  SPARK_LOG_ERROR across WAV load paths (open failure, empty file,
  oversized file, truncated RIFF header) so messages go through the
  unified logger / sinks.
- Core/ModuleManager: add SPARK_LOG_ERROR with errno alongside the
  existing SimpleConsole warning on manifest open failure.
- Core/ComponentReflection: SetFieldFromString now logs the offending
  input when Float/Double std::stof/stod throws and when
  Vector2/3/4 parsing fails (previously returned false silently).
- SaveSystem/WriteToFile: log temp-file open failure with path+errno.

No new infrastructure — all additions use existing SPARK_LOG_* /
SPARK_LOG_ONCE macros. SparkEngineLib builds clean under
linux-gcc-release; clang-format passes.
Continued replacing silent early-returns / swallowed parse errors with
SPARK_LOG_* calls that include context (file path, errno, actual vs
expected values). No new infrastructure — all additions use existing
macros. Builds clean under linux-gcc-release; clang-format passes.

- Graphics/TextureCompressor: SaveCompressed logs ERROR on open/write
  failure with path+errno; LoadCompressed logs on open failure, bad
  magic (prints actual vs expected bytes), truncated header, truncated
  mip size table, and truncated mip data. Previously returned empty
  CompressedTexture silently, making missing textures invisible.
- Graphics/ShaderDiskCache: Lookup logs ONCE/Warn when a cache file
  existed at the existence check but failed to open (race / permission),
  and on short reads (file truncated mid-load). Store logs ONCE/Warn on
  ofstream open failure and on post-write stream errors — silent write
  failures previously caused the cache to appear populated but hold
  corrupt/zero-length blobs forever.
- Graphics/RenderGraph/RenderGraphExporter: ExportGraphViz logs ERROR
  when the file stream goes bad after write (disk full / I/O) instead
  of returning the raw bool.
- Engine/Streaming/DirectStorageLoader: FallbackAsyncLoad logs WARN on
  bad offsets (past end of file) and out-of-bounds read-size math —
  these represent caller/manifest programming errors that previously
  failed silently.
- Engine/Streaming/SceneManifest: ParseFromFile logs WARN on open
  failure with path+errno and when a manifest parsed zero assets
  (likely bad key=value format).
- Engine/Localization/LocalizationSystem: StringTable::LoadFromFile
  logs WARN when the regex matched zero entries (bad JSON format).
  SetCurrentLanguage logs WARN when the requested language isn't
  loaded, with the count of available languages.
- Engine/Dialogue/DialogueSystem: DialogueTree::LoadFromFile logs WARN
  on skipped nodes (missing nodeId) and ERROR when the tree parsed
  zero valid nodes. DialogueSystem::StartConversation logs WARN on
  unknown tree id with the number of registered trees.
- Engine/Security/MemoryIntegrity: RegisterCodeRegions logs WARN on
  Linux when /proc/self/maps cannot be opened — previously code-page
  integrity scanning silently disabled itself.
@Krilliac
Krilliac merged commit fcaf61a into Working Apr 19, 2026
35 of 42 checks passed
@Krilliac
Krilliac deleted the claude/add-error-handling-uZgsj branch April 19, 2026 01:19
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage (GCC + lcov)

Utils/StringUtils.h                            |18.1%   116| 0.0%  21|    -    0
Utils/Telemetry.h                              |20.6%   136| 0.0%  23|    -    0
Utils/ThreadDebugger.h                         |11.6%   199| 0.0%  23|    -    0
Utils/ThreadSafeQueue.h                        |27.5%    40| 0.0%  11|    -    0
Utils/Timer.cpp                                |19.4%    36| 0.0%   7|    -    0
Utils/Timer.h                                  | 100%     2| 0.0%   2|    -    0
Utils/TimerManager.h                           |18.6%   102| 0.0%  19|    -    0
Utils/Tween.h                                  |26.3%    38| 0.0%   6|    -    0
Utils/UUID.h                                   |43.2%    37| 0.0%  16|    -    0
Utils/Validate.h                               |    -     0|    -   0|    -    0
Utils/WineDetection.cpp                        |23.1%    39| 0.0%   9|    -    0

[/home/runner/work/SparkEngine/SparkEngine/SparkSDK/Include/Spark/]
IEngineContext.h                               |7300%     1| 0.0%   1|    -    0
IModule.h                                      | 800%     1| 0.0%   1|    -    0
ServiceInterfaces.h                            | 200%     3| 0.0%   3|    -    0
Version.h                                      |    -     0|    -   0|    -    0

[/home/runner/work/SparkEngine/SparkEngine/Templates/EmptyProject/Source/]
GameModule.h                                   |38.9%    18| 0.0%   6|    -    0

[/home/runner/work/SparkEngine/SparkEngine/Templates/FPSStarter/Source/]
GameModule.h                                   |36.0%    25| 0.0%   7|    -    0

[/home/runner/work/SparkEngine/SparkEngine/Templates/MultiplayerArena/Source/]
GameModule.h                                   |34.6%    26| 0.0%   7|    -    0

[/home/runner/work/SparkEngine/SparkEngine/Templates/PlatformerKit/Source/]
GameModule.h                                   |25.0%    32| 0.0%   7|    -    0

[/home/runner/work/SparkEngine/SparkEngine/Templates/RPGStarter/Source/]
GameModule.h                                   |37.5%    24| 0.0%   8|    -    0
================================================================================
                                         Total:|30.4% 35365| 0.0%  6k|    -    0

Per-Subsystem Coverage

Subsystem Lines Hit Coverage Threshold Status
AI 3719 942 25.3% 35%
Animation 905 277 30.6% 35%
Audio 0 0 0% 30%
Camera 0 0 0% 40%
Core 4905 2930 59.7% 40%
ECS 426 213 50% 40%
Editor 7413 3046 41.1% 25%
GameModules 6621 3235 48.9% 30%
Graphics 17920 9064 50.6% 30%
Networking 3578 2376 66.4% 35%
Physics 0 0 0% 35%
Scripting 283 80 28.3% 30%
Utils 9877 6144 62.2% 60%

Total: 50.9% (28307/55647 lines)

@github-actions

Copy link
Copy Markdown
Contributor

❌ CI Error Report

Failed jobs: clang-tidy, macos-Debug-OpenGL, macos-Release-Metal, macos-Release-OpenGL, windows-vs2022-Release
Errors: 1 | Test failures: 3 | Test warnings: 15 | Compiler warnings: 0

Build Errors

Other errors (1)
clang++: error: linker command failed with exit code 1 (u e -v to  ee invocation) [macos-Debug-OpenGL, macos-Release-Metal, macos-Release-OpenGL]

Test Failures

Test Jobs
1/1 Test #1: SparkEngineTests .................***Failed 15.17 sec windows-vs2022-Release
[ FAILED ] Training_GradientCheckHuber (1.5ms, 1 assertions) windows-vs2022-Release
0% tests passed, 1 tests failed out of 1 windows-vs2022-Release

⚠️ Test Warnings (Known Flaky)

These tests are registered as known flaky and do not block the build:

Test Jobs
[02:07:59.343] [TID:6672] [WARN ] [Network ] RCON unknown command: nonexistent_cmd (DedicatedServer.cpp:573) windows-vs2022-Release
[02:07:59.357] [TID:6672] [WARN ] [Network ] NetBuffer::ReadUint8 — buffer overrun at pos 1 (size=1) (NetworkBuffer.c... windows-vs2022-Release
[02:07:59.378] [TID:6672] [WARN ] [AI ] BuildNavMeshWithRecast: empty geometry (RecastDetourBackend.cpp:35) windows-vs2022-Release
[02:07:59.378] [TID:6672] [WARN ] [AI ] NavMeshBuilder: Recast build failed, falling back to triangle-soup builder (N... windows-vs2022-Release
[02:07:59.378] [TID:6672] [WARN ] [Audio ] XAudio2 backend requested but no AudioEngine provided, falling back to Nul... windows-vs2022-Release
[ OK ] FixedTi[02:07:59.395] [TID:6672] [WARN ] [Graphics ] No graphics backend available — falling back to NullRHIDe... windows-vs2022-Release
[02:07:59.396] [TID:6672] [WARN ] [Graphics ] No graphics backend available — falling back to NullRHIDevice (headless... windows-vs2022-Release
[02:07:59.400] [TID:6672] [WARN ] [Editor ] Cannot host: userName is empty. (CollaborativeEditSession.cpp:454) windows-vs2022-Release
[02:07:59.400] [TID:6672] [WARN ] [Editor ] Already connected. (CollaborativeEditSession.cpp:459) windows-vs2022-Release
[02:07:59.403] [TID:6672] [WARN ] [Editor ] BroadcastEdit rejected: nodeId is empty. (CollaborativeEditSession.cpp:1108) windows-vs2022-Release
[02:07:59.403] [TID:6672] [WARN ] [Editor ] BroadcastEdit rejected: sourceEditor is not set. (CollaborativeEditSessio... windows-vs2022-Release
[02:07:59.404] [TID:6672] [WARN ] [Editor ] SetLocalSelection rejected: nodeId exceeds 255 chars (length=300). (Colla... windows-vs2022-Release
[02:08:04.983] [TID:6672] [WARN ] [Network ] Connection rejected for pending client 5: server full (4/4) (NetworkConn... windows-vs2022-Release
[02:08:04.984] [TID:6672] [WARN ] [Network ] Connection rejected for pending client 5: server full (4/4) (NetworkConn... windows-vs2022-Release
[02:08:04.985] [TID:6672] [WARN ] [Network ] Invalid packet magic 0x6A0E5CB3 (expected 0x5350524B) (NetworkManager.cp... windows-vs2022-Release

Updated: 2026-04-19T02:09:52Z — this comment is updated in-place, not duplicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants