[PR #625] progress_dashboard: handle null comment authors, require --run-tests for --tests, and catch I/O and history errors (DASH-HARDEN-CLI) #666

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

📋 Pull Request Information

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

Base: main ← Head: fix/dash-harden-cli


📝 Commits (2)

  • 151e300 progress_dashboard: handle null comment authors, require --run-tests for --tests, and catch I/O and history errors (DASH-HARDEN-CLI)
  • 3c2ad30 progress_dashboard: require string content_hash and dict metrics in history.json

📊 Changes

2 files changed (+126 additions, -6 deletions)

View changed files

📝 tests/test_progress_dashboard.py (+91 -0)
📝 tools/progress_dashboard.py (+35 -6)

📄 Description

Claimed in the coordination issue as: DASH-HARDEN-CLI (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7128321944)
Depends on: none

What and why

Fixes four CLI/error-handling gaps in tools/progress_dashboard.py:

  • collect_github() (--github --login) called c.get("author", {}).get("login") and c["body"].lower(), crashing with AttributeError when a coordination issue comment has "author": null (deleted/ghost GitHub account) or "body": null.
  • --tests REGEX without --run-tests was silently ignored instead of calling ap.error(...) like --login and --d3d-issue.
  • ci_test_files() ran before main()'s try ... except OSError block, letting directory/permission errors escape as raw tracebacks despite the _walk_error contract.
  • write_outputs() ran outside main()'s error handler, and corrupt or non-list history.json files (or UTF-8 BOM-prefixed ones) caused unhandled exceptions instead of a clean exit 2 (or loading cleanly with BOM stripped).

The fix

  • Safely handle null/missing author and body in collect_github().
  • Added _load_history() to strip UTF-8 BOM and raise ValueError on malformed JSON or non-list/malformed history.json.
  • Added ap.error("--tests requires --run-tests") and caught OSError/ValueError around ci_test_files() and write_outputs() in main() (exiting 2).
  • Added 5 regression tests in Hardening in tests/test_progress_dashboard.py.

Tested

Windows 11 (26200.9974), Python 3.12.10, CPU only, no game files.

  • python -I tests/test_progress_dashboard.py -v: 55/55 OK
  • Negative control (Hardening against main 21625bca8's tools/progress_dashboard.py): FAILED (failures=1, errors=4)
  • python -m compileall -q tools/progress_dashboard.py tests/test_progress_dashboard.py: exit 0
  • python -I scripts/check_no_game_data.py tools/progress_dashboard.py tests/test_progress_dashboard.py: exit 0
  • python -I tests/test_text_write_line_endings.py: 3/3 OK
  • git diff --check: clean

AI-assisted: yes.


🔄 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/625 **Author:** [@hamdog0203](https://github.com/hamdog0203) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/dash-harden-cli` --- ### 📝 Commits (2) - [`151e300`](https://github.com/ubiquitarianism/leonida/commit/151e300abe18d760cf29d724b10cfaf62154ee9f) progress_dashboard: handle null comment authors, require --run-tests for --tests, and catch I/O and history errors (DASH-HARDEN-CLI) - [`3c2ad30`](https://github.com/ubiquitarianism/leonida/commit/3c2ad30d523ed06a6ed2debe30e035d08c984618) progress_dashboard: require string content_hash and dict metrics in history.json ### 📊 Changes **2 files changed** (+126 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_progress_dashboard.py` (+91 -0) 📝 `tools/progress_dashboard.py` (+35 -6) </details> ### 📄 Description Claimed in the coordination issue as: DASH-HARDEN-CLI (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7128321944) Depends on: none ### What and why Fixes four CLI/error-handling gaps in `tools/progress_dashboard.py`: - `collect_github()` (`--github --login`) called `c.get("author", {}).get("login")` and `c["body"].lower()`, crashing with `AttributeError` when a coordination issue comment has `"author": null` (deleted/ghost GitHub account) or `"body": null`. - `--tests REGEX` without `--run-tests` was silently ignored instead of calling `ap.error(...)` like `--login` and `--d3d-issue`. - `ci_test_files()` ran before `main()`'s `try ... except OSError` block, letting directory/permission errors escape as raw tracebacks despite the `_walk_error` contract. - `write_outputs()` ran outside `main()`'s error handler, and corrupt or non-list `history.json` files (or UTF-8 BOM-prefixed ones) caused unhandled exceptions instead of a clean exit `2` (or loading cleanly with BOM stripped). ### The fix - Safely handle null/missing `author` and `body` in `collect_github()`. - Added `_load_history()` to strip UTF-8 BOM and raise `ValueError` on malformed JSON or non-list/malformed `history.json`. - Added `ap.error("--tests requires --run-tests")` and caught `OSError`/`ValueError` around `ci_test_files()` and `write_outputs()` in `main()` (exiting `2`). - Added 5 regression tests in `Hardening` in `tests/test_progress_dashboard.py`. ### Tested Windows 11 (26200.9974), Python 3.12.10, CPU only, no game files. - `python -I tests/test_progress_dashboard.py -v`: **55/55 OK** - Negative control (`Hardening` against `main` `21625bca8`'s `tools/progress_dashboard.py`): **FAILED (failures=1, errors=4)** - `python -m compileall -q tools/progress_dashboard.py tests/test_progress_dashboard.py`: exit 0 - `python -I scripts/check_no_game_data.py tools/progress_dashboard.py tests/test_progress_dashboard.py`: exit 0 - `python -I tests/test_text_write_line_endings.py`: **3/3 OK** - `git diff --check`: clean AI-assisted: yes. --- <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#666
No description provided.