fix(tools): retain source commit when Git status fails #5713

Merged
Ondra97 merged 1 commit from upstream-pr/5713 into main 2026-10-15 12:12:10 +00:00
Ondra97 commented 2026-10-14 07:45:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-14T07:45:39Z.


What

An audit JSON loses a valid source_commit when git rev-parse HEAD succeeds but git status --porcelain fails, for example because a submodule's Git directory is unreadable or missing. This occurred in a local title audit: the source revision was readable, but status failed on LibAtrac9 and the report set both provenance fields to null.

Keep the successfully read revision and set only source_dirty to null when status is unavailable. A failed revision query still leaves both fields null. Import classification and exit status are unchanged.

Tested

Windows x64, Python 3.14 and Git; current main b27d18c3e, head fd3c67960.

  • Both new regressions failed before the fix. The integration regression creates a real Git repository and an invalid submodule Git-directory reference, confirms that HEAD is readable and status fails, then verifies the emitted audit JSON keeps HEAD and reports an unknown dirty state.
  • The existing import_audit CTest suite passed: 63 unit/integration tests, with the same two existing Windows symlink skips; 11.03 seconds total.
  • Relinker-only build, conventions and whitespace checks passed. The live restricted source checkout now returns its known commit with source_dirty null rather than dropping both fields.
  • Checked all 441 open PR file lists and manually compared the nine exact shared-file patches (#5571, #5519, #5430, #5310, #5308, #5283, #5273, #5269, #4916). Their changes concern ELF parsing, modules, providers, weak imports or dependency reporting; none changes git_stamp or implements this partial-provenance handling.

Current-head CI for fd3c67960 passed conventions and eligibility, plus all three relinker builds and complete test suites (Build):

  • relinker (macos-latest, clang++): 149 CTest tests, zero failures; import_audit passed.
  • relinker (windows-latest, g++): 153 CTest tests, zero failures; import_audit passed.
  • relinker (ubuntu-latest, g++): 158 CTest tests, zero failures; import_audit passed.

Full runtime-library jobs were skipped by the repository's PR workflow.

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
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4854651063 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5713). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-14T07:45:39Z. --- ### What An audit JSON loses a valid `source_commit` when `git rev-parse HEAD` succeeds but `git status --porcelain` fails, for example because a submodule's Git directory is unreadable or missing. This occurred in a local title audit: the source revision was readable, but status failed on LibAtrac9 and the report set both provenance fields to null. Keep the successfully read revision and set only `source_dirty` to null when status is unavailable. A failed revision query still leaves both fields null. Import classification and exit status are unchanged. ### Tested Windows x64, Python 3.14 and Git; current main `b27d18c3e`, head `fd3c67960`. - Both new regressions failed before the fix. The integration regression creates a real Git repository and an invalid submodule Git-directory reference, confirms that HEAD is readable and status fails, then verifies the emitted audit JSON keeps HEAD and reports an unknown dirty state. - The existing import_audit CTest suite passed: 63 unit/integration tests, with the same two existing Windows symlink skips; 11.03 seconds total. - Relinker-only build, conventions and whitespace checks passed. The live restricted source checkout now returns its known commit with `source_dirty` null rather than dropping both fields. - Checked all 441 open PR file lists and manually compared the nine exact shared-file patches (#5571, #5519, #5430, #5310, #5308, #5283, #5273, #5269, #4916). Their changes concern ELF parsing, modules, providers, weak imports or dependency reporting; none changes `git_stamp` or implements this partial-provenance handling. Current-head CI for `fd3c67960` passed conventions and eligibility, plus all three relinker builds and complete test suites ([Build](https://github.com/boykopovar/AnyPS5/actions/runs/38530450878)): - relinker (macos-latest, clang++): 149 CTest tests, zero failures; import_audit passed. - relinker (windows-latest, g++): 153 CTest tests, zero failures; import_audit passed. - relinker (ubuntu-latest, g++): 158 CTest tests, zero failures; import_audit passed. Full runtime-library jobs were skipped by the repository's PR workflow. ### Checklist - [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: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-15 12:08:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:08:53Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
#6171 tools/import_audit.py
tools/tests/test_import_audit.py
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191690711 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5713#issuecomment-6191690711). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:08:53Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | #6171 | `tools/import_audit.py`<br>`tools/tests/test_import_audit.py` |
adriadam10 commented 2026-10-15 12:11:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T12:11:59Z.


Checked git_stamp (rev-parse and status now fail independently; a failed rev-parse still gives (None, None)) and source_dirty is only dumped to the JSON. Both new tests fail against main's import_audit.py (source_commit is None) and pass with the change; relinker CI green on all three hosts. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191746115 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5713#issuecomment-6191746115). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T12:11:59Z. --- Checked `git_stamp` (rev-parse and status now fail independently; a failed rev-parse still gives `(None, None)`) and `source_dirty` is only dumped to the JSON. Both new tests fail against `main`'s `import_audit.py` (`source_commit` is `None`) and pass with the change; relinker CI green on all three hosts. Merging.
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!5713
No description provided.