feat(tools): export progress history as CSV #12766

Merged
StoneDC merged 4 commits from upstream-pr/12766 into main 2026-11-10 19:29:05 +00:00
StoneDC commented 2026-10-29 08:39:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by StoneDC on 2026-10-29T08:39:21Z.


What

Adds optional history.csv matching the measured history.json points. Destination preflight runs before collection or any report write, including dangling symlinks. Main integration retains badge-week.svg generation and includes the badge in destination/alias/cache preflight alongside JSON/SVG/HTML and optional CSV. Sentinel regressions now protect every output, and the CSV success path verifies the badge is a real SVG.

Tested

Exact head bfe834f066bc9f9db02045aea388bbb671b1718a integrates main ba627802e2210187d417deb64c8f2fed8e33011f. Windows Python 3.12.14/3.14.3 and Linux Python 3.12.16/3.14.4: all three actual registered history CTest groups pass per configuration, covering 24 methods. Windows has three existing environment/permission skips, Linux one existing Windows-only skip; no CTest group skips. A control removing only the badge from preflight compiles/imports normally and fails the existing-report bytes/mtime preservation assertion in all four environments. Main weekly badge output and optional CSV are both retained; no cross-file atomicity for arbitrary later I/O failure is promised. Current-main conventions, whitespace, registration and main ancestry pass. Hosted runs for the new head are pending until complete.

Earlier rationale and validation (historical revisions and dependency state)

What

Add opt-in --csv history reports with the same date, commit and metric values as JSON.

Address the late-output preservation review: before collection or any report write, reject a report destination that already denotes a non-regular file or a dangling symlink. A known-invalid final CSV destination now produces usage error 2 without replacing earlier JSON/SVG/HTML reports. Keep existing alias/cache checks and controlled error handling. New tests seed distinct report bytes and mtimes, cover each invalid destination, preserve a dangling link and its absent target, and verify retry after removing the obstruction. This is preflight for predictable invalid targets, not a cross-file transaction against arbitrary later I/O failures.

Integrate current main's path/symlink handling. Remove two identical shadowed cache-regression copies while retaining their effective method bodies and every existing unique test.

Tested

Exact tested head 5cde5c42ad66ec905fb36fe8286fb77d9caebb07; recorded main 9f748f4d8e36ce3714f3b95f3386316e110a9b22; previous published head b4b9fec20ebf7b2b5584410aa1da2d3bdd91816e. Recorded main and the previous published head are ancestors. All current-main and previous unique test methods are retained; the documented #12488 context nesting and #12766 identical-shadow cleanup preserve the effective assertions.

Windows 11: Python 3.14.3 and 3.12.14, CMake 4.3.1 / MinGW GCC 15.2. Non-root Ubuntu 26.04 / WSL: Python 3.14.4 and isolated Python 3.12.16, CMake 4.2.3 / GCC 15.2. Linux runs exact source archives on its native filesystem; a temporary Git snapshot supplies the release tests' current-tree revision lookup.

For both interpreters on each OS, configure Ninja Release with BUILD_TESTING=ON and ANYPS5_RELINKER_ONLY=ON, then run ctest --test-dir <build> -R '^progress_history(_csv|_output)?$' -V and the CTest skip-policy audit. All four configurations pass.

Registered progress_history, progress_history_csv and progress_history_output: 3 CTest groups / 22 unique Python methods, including 4 CSV methods, pass per configuration. Windows skips two existing filesystem cases plus the real-link case where link privileges are absent; Linux skips the existing Windows-only read-only cache case. The directory preservation regression executes on both OSes. No CTest group skips.

With current tests/code except the new preflight guard removed, the real report-preservation assertion fails on both OSes under Python 3.12 and 3.14; this is an assertion about lost sentinel contents, not an import/setup failure. The restored implementation passes.

