[PR #1256] progress_dashboard: recover parse_lasttest after incomplete nested CTest logs (DASH-CTEST-INCOMPLETE-NESTED) #1288

Open
opened 2026-11-26 20:20:44 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1256
Author: @IlyassRS3
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: fix/dash-ctest-incomplete-nested


📝 Commits (3)

  • f482408 progress_dashboard: recover parse_lasttest after incomplete nested CTest logs
  • 8d2aa7b progress_dashboard: avoid O(n^2) suffix copy in _trailer_end_time_matches
  • c81b2da progress_dashboard: unwind multi-level truncated nested CTest outputs by trailer name

📊 Changes

2 files changed (+190 additions, -9 deletions)

View changed files

📝 tests/test_progress_dashboard.py (+126 -0)
📝 tools/progress_dashboard.py (+64 -9)

📄 Description

What changed

Fixes parse_lasttest in tools/progress_dashboard.py so an incomplete nested CTest log inside a test's captured Output: block (such as a nested run missing its trailing End 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 by Output: + 58 dashes and <end of output> + Test time =. Instead of a flat nested_runs counter that can only close on End testing:, parse_lasttest now tracks a stack of [in_output, inner_test_name] frames for each nested Start testing: + 58-dash block:

  • An inner Output: + 58 dashes sets in_output = True for the innermost nested run, and the inner test's <end of output> flips it back to False while staying inside outer capture (so inner wrapper pass verdicts are still ignored even when name, ordinal, and timestamps match the outer test).
  • When <end of output> + Test time = arrives with in_output == False on the top nested frame(s), no inner Output: block is open, so those completed-but-unclosed nested runs (missing End testing:) are popped cleanly; if the stack empties, outer capture ends immediately, and in 3-level nesting an enclosing middle test's Output: closes while staying inside outer capture.
  • When an inner test (with a different name than the outer test) was truncated mid-Output: before its own <end of output>, _trailer_end_time_matches checks the immediate "<name>" end time: trailer (stopping at the first end-time line or second 58-dash separator) to resynchronize on the outer test.
  • Spurious End testing: lines printed inside a nested test's captured Output: are ignored while in_output is True, preventing premature exit from outer capture.

Tests added (tests/test_progress_dashboard.py)

  1. test_lasttest_recovers_when_nested_log_omits_end_testing (reproduces the real CTest 3.31.10 fixture: outer wrapper 1/2 fails, inner wrapper 1/2 passes + child_2 2/2 passes with identical timestamps and missing End testing:, followed by outer later 2/2 passing).
  2. test_lasttest_recovers_from_empty_incomplete_nested_log (reproduces finding #7143409370).
  3. test_lasttest_handles_three_level_nested_log_missing_innermost_end_testing.
  4. test_lasttest_recovers_when_inner_test_output_is_truncated_mid_stream.
  5. test_lasttest_ignores_spurious_end_testing_inside_nested_test_output.

Item ID

  • Coordination issue #14 item: DASH-CTEST-INCOMPLETE-NESTED
  • Depends on: none (zero hunk overlap with open PRs #625, #965, #1001)

Verification

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 OK
  • Revert-source mutation check (reverting tools/progress_dashboard.py to upstream/main while keeping tests/test_progress_dashboard.py) -> FAILED (5 failures): all 5 new tests fail on main (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 -> OK
  • python3 -I scripts/check_no_game_data.py tools/progress_dashboard.py tests/test_progress_dashboard.py -> OK
  • python3 -I tests/test_ci_registration.py -> 15/15 OK
  • python3 -I tests/test_text_write_line_endings.py -> 3/3 OK

Checklist

  • No game files, binaries, shaders, textures, audio, or logs quoting them
  • No keys, decryption, or online services
  • Claimed in the coordination issue (#14) before opening this PR
  • AI-assisted: yes (designed, implemented, and regression-verified with AI assistance)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1256 **Author:** [@IlyassRS3](https://github.com/IlyassRS3) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/dash-ctest-incomplete-nested` --- ### 📝 Commits (3) - [`f482408`](https://github.com/ubiquitarianism/leonida/commit/f482408308b7c7c6da5c2309a34a53ae82e0d5ec) progress_dashboard: recover parse_lasttest after incomplete nested CTest logs - [`8d2aa7b`](https://github.com/ubiquitarianism/leonida/commit/8d2aa7bd803d0f8547f36697cc9c71b9a247075d) progress_dashboard: avoid O(n^2) suffix copy in _trailer_end_time_matches - [`c81b2da`](https://github.com/ubiquitarianism/leonida/commit/c81b2daf57644e350f7d1084eceee1a64cc4db29) progress_dashboard: unwind multi-level truncated nested CTest outputs by trailer name ### 📊 Changes **2 files changed** (+190 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_progress_dashboard.py` (+126 -0) 📝 `tools/progress_dashboard.py` (+64 -9) </details> ### 📄 Description ## What changed Fixes `parse_lasttest` in `tools/progress_dashboard.py` so an incomplete nested CTest log inside a test's captured `Output:` block (such as a nested run missing its trailing `End 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](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143409370) and the real CTest 3.31.10 fixture in [finding #7144069427](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-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 by `Output:` + 58 dashes and `<end of output>` + `Test time =`. Instead of a flat `nested_runs` counter that can only close on `End testing:`, `parse_lasttest` now tracks a stack of `[in_output, inner_test_name]` frames for each nested `Start testing:` + 58-dash block: - An inner `Output:` + 58 dashes sets `in_output = True` for the innermost nested run, and the inner test's `<end of output>` flips it back to `False` while staying inside outer capture (so inner `wrapper` pass verdicts are still ignored even when name, ordinal, and timestamps match the outer test). - When `<end of output>` + `Test time =` arrives with `in_output == False` on the top nested frame(s), no inner `Output:` block is open, so those completed-but-unclosed nested runs (missing `End testing:`) are popped cleanly; if the stack empties, outer capture ends immediately, and in 3-level nesting an enclosing middle test's `Output:` closes while staying inside outer capture. - When an inner test (with a different name than the outer test) was truncated mid-`Output:` before its own `<end of output>`, `_trailer_end_time_matches` checks the immediate `"<name>" end time: ` trailer (stopping at the first end-time line or second 58-dash separator) to resynchronize on the outer test. - Spurious `End testing:` lines printed inside a nested test's captured `Output:` are ignored while `in_output` is `True`, preventing premature exit from outer capture. ### Tests added (`tests/test_progress_dashboard.py`) 1. `test_lasttest_recovers_when_nested_log_omits_end_testing` (reproduces the real CTest 3.31.10 fixture: outer `wrapper` 1/2 fails, inner `wrapper` 1/2 passes + `child_2` 2/2 passes with identical timestamps and missing `End testing:`, followed by outer `later` 2/2 passing). 2. `test_lasttest_recovers_from_empty_incomplete_nested_log` (reproduces finding #7143409370). 3. `test_lasttest_handles_three_level_nested_log_missing_innermost_end_testing`. 4. `test_lasttest_recovers_when_inner_test_output_is_truncated_mid_stream`. 5. `test_lasttest_ignores_spurious_end_testing_inside_nested_test_output`. ## Item ID - Coordination issue #14 item: `DASH-CTEST-INCOMPLETE-NESTED` - Depends on: none (zero hunk overlap with open PRs #625, #965, #1001) ## Verification 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 OK** - Revert-source mutation check (reverting `tools/progress_dashboard.py` to `upstream/main` while keeping `tests/test_progress_dashboard.py`) -> **FAILED (5 failures)**: all 5 new tests fail on `main` (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` -> OK - `python3 -I scripts/check_no_game_data.py tools/progress_dashboard.py tests/test_progress_dashboard.py` -> OK - `python3 -I tests/test_ci_registration.py` -> **15/15 OK** - `python3 -I tests/test_text_write_line_endings.py` -> **3/3 OK** ## Checklist - [x] No game files, binaries, shaders, textures, audio, or logs quoting them - [x] No keys, decryption, or online services - [x] Claimed in the coordination issue (#14) before opening this PR - [x] AI-assisted: yes (designed, implemented, and regression-verified with AI assistance) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1288
No description provided.