progress_dashboard: recover parse_lasttest after incomplete nested CTest logs (DASH-CTEST-INCOMPLETE-NESTED) #1256
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1256"
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 IlyassRS3 on 2026-11-24T20:57:27Z.
What changed
Fixes
parse_lasttestintools/progress_dashboard.pyso an incomplete nested CTest log inside a test's capturedOutput:block (such as a nested run missing its trailingEnd testing:line, or truncated mid-output) no longer swallows the outer test's verdict and all subsequent outer test results.Addresses the findings in #14 (finding #7143409370 and the real CTest 3.31.10 fixture in finding #7144069427).
Why this works even when inner and outer share name, ordinal, and timestamps
In CTest
LastTest.log, every test output inside a nested run is bracketed byOutput:+ 58 dashes and<end of output>+Test time =. Instead of a flatnested_runscounter that can only close onEnd testing:,parse_lasttestnow tracks a stack of[in_output, inner_test_name]frames for each nestedStart testing:+ 58-dash block:Output:+ 58 dashes setsin_output = Truefor the innermost nested run, and the inner test's<end of output>flips it back toFalsewhile staying inside outer capture (so innerwrapperpass verdicts are still ignored even when name, ordinal, and timestamps match the outer test).<end of output>+Test time =arrives within_output == Falseon the top nested frame(s), no innerOutput:block is open, so those completed-but-unclosed nested runs (missingEnd testing:) are popped cleanly; if the stack empties, outer capture ends immediately, and in 3-level nesting an enclosing middle test'sOutput:closes while staying inside outer capture.Output:before its own<end of output>,_trailer_end_time_matcheschecks the immediate"<name>" end time:trailer (stopping at the first end-time line or second 58-dash separator) to resynchronize on the outer test.End testing:lines printed inside a nested test's capturedOutput:are ignored whilein_outputisTrue, preventing premature exit from outer capture.Tests added (
tests/test_progress_dashboard.py)test_lasttest_recovers_when_nested_log_omits_end_testing(reproduces the real CTest 3.31.10 fixture: outerwrapper1/2 fails, innerwrapper1/2 passes +child_22/2 passes with identical timestamps and missingEnd testing:, followed by outerlater2/2 passing).test_lasttest_recovers_from_empty_incomplete_nested_log(reproduces finding #7143409370).test_lasttest_handles_three_level_nested_log_missing_innermost_end_testing.test_lasttest_recovers_when_inner_test_output_is_truncated_mid_stream.test_lasttest_ignores_spurious_end_testing_inside_nested_test_output.Item ID
DASH-CTEST-INCOMPLETE-NESTEDVerification
Tested on macOS 27.2.1 (Apple M5 arm64), Python 3.14 (no game files, no GPU, standard library only):
python3 -I tests/test_progress_dashboard.py -v-> 56/56 OKtools/progress_dashboard.pytoupstream/mainwhile keepingtests/test_progress_dashboard.py) -> FAILED (5 failures): all 5 new tests fail onmain(4 return[], 1 falsely reports('wrapper', 'pass', 0.01)instead of('wrapper', 'fail', 0.15)); restoring the fix returns to 56/56 OK.python3 -m compileall -q tools/progress_dashboard.py tests/test_progress_dashboard.py-> OKpython3 -I scripts/check_no_game_data.py tools/progress_dashboard.py tests/test_progress_dashboard.py-> OKpython3 -I tests/test_ci_registration.py-> 15/15 OKpython3 -I tests/test_text_write_line_endings.py-> 3/3 OKChecklist
Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-24T20:57:35Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by titoreinaldo on 2026-11-24T21:23:44Z.
I reran the real CTest 3.31.10 fixture against this PR on Linux: base lost both results with the truncated log;
f4824083recoveredwrapper=failandlater=pass, with the same results as the intact log. The 13 parser/registration tests in theTestsclass passed. One small performance follow-up:_trailer_end_time_matchescopies the entire remaining suffix withlines[end_of_output_index + 1:]on every normal inner trailer whose name differs from the outer test. A synthetic nested run with 4,000 tests took 187 ms, and 8,000 took 711 ms (three-run medians). Iterating by index without copying the suffix reduced those to 18 and 38 ms, with identical outer results. Could we use indexed iteration so the early stop also bounds the work? CPU-only; AI-assisted.Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-24T21:27:03Z.
Thanks for testing against the real CTest 3.31.10 fixture and spotting the quadratic slice, @titoreinaldo!
Pushed
8d2aa7bd8switching_trailer_end_time_matchesto indexed iteration (range(end_of_output_index + 1, len(lines))) and reusing module-level_CTEST_HEADER_RE. Verifiedpython3 -I tests/test_progress_dashboard.py(56/56 OK) and linear scaling on a synthetic nested log (4,000 tests: 6.3 ms median; 8,000 tests: 12.6 ms median on Apple M5 / Python 3.14; CPU-only, AI-assisted).Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-24T21:40:39Z.
I reproduced a case where the dashboard drops the following test as well as the failed wrapper. On
8d2aa7bd, Windows 11, Python 3.12.10, CTest 4.4.4, I generated three LastTest.log files using real CTest runs:leafthat prints a unique line, e.g.leaf payload.middlethat prints the entire leaf LastTest.log.wrapperprint the middle LastTest.log only through the first occurrence of the leaf payload line, then exit 1. A second testlaterexits 0. Run this suite withctest --output-junit results.xml.parse_lastteston the outer LastTest.log. The result was[]; JUnit recordedwrapper=fail, later=pass. As a control, printing the complete middle log in step 3 yielded both correct dashboard results.At the real wrapper trailer both nested Output blocks are still open, so the recovery guarded by
len(nested) == 1never tests the matching wrapper end time. This differs from omitting just the innermost End testing line: its test trailer is also missing. A regression case should check that the later result survives as well.CPU-only, synthetic output, AI-assisted review.
Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-24T21:46:24Z.
Great catch, @DeadlyChirp — reproduced your exact 3-level
wrapper -> middle -> leafmid-leaf truncation case on8d2aa7bd8([]instead of[('wrapper', 'fail', ...), ('later', 'pass', ...)]).Pushed
c81b2daf5generalizing trailer recovery to arbitrary nesting depths:_trailer_end_time_matcheswith_trailer_end_time_name(still indexed O(1) per trailer).<end of output>+Test time =, unwinds any already-closed frames, matches the immediate trailer's"<name>" end time:against the innermost matching open frame innested(unwinding truncated deeper frames), and when no open nested frame matches andtrailer_name == name, unwinds all open nested frames to close the outer test.test_lasttest_recovers_when_multi_level_nested_output_is_truncated_mid_leafandtest_lasttest_recovers_when_middle_finishes_after_truncated_leaf(both verifyingwrapperandlatersurvive).Verified
python3 -I tests/test_progress_dashboard.py(58/58 OK) and linear scaling on a synthetic nested log (4,000 tests: 6.6 ms; 8,000 tests: 13.5 ms on Apple M5 / Python 3.14; CPU-only, AI-assisted).Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T22:10:23Z.
Tested
c81b2daf5merged (no commit) withmainaa918e5d9, Python 3.12.4, Windows 11, CPU only.python -I tests/test_progress_dashboard.py: 60 tests, 1 failure,test_default_repo_is_the_one_the_readme_clones. It fails the same way on plainmain(the README no longer clonesubiquitarianism/leonida), so it is unrelated.tools/progress_dashboard.pyback tomain, the 7 newtest_lasttest_*tests fail (nested logs missingEnd testing:, truncated mid-stream, spuriousEnd testing:in nested output).mainfailure.check_no_game_data.pyis clean.No blocker from my side. AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T22:21:56Z.
Merged after TheGeogeo's red/green check (https://github.com/ProjectLeonida/mandy/pull/1256#issuecomment-7246547085) and a local re-check here: merged onto
mainc7753ed98without conflict,tests/test_progress_dashboard.pyshows the same single failure with and without this PR (test_default_repo_is_the_one_the_readme_clones, already red onmain: the README no longer clones ubiquitarianism/leonida), and every other test passes. CI no-game-data check is green.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.