runtime: guard empty destination and null data in write_pipeline_cache_file and add tests (RT-PIPELINE-CACHE-FILE-GUARDS-AND-TESTS) #2061
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2061"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T19:14:51Z.
Claimed in the coordination issue as: RT-PIPELINE-CACHE-FILE-GUARDS-AND-TESTS (claim)
What and why
runtime/src/pipeline_cache_file.hprovides atomic, crash-safe checkpoint writes for the pipeline cache file via same-directory staging and renaming.Input guards:
write_pipeline_cache_file: returnsstd::errc::invalid_argumentimmediately ifdestination.empty()(preventing creation of orphan.tmp...files in the working directory) or ifsize > 0 && !data(preventing null pointer dereference instd::fwrite).size == 0(even ifdatais null).Test suite extension (
runtime/test/pipeline_cache_file_test.cpp):destination.empty()returnsstd::errc::invalid_argument.std::errc::invalid_argument.Tested
pipeline_cache_file_testpasses cleanly (exit 0).python -I tests/test_ci_registration.py: 16/16 pass.python -I tests/test_text_write_line_endings.py: 3/3 pass.python -I scripts/check_no_game_data.py: clean (0 violations, no game data).AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T11:28:39Z.
Verified on Windows 11 (
10.0.26200.9974) with MSVC19.44.35228(x64,/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2) againstmain4a54aedcb+ca0c72f81(claim#2570#issuecomment-7238486276):runtime/src/pipeline_cache_file.h,runtime/test/pipeline_cache_file_test.cpp); rejects emptydestinationor nulldatawhensize > 0withstd::errc::invalid_argument, while preserving(nullptr, 0)empty-file writes.check_no_game_data.pyclean.4a54aedcb+ PR test):pipeline_cache_file_test.exefails (rc=1atline 50: write_pipeline_cache_file("", "data", 4) == std::make_error_code(std::errc::invalid_argument)).4a54aedcb+ca0c72f81merge): Merges cleanly (rc=0), compiles cleanly, andpipeline_cache_file_test.exepasses (rc=0).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T18:12:52Z.
Red/green: On main pipeline_cache_file_test fails at line 50 (an empty destination is not refused with invalid_argument), and with the PR ctest -R "^pipeline_cache_file$" passes.
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main
c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:59:28Z.
Verified by OreoFR
c1ecf04ed+ PR headca0c72f81; green run in a merge package of 16 PRs, no new ctest failure vs mainctest -R "^pipeline_cache_file$"AI-assisted (Claude Code, Claude Opus 5.5).