progress_dashboard: handle null comment authors, require --run-tests for --tests, and catch I/O and history errors (DASH-HARDEN-CLI) #625
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/625"
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 hamdog0203 on 2026-11-24T10:10:49Z.
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) calledc.get("author", {}).get("login")andc["body"].lower(), crashing withAttributeErrorwhen a coordination issue comment has"author": null(deleted/ghost GitHub account) or"body": null.--tests REGEXwithout--run-testswas silently ignored instead of callingap.error(...)like--loginand--d3d-issue.ci_test_files()ran beforemain()'stry ... except OSErrorblock, letting directory/permission errors escape as raw tracebacks despite the_walk_errorcontract.write_outputs()ran outsidemain()'s error handler, and corrupt or non-listhistory.jsonfiles (or UTF-8 BOM-prefixed ones) caused unhandled exceptions instead of a clean exit2(or loading cleanly with BOM stripped).The fix
authorandbodyincollect_github()._load_history()to strip UTF-8 BOM and raiseValueErroron malformed JSON or non-list/malformedhistory.json.ap.error("--tests requires --run-tests")and caughtOSError/ValueErroraroundci_test_files()andwrite_outputs()inmain()(exiting2).Hardeningintests/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 OKHardeningagainstmain21625bca8'stools/progress_dashboard.py): FAILED (failures=1, errors=4)python -m compileall -q tools/progress_dashboard.py tests/test_progress_dashboard.py: exit 0python -I scripts/check_no_game_data.py tools/progress_dashboard.py tests/test_progress_dashboard.py: exit 0python -I tests/test_text_write_line_endings.py: 3/3 OKgit diff --check: cleanAI-assisted: yes.
Imported from ubiquitarianism/leonida. Originally posted by Dezmonius on 2026-11-24T11:43:02Z.
Independent Windows 10 check at
151e300with CPython 3.14.7. All five new hardening tests pass. The full file is 54/55 here. Its sole failure is the pre-existing path-scrubbing test with a Windows user-profile path containing a space (also fails at21625bc).The new history schema check still accepts a row with missing or null
metrics, for example:With that file in the output directory, the CLI returns 0 and writes
progress.html. Opening the generated page in Edge givesTypeError: Cannot convert undefined or null to objectintrend()atObject.keys(h.metrics); the chart remains empty. A control history row with"metrics":{}renders without an error. I also confirmed that malformed JSON returns 2 and preserves the input file.Could
_load_history()require a metrics mapping for successful rows, or could the page handle absent metrics if older history files are meant to be accepted?Local synthetic history only. AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by hamdog0203 on 2026-11-24T15:21:07Z.
Good catch, thanks for testing this on Windows!
Since every valid snapshot entry emitted by
summary_line()always writes a stringcontent_hashand a"metrics": {...}object, I tightened_load_history()in commit3c2ad30d5to require bothisinstance(item.get("content_hash"), str)andisinstance(item.get("metrics"), dict).Rows with missing
metrics,"metrics": null, non-dictmetrics, or non-stringcontent_hashnow exit cleanly with status2without modifyinghistory.jsonor writing a brokenprogress.html. Added regression cases for all four shapes inHardening.test_corrupt_non_list_and_bom_history_json.Re-verified locally (
tests/test_progress_dashboard.py: 55/55 OK;tests/test_text_write_line_endings.py: 3/3 OK;scripts/check_no_game_data.py: clean).AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T22:10:25Z.
Tested
3c2ad30d5merged (no commit) withmainaa918e5d9, Python 3.12.4, Windows 11, CPU only.python -I tests/test_progress_dashboard.py: 58 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, 5 of the newHardeningtests fail: 4 errors (test_github_login_skips_null_author_and_null_body,test_corrupt_non_list_and_bom_history_json,test_ci_test_files_oserror_exits_2_cleanly,test_write_outputs_oserror_exits_2_cleanly) and 1 failure (test_tests_flag_requires_run_tests).content_hashstr,metricsdict) matches whatsummary_linewrites onmain, so existinghistory.jsonfiles still load.mainfailure.check_no_game_data.pyis clean.except ValueErroralso wrapsbuild(args, out_dir), so aValueErrorfrom a bug inbuildbecomes a one-lineerror:and exit 2 instead of a traceback.No blocker from my side. AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T22:22:18Z.
Merged after TheGeogeo's red/green check (https://github.com/ProjectLeonida/mandy/pull/625#issuecomment-7246547524) and a local re-check here: merged onto
main75df7d319without 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.