Skip to content

Commit d6391d8

Browse files
luisleo526claude
andcommitted
Make the ledger storage status row independent of concurrent disk writes
The ledger_observability_status row compared the free_disk_bytes that the live runner publishes with a second sample of the free disk space that the test took later, within a fixed tolerance of 64 MiB. On a machine whose filesystem other processes write, such as a shared build machine that runs several test steps at once, more than the tolerance can change between the two samples, and the row failed although the runner had reported a true figure at its own sampling instant. The expected state and the seconds_to_disk_exhaustion bound leaned on the same second sample. The row now checks the status document against itself and against the free space that the test observed during the window: - state and seconds_to_disk_exhaustion are computed from the document's own used_bytes, warn_free_fraction, free_disk_bytes and growth_bytes_per_second, exactly: rational arithmetic for the state, the same IEEE division as the runner for the exhaustion time; - free_disk_bytes must be an integer, a multiple of the filesystem's fragment size, within its capacity, and a value the filesystem really had: the test samples the free space throughout the window that contains the runner's sample, from before it until after the second publication that follows, and keeps the smallest and the largest value it saw. Two samples, one on each side, would not do: a temporary file that appears and disappears while the runner samples puts its value outside both. On a quiet disk the range is a single value, so the check is exact; there is no tolerance; - the ledger lives in a directory of its own, and the status and log files of the runner go to another filesystem (/dev/shm for the disk row), so the runner's own writes cannot change the free space it measures. The default fraction also runs with the ledger on /dev/shm, so a runner that measured the wrong directory would fail. The option --disk-sample-tolerance-bytes is removed. The row ledger_observability_status_concurrent_write writes 192 MiB into the ledger's directory between the runner's document and the end of the window, and ledger_observability_check_selftest feeds the check helpers and the envelope with synthetic numbers to show that every wrong value (units, capacity, another filesystem, one ulp, a flipped state) is rejected and that the range has no allowance at either end. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
1 parent 9ee1cc7 commit d6391d8

2 files changed

Lines changed: 320 additions & 66 deletions

File tree

‎runner/CMakeLists.txt‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,10 @@ target_link_libraries(pineforge_live_startup PUBLIC pineforge_live_report)
601601
target_compile_options(pineforge_live_support PRIVATE -ffp-contract=off)
602602

603603
if(PINEFORGE_BUILD_TESTS)
604+
add_test(NAME ledger_observability_check_selftest COMMAND ${Python3_EXECUTABLE}
605+
${PROJECT_SOURCE_DIR}/tests/native_live_ledger_behavior_e2e.py ledger_observability_check_selftest)
606+
set_tests_properties(ledger_observability_check_selftest PROPERTIES
607+
LABELS "live_ledger" TIMEOUT 120)
604608
target_compile_options(pineforge_live_legacy_test_support PRIVATE -ffp-contract=off)
605609
add_executable(test_live_report ${PROJECT_SOURCE_DIR}/tests/test_live_report.cpp)
606610
target_include_directories(test_live_report PRIVATE
@@ -740,6 +744,15 @@ if(PINEFORGE_BUILD_TESTS AND CMAKE_SYSTEM_NAME STREQUAL "Linux"
740744
--artifacts ${PROJECT_BINARY_DIR}/ledger-behavior-artifacts)
741745
set_tests_properties(${_pf_ledger_row} PROPERTIES LABELS "slow;live_ledger" TIMEOUT 7200)
742746
endforeach()
747+
add_test(NAME ledger_observability_status_concurrent_write COMMAND ${Python3_EXECUTABLE}
748+
${PROJECT_SOURCE_DIR}/tests/native_live_ledger_behavior_e2e.py ledger_observability_status
749+
--runner $<TARGET_FILE:pineforge-live-observed>
750+
--strategy $<TARGET_FILE:native_live_ledger_work_strategy>
751+
--fixture-writer $<TARGET_FILE:native_live_ledger_fixture_writer>
752+
--artifacts ${PROJECT_BINARY_DIR}/ledger-behavior-artifacts
753+
--force-write-between-samples-bytes 201326592)
754+
set_tests_properties(ledger_observability_status_concurrent_write PROPERTIES
755+
LABELS "slow;live_ledger" TIMEOUT 7200 RUN_SERIAL TRUE)
743756
add_test(NAME native_live_ledger_behavior_e2e COMMAND ${Python3_EXECUTABLE}
744757
${PROJECT_SOURCE_DIR}/tests/native_live_ledger_behavior_e2e.py report_jsonl_delta_v2_contract
745758
--runner $<TARGET_FILE:pineforge-live-observed>

0 commit comments

Comments
 (0)