Current-main conventions with this complete description, whitespace, Python 3.9 grammar, AST test-retention and production-script registration checks pass. No timeout was raised. These are interpreter/tool tests, not native product builds. No actual Python 3.9/3.11, local macOS, PS5/title/GPU or live sampler/browser run is claimed. New-head hosted CI starts after publication; old-head approvals/checks are not fresh results for this head.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5064915632 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12766). Originally posted by [StoneDC](https://github.com/StoneDC) on 2026-10-29T08:39:21Z. --- ### What Adds optional history.csv matching the measured history.json points. Destination preflight runs before collection or any report write, including dangling symlinks. Main integration retains badge-week.svg generation and includes the badge in destination/alias/cache preflight alongside JSON/SVG/HTML and optional CSV. Sentinel regressions now protect every output, and the CSV success path verifies the badge is a real SVG. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Exact head `bfe834f066bc9f9db02045aea388bbb671b1718a` integrates main `ba627802e2210187d417deb64c8f2fed8e33011f`. Windows Python 3.12.14/3.14.3 and Linux Python 3.12.16/3.14.4: all three actual registered history CTest groups pass per configuration, covering 24 methods. Windows has three existing environment/permission skips, Linux one existing Windows-only skip; no CTest group skips. A control removing only the badge from preflight compiles/imports normally and fails the existing-report bytes/mtime preservation assertion in all four environments. Main weekly badge output and optional CSV are both retained; no cross-file atomicity for arbitrary later I/O failure is promised. Current-main conventions, whitespace, registration and main ancestry pass. Hosted runs for the new head are pending until complete. <details> <summary>Earlier rationale and validation (historical revisions and dependency state)</summary> ### What Add opt-in --csv history reports with the same date, commit and metric values as JSON. Address the late-output preservation review: before collection or any report write, reject a report destination that already denotes a non-regular file or a dangling symlink. A known-invalid final CSV destination now produces usage error 2 without replacing earlier JSON/SVG/HTML reports. Keep existing alias/cache checks and controlled error handling. New tests seed distinct report bytes and mtimes, cover each invalid destination, preserve a dangling link and its absent target, and verify retry after removing the obstruction. This is preflight for predictable invalid targets, not a cross-file transaction against arbitrary later I/O failures. Integrate current main's path/symlink handling. Remove two identical shadowed cache-regression copies while retaining their effective method bodies and every existing unique test. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Exact tested head `5cde5c42ad66ec905fb36fe8286fb77d9caebb07`; recorded main `9f748f4d8e36ce3714f3b95f3386316e110a9b22`; previous published head `b4b9fec20ebf7b2b5584410aa1da2d3bdd91816e`. Recorded main and the previous published head are ancestors. All current-main and previous unique test methods are retained; the documented #12488 context nesting and #12766 identical-shadow cleanup preserve the effective assertions. Windows 11: Python 3.14.3 and 3.12.14, CMake 4.3.1 / MinGW GCC 15.2. Non-root Ubuntu 26.04 / WSL: Python 3.14.4 and isolated Python 3.12.16, CMake 4.2.3 / GCC 15.2. Linux runs exact source archives on its native filesystem; a temporary Git snapshot supplies the release tests' current-tree revision lookup. For both interpreters on each OS, configure Ninja Release with BUILD_TESTING=ON and ANYPS5_RELINKER_ONLY=ON, then run `ctest --test-dir <build> -R '^progress_history(_csv|_output)?$' -V` and the CTest skip-policy audit. All four configurations pass. Registered `progress_history`, `progress_history_csv` and `progress_history_output`: 3 CTest groups / 22 unique Python methods, including 4 CSV methods, pass per configuration. Windows skips two existing filesystem cases plus the real-link case where link privileges are absent; Linux skips the existing Windows-only read-only cache case. The directory preservation regression executes on both OSes. No CTest group skips. With current tests/code except the new preflight guard removed, the real report-preservation assertion fails on both OSes under Python 3.12 and 3.14; this is an assertion about lost sentinel contents, not an import/setup failure. The restored implementation passes. Current-main conventions with this complete description, whitespace, Python 3.9 grammar, AST test-retention and production-script registration checks pass. No timeout was raised. These are interpreter/tool tests, not native product builds. No actual Python 3.9/3.11, local macOS, PS5/title/GPU or live sampler/browser run is claimed. New-head hosted CI starts after publication; old-head approvals/checks are not fresh results for this head. </details> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
malekaifa commented 2026-10-30 13:51:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-30T13:51:08Z.

Review: CHANGES_REQUESTED


I reproduced a late-output preservation issue on exact head b4b9fec20ebf7b2b5584410aa1da2d3bdd91816e (Windows 11, Python 3.12).

With --csv, if history.csv already exists as a directory, main() returns the intended argparse exit 2 with no traceback, but only after history.json, history.svg, and history.html have all been replaced. I seeded those three files with sentinel bytes, made history.csv a directory, patched collect() to one valid point, and all three sentinels were lost before the CSV open failed.

This is newly reachable through this PR because the CSV destination is appended as the final write. The existing test_csv_alias_and_write_failure_are_usage_errors verifies the exit path but does not assert that earlier reports survive that failure.

Could the report destinations be preflighted (at least predictable non-file/dangling targets) before the first report write, with a regression that seeds the existing reports and verifies they remain unchanged when the CSV destination is invalid? This does not require claiming full cross-file atomicity against arbitrary I/O failure; it just prevents a known-invalid new destination from partially publishing the report set.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5713238133 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12766#pullrequestreview-5713238133). Originally posted by [malekaifa](https://github.com/malekaifa) on 2026-10-30T13:51:08Z. **Review:** CHANGES_REQUESTED --- I reproduced a late-output preservation issue on exact head `b4b9fec20ebf7b2b5584410aa1da2d3bdd91816e` (Windows 11, Python 3.12). With `--csv`, if `history.csv` already exists as a directory, `main()` returns the intended argparse exit 2 with no traceback, but only after `history.json`, `history.svg`, and `history.html` have all been replaced. I seeded those three files with sentinel bytes, made `history.csv` a directory, patched `collect()` to one valid point, and all three sentinels were lost before the CSV open failed. This is newly reachable through this PR because the CSV destination is appended as the final write. The existing `test_csv_alias_and_write_failure_are_usage_errors` verifies the exit path but does not assert that earlier reports survive that failure. Could the report destinations be preflighted (at least predictable non-file/dangling targets) before the first report write, with a regression that seeds the existing reports and verifies they remain unchanged when the CSV destination is invalid? This does not require claiming full cross-file atomicity against arbitrary I/O failure; it just prevents a known-invalid new destination from partially publishing the report set.
malekaifa commented 2026-10-31 20:05:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-31T20:05:05Z.

Review: APPROVED


Approved exact head 5cde5c42ad. Independent validation: HistoryCsvTests passes (4 tests, 1 symlink-environment skip), py_compile passed, registration/diff/merge preview are clean. The invalid-destination regression verifies existing JSON/SVG/HTML bytes and mtimes are preserved before collection/writes. Negative control on prior head 4b9fec20ebf7b2b5584410aa1da2d3bdd91816e reproduced the bug: all three seeded reports changed before invalid CSV exited 2.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724721851 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12766#pullrequestreview-5724721851). Originally posted by [malekaifa](https://github.com/malekaifa) on 2026-10-31T20:05:05Z. **Review:** APPROVED --- Approved exact head 5cde5c42ad66ec905fb36fe8286fb77d9caebb07. Independent validation: HistoryCsvTests passes (4 tests, 1 symlink-environment skip), py_compile passed, registration/diff/merge preview are clean. The invalid-destination regression verifies existing JSON/SVG/HTML bytes and mtimes are preserved before collection/writes. Negative control on prior head 4b9fec20ebf7b2b5584410aa1da2d3bdd91816e reproduced the bug: all three seeded reports changed before invalid CSV exited 2.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
boykopovar/AnyPS5!12766
No description provided.