fix(tools): report progress history dates consistently across hosts #26737

Closed
cookie42073-cmd wants to merge 1 commit from upstream-pr/26737 into main
cookie42073-cmd commented 2026-11-24 18:22:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-11-24T18:22:09Z.


What

Derive the UTC calendar day directly from the Git timestamp. Report out-of-range dates with their commit IDs.

Tested

The 50-test progress history suite passed 49 applicable cases on Linux Python 3.12 and 3.14 and Windows Python 3.13. Platform-specific skips were covered on the other system. The project overlap scan checked 2,469 open pull requests and reported no unresolved overlap for these files. Conventions and whitespace checks passed.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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:5477911495 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26737). Originally posted by [cookie42073-cmd](https://github.com/cookie42073-cmd) on 2026-11-24T18:22:09Z. --- ### What Derive the UTC calendar day directly from the Git timestamp. Report out-of-range dates with their commit IDs. ### Tested The 50-test progress history suite passed 49 applicable cases on Linux Python 3.12 and 3.14 and Windows Python 3.13. Platform-specific skips were covered on the other system. The project overlap scan checked 2,469 open pull requests and reported no unresolved overlap for these files. Conventions and whitespace checks passed. <!-- 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. --> ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
kripotker commented 2026-11-24 19:07:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kripotker on 2026-11-24T19:07:42Z.

Review: APPROVED


Review: fix(tools): report progress history dates consistently across hosts

Approve.

What I checked

  • daily_commits computes the UTC day as date.fromordinal(epoch + int(timestamp) // 86400):
    • Python's floor division puts negative timestamps on the right day (-1 → 1969-12-31);
    • it avoids datetime.fromtimestamp, which raises OSError for negative timestamps on Windows.
  • Timestamps outside date's range raise ValueError with the commit ID instead of an OverflowError traceback.
  • The datetime and timezone imports it removes aren't used anywhere else in progress_history.py (checked with the AST), so there's no NameError path.

What I ran

Windows 11, Python 3.14, PR head 5589c54757:

python3 tools/tests/test_progress_history.py
python3 tools/check_conventions.py
  • 50 tests, OK (1 skipped).
  • With main's progress_history.py, both new tests error on Windows, including the epoch-boundary one (prior -1), so they cover the change.
  • check_conventions.py: All conventions checks passed.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6045606653 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26737#pullrequestreview-6045606653). Originally posted by [kripotker](https://github.com/kripotker) on 2026-11-24T19:07:42Z. **Review:** APPROVED --- ## Review: fix(tools): report progress history dates consistently across hosts **Approve.** ### What I checked - `daily_commits` computes the UTC day as `date.fromordinal(epoch + int(timestamp) // 86400)`: - Python's floor division puts negative timestamps on the right day (`-1` → `1969-12-31`); - it avoids `datetime.fromtimestamp`, which raises `OSError` for negative timestamps on Windows. - Timestamps outside `date`'s range raise `ValueError` with the commit ID instead of an `OverflowError` traceback. - The `datetime` and `timezone` imports it removes aren't used anywhere else in `progress_history.py` (checked with the AST), so there's no `NameError` path. ### What I ran Windows 11, Python 3.14, PR head 5589c54757: ``` python3 tools/tests/test_progress_history.py python3 tools/check_conventions.py ``` - 50 tests, OK (1 skipped). - With `main`'s `progress_history.py`, both new tests error on Windows, including the epoch-boundary one (`prior -1`), so they cover the change. - `check_conventions.py`: `All conventions checks passed.` AI-assisted: yes (Claude Code).
catminou4 commented 2026-11-24 22:55:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by catminou4 on 2026-11-24T22:55:30Z.

Review: COMMENTED


Reviewed locally (Ubuntu 22.04, Python 3.12).

  • python3 tools/tests/test_progress_history.py: 50 tests pass (1 pre-existing skip).
  • Control: with tools/progress_history.py from origin/main, test_git_timestamps_outside_the_calendar_report_a_controlled_error errors (the raw OverflowError/ValueError from datetime.fromtimestamp escapes); restoring the PR source makes it pass. test_git_timestamps_use_utc_across_epoch_and_calendar_boundaries already passes on main under glibc, as expected: it guards the Windows case where fromtimestamp rejects negative timestamps.
  • date.fromordinal(epoch + ts // 86400) gives UTC days with floor division, so -1 maps to 1969-12-31 and 253402300799 to 9999-12-31; anything outside date's range now raises the ValueError naming the commit.
  • tools/pr_overlap.py --branch pr-26737: no overlap with open pull requests.

Verdict: mergeable.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6048686277 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26737#pullrequestreview-6048686277). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T22:55:30Z. **Review:** COMMENTED --- Reviewed locally (Ubuntu 22.04, Python 3.12). - `python3 tools/tests/test_progress_history.py`: 50 tests pass (1 pre-existing skip). - Control: with `tools/progress_history.py` from `origin/main`, `test_git_timestamps_outside_the_calendar_report_a_controlled_error` errors (the raw `OverflowError`/`ValueError` from `datetime.fromtimestamp` escapes); restoring the PR source makes it pass. `test_git_timestamps_use_utc_across_epoch_and_calendar_boundaries` already passes on `main` under glibc, as expected: it guards the Windows case where `fromtimestamp` rejects negative timestamps. - `date.fromordinal(epoch + ts // 86400)` gives UTC days with floor division, so `-1` maps to 1969-12-31 and 253402300799 to 9999-12-31; anything outside `date`'s range now raises the `ValueError` naming the commit. - `tools/pr_overlap.py --branch pr-26737`: no overlap with open pull requests. Verdict: mergeable.
MarcZX10 commented 2026-11-25 15:12:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T15:12:16Z.

Review: APPROVED


Reviewed — looks good

The UTC day calculation and controlled error for timestamps outside Python’s calendar range are supported by the changed code and boundary tests at head 5589c547573b87a6d200731849dd31a2e1cab560.

What I ran

Read the prepared diff and the full text of both changed files at the pinned head. No test commands were run.

Results

Check Result Note
Diff and changed code review passed Both changed files read
Test execution not run No commands run

Findings

Blocking

None.

Non-blocking

None.

Not verified

Did not execute the reported test suite or confirm the author’s platform runs. review/files.json was not available; the manifest lists both changed files as included, and both were read in full. No other files were excluded by the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6060238538 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26737#pullrequestreview-6060238538). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T15:12:16Z. **Review:** APPROVED --- # Reviewed — looks good The UTC day calculation and controlled error for timestamps outside Python’s calendar range are supported by the changed code and boundary tests at head `5589c547573b87a6d200731849dd31a2e1cab560`. ## What I ran Read the prepared diff and the full text of both changed files at the pinned head. No test commands were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed code review | passed | Both changed files read | | Test execution | not run | No commands run | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Did not execute the reported test suite or confirm the author’s platform runs. `review/files.json` was not available; the manifest lists both changed files as included, and both were read in full. No other files were excluded by the manifest. ## To get this to a good state Nothing is required.

Pull request closed

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!26737
No description provided.