Feat/public GitHub metadata export #1253

Merged
NinsonD merged 6 commits from upstream-pr/1253 into main 2026-12-01 15:14:46 +00:00
NinsonD commented 2026-11-24 20:53:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by NinsonD on 2026-11-24T20:53:09Z.


Claimed in the coordination issue as: Not formally assigned; proposed in #563.

Related issue: #563

What and why

Added a standalone Python utility to preserve publicly accessible GitHub issue and pull request metadata.

The exporter includes:

  • Issues, pull requests, comments and PR reviews.
  • Original IDs, URLs, timestamps, descriptions and contributor attribution.
  • API pagination and rate-limit handling.
  • Duplicate-record detection and atomic JSON output.
  • Offline unit tests and usage documentation.

This is an initial proof of concept for preserving project history before considering a full migration. No external Python dependencies or game files are required. The CLI uses unauthenticated requests to limit exports to public content; GitHub's lower unauthenticated rate limit applies.

Tested

On Windows, Python 3.11.9, tested commit 9e4b0bab961244b050b31e3238a5ec342ebd3a83 using an isolated copy of the exporter and its test file:

  • python -I tests/test_export_github_metadata.py: 6 tests passed with mocked API responses and a writable workspace temporary directory.
  • The repository's line-ending detector reported no unpinned text writes in the exporter. The full repository-wide line-ending scan could not be completed against the isolated copy because the rest of the repository was not present.
  • No live API export or full repository suite was run; CI validation remains pending.

GPUs tested: N/A

AI-assisted: Yes

Checklist

  • Based on current main and verified through CI.
  • One focused contribution.
  • No game data, keys or decryption.
  • Targeted offline tests executed successfully.

Translator contract changes: N/A.

This is a proof of concept rather than a complete migration solution. Feedback on the implementation and scope is welcome.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480140896 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1253). Originally posted by [NinsonD](https://github.com/NinsonD) on 2026-11-24T20:53:09Z. --- Claimed in the coordination issue as: Not formally assigned; proposed in #563. Related issue: #563 What and why Added a standalone Python utility to preserve publicly accessible GitHub issue and pull request metadata. The exporter includes: * Issues, pull requests, comments and PR reviews. * Original IDs, URLs, timestamps, descriptions and contributor attribution. * API pagination and rate-limit handling. * Duplicate-record detection and atomic JSON output. * Offline unit tests and usage documentation. This is an initial proof of concept for preserving project history before considering a full migration. No external Python dependencies or game files are required. The CLI uses unauthenticated requests to limit exports to public content; GitHub's lower unauthenticated rate limit applies. Tested On Windows, Python 3.11.9, tested commit `9e4b0bab961244b050b31e3238a5ec342ebd3a83` using an isolated copy of the exporter and its test file: * `python -I tests/test_export_github_metadata.py`: 6 tests passed with mocked API responses and a writable workspace temporary directory. * The repository's line-ending detector reported no unpinned text writes in the exporter. The full repository-wide line-ending scan could not be completed against the isolated copy because the rest of the repository was not present. * No live API export or full repository suite was run; CI validation remains pending. GPUs tested: N/A AI-assisted: Yes Checklist * [ ] Based on current main and verified through CI. * [x] One focused contribution. * [x] No game data, keys or decryption. * [x] Targeted offline tests executed successfully. Translator contract changes: N/A. This is a proof of concept rather than a complete migration solution. Feedback on the implementation and scope is welcome.
PierreEbele commented 2026-11-25 14:36:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T14:36:56Z.


Reviewed b61a6d609: the branch's own suite fails (mocked API, no network): test_duplicate_ids_fail_closed gets no ValueError because its mock shares one iterator across all pages() calls, so the first issue's comments fetch consumes the second record — the script itself fails closed correctly with per-endpoint iterators (probed). tests/test_text_write_line_endings.py also fails on scripts/export_github_metadata.py:107 (Path.write_text without newline=, CRLF on Windows; CI runs that test everywhere). Both fixes are small; pagination, the retry budget and the atomic output probe clean, and all 12 test_docs_*.py pass. AI-assisted review.

Recommendation: Fix first

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165551869 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1253#issuecomment-7165551869). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T14:36:56Z. --- Reviewed b61a6d609: the branch's own suite fails (mocked API, no network): test_duplicate_ids_fail_closed gets no ValueError because its mock shares one iterator across all pages() calls, so the first issue's comments fetch consumes the second record — the script itself fails closed correctly with per-endpoint iterators (probed). tests/test_text_write_line_endings.py also fails on scripts/export_github_metadata.py:107 (Path.write_text without newline=, CRLF on Windows; CI runs that test everywhere). Both fixes are small; pagination, the retry budget and the atomic output probe clean, and all 12 test_docs_*.py pass. AI-assisted review. **Recommendation:** Fix first
NinsonD commented 2026-11-26 05:08:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by NinsonD on 2026-11-26T05:08:47Z.


Thanks @PierreEbele for reviewing this. I’ve updated the branch in 9e4b0ba to fix the duplicate-ID test mock and specify LF line endings for the JSON output.

The six targeted offline tests pass on Windows. I also checked the exporter with the repository’s line-ending detector; I haven’t run the full repository-wide scan or a live API export. CI workflows are awaiting maintainer approval.

The update also preserves issue and PR descriptions and makes CLI requests unauthenticated to keep the export limited to public content.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7183221521 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1253#issuecomment-7183221521). Originally posted by [NinsonD](https://github.com/NinsonD) on 2026-11-26T05:08:47Z. --- Thanks @PierreEbele for reviewing this. I’ve updated the branch in `9e4b0ba` to fix the duplicate-ID test mock and specify LF line endings for the JSON output. The six targeted offline tests pass on Windows. I also checked the exporter with the repository’s line-ending detector; I haven’t run the full repository-wide scan or a live API export. CI workflows are awaiting maintainer approval. The update also preserves issue and PR descriptions and makes CLI requests unauthenticated to keep the export limited to public content. AI-assisted.
MoonEyes commented 2026-11-27 22:42:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T22:42:44Z.


Hi @NinsonD, thanks for this pull request.

CONTRIBUTING.md asks contributors to claim their work in the coordination issue ("Coordinating who works on what", currently #1608) before opening a pull request: post claiming: <ID> there, or a one-line description if the item is not listed yet, and put the ID in the pull request. I could not find a claim from you for this one.

The claim matters because "it is claimed in the coordination issue by the pull request's author" is the first item on the maintainers' checklist for a mergeable pull request, and because it lets others see that the work is taken before they write it a second time.

Could you post the claim in #1608 and put its ID (or a link to it) on the pull request's "Claimed in the coordination issue as:" line? If you already claimed it in another form, a link to your comment is enough.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7229554685 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1253#issuecomment-7229554685). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T22:42:44Z. --- Hi @NinsonD, thanks for this pull request. CONTRIBUTING.md asks contributors to claim their work in the coordination issue ("Coordinating who works on what", currently #1608) before opening a pull request: post `claiming: <ID>` there, or a one-line description if the item is not listed yet, and put the ID in the pull request. I could not find a claim from you for this one. The claim matters because "it is claimed in the coordination issue by the pull request's author" is the first item on the maintainers' checklist for a mergeable pull request, and because it lets others see that the work is taken before they write it a second time. Could you post the claim in #1608 and put its ID (or a link to it) on the pull request's "Claimed in the coordination issue as:" line? If you already claimed it in another form, a link to your comment is enough. AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-28 23:49:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:49:10Z.


#1253 | head 9e4b0bab96 (merged cleanly with main a9e247cd69) | python -I tests/test_export_github_metadata.py -v + python -I tests/test_tool_stdout_encoding.py + python -I tests/test_ci_registration.py + python -I tests/test_text_write_line_endings.py | red on main: FileNotFoundError (scripts/export_github_metadata.py absent on main) | green on PR+main (unit suite): 6 ran, OK (test_export_github_metadata.py — test_duplicate_ids_fail_closed now passes on 9e4b0bab96), 18 ran, OK (test_ci_registration.py), 3 ran, OK (test_text_write_line_endings.py), 2 ran, OK (test_docs_table_rows.py), 5 ran, OK (test_docs_repo_paths.py), and 1 ran, OK (test_docs_encoding.py); 1 CI check flagged: tests/test_tool_stdout_encoding.py flags scripts/export_github_metadata.py | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited updated head 9e4b0bab96 (scripts/export_github_metadata.py, tests/test_export_github_metadata.py, and docs/github-metadata-export.md) merged cleanly onto main (a9e247cd69) on Windows 11 — first verification run on 9e4b0bab96:

  • Confirmed test_duplicate_ids_fail_closed and LF-output atomic write (newline="\n") pass cleanly on Windows 11 (6/6), and scripts/check_no_game_data.py passes with zero issues.
  • CI blocker caught (tests/test_tool_stdout_encoding.py): EveryToolGuardsStdout.test_every_main_block_reconfigures_stdout requires every tools/*.py and scripts/*.py with an if __name__ == "__main__": block to call sys.stdout.reconfigure(errors="replace") (inside try ... except (AttributeError, ValueError, OSError): pass) before running main() so redirected stdout on Windows cp1252 under python -I cannot raise UnicodeEncodeError. Adding that guard in scripts/export_github_metadata.py's __main__ block will clear test_tool_stdout_encoding.py once #2590 lands.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247684065 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1253#issuecomment-7247684065). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T23:49:10Z. --- #1253 | head 9e4b0bab961244b050b31e3238a5ec342ebd3a83 (merged cleanly with main a9e247cd69) | `python -I tests/test_export_github_metadata.py -v` + `python -I tests/test_tool_stdout_encoding.py` + `python -I tests/test_ci_registration.py` + `python -I tests/test_text_write_line_endings.py` | red on main: `FileNotFoundError` (`scripts/export_github_metadata.py` absent on `main`) | green on PR+main (unit suite): `6 ran, OK` (`test_export_github_metadata.py` — `test_duplicate_ids_fail_closed` now passes on `9e4b0bab96`), `18 ran, OK` (`test_ci_registration.py`), `3 ran, OK` (`test_text_write_line_endings.py`), `2 ran, OK` (`test_docs_table_rows.py`), `5 ran, OK` (`test_docs_repo_paths.py`), and `1 ran, OK` (`test_docs_encoding.py`); **1 CI check flagged**: `tests/test_tool_stdout_encoding.py` flags `scripts/export_github_metadata.py` | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited updated head `9e4b0bab96` (`scripts/export_github_metadata.py`, `tests/test_export_github_metadata.py`, and `docs/github-metadata-export.md`) merged cleanly onto `main` (`a9e247cd69`) on Windows 11 — first verification run on `9e4b0bab96`: - Confirmed `test_duplicate_ids_fail_closed` and LF-output atomic write (`newline="\n"`) pass cleanly on Windows 11 (`6/6`), and `scripts/check_no_game_data.py` passes with zero issues. - **CI blocker caught (`tests/test_tool_stdout_encoding.py`)**: `EveryToolGuardsStdout.test_every_main_block_reconfigures_stdout` requires every `tools/*.py` and `scripts/*.py` with an `if __name__ == "__main__":` block to call `sys.stdout.reconfigure(errors="replace")` (inside `try ... except (AttributeError, ValueError, OSError): pass`) before running `main()` so redirected stdout on Windows `cp1252` under `python -I` cannot raise `UnicodeEncodeError`. Adding that guard in `scripts/export_github_metadata.py`'s `__main__` block will clear `test_tool_stdout_encoding.py` once `#2590` lands.
enlight3d commented 2026-11-29 00:44:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:44:51Z.


Independent run of #1253 (python -I, no build, no game, no network; GPU not used).

  • PR head: 9e4b0bab96
  • main: 829530dbd0 (PR merged into it locally with git merge --no-ff, clean)
  • Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12, standard library only

Commands (one process each, from the repo root): python -I tests/test_export_github_metadata.py, plus every tests/test_docs_*.py, test_ci_registration.py, test_text_write_line_endings.py, test_csv_line_endings.py, test_check_no_game_data.py, test_no_game_data_workflow.py, test_tool_stdout_encoding.py.

  • Red: with the two non-test files reverted (scripts/export_github_metadata.py, docs/github-metadata-export.md) and the test kept, the test file cannot load: FileNotFoundError for the exporter. This is a new-feature red (the module does not exist on main), not a behaviour red.
  • Green at head: test_export_github_metadata.py 6/6 OK (the duplicate-ID and LF-output fixes from the review are in).
  • Green merged into main: test_export_github_metadata.py 6/6 OK.
  • Other files, merged vs plain main: same results except one thing below.
  • Not green, caused by this PR: tests/test_tool_stdout_encoding.py fails at the head and merged. The list of programs whose __main__ block does not set errors='replace' on stdout gains scripts/export_github_metadata.py. The test is already red on plain main for other programs (tools/pc_prompt_glyphs.py, tools/xbox_prompt_glyphs.py, scripts/bench_translate.py, scripts/export_old_pr_manifest.py), so it is pre-existing, but this PR adds one more entry to fix.
  • Pre-existing on plain main, identical merged: test_docs_cli_flags.py (1 failure, README line 94, a PowerShell flag) and test_docs_links.py (1 failure, a relative link in the d3d12 README).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248323275 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1253#issuecomment-7248323275). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T00:44:51Z. --- Independent run of #1253 (python -I, no build, no game, no network; GPU not used). - PR head: 9e4b0bab961244b050b31e3238a5ec342ebd3a83 - main: 829530dbd0196aa817dbec74aaafc79407b94b57 (PR merged into it locally with `git merge --no-ff`, clean) - Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12, standard library only Commands (one process each, from the repo root): `python -I tests/test_export_github_metadata.py`, plus every `tests/test_docs_*.py`, `test_ci_registration.py`, `test_text_write_line_endings.py`, `test_csv_line_endings.py`, `test_check_no_game_data.py`, `test_no_game_data_workflow.py`, `test_tool_stdout_encoding.py`. - Red: with the two non-test files reverted (`scripts/export_github_metadata.py`, `docs/github-metadata-export.md`) and the test kept, the test file cannot load: `FileNotFoundError` for the exporter. This is a new-feature red (the module does not exist on main), not a behaviour red. - Green at head: `test_export_github_metadata.py` 6/6 OK (the duplicate-ID and LF-output fixes from the review are in). - Green merged into main: `test_export_github_metadata.py` 6/6 OK. - Other files, merged vs plain main: same results except one thing below. - Not green, caused by this PR: `tests/test_tool_stdout_encoding.py` fails at the head and merged. The list of programs whose `__main__` block does not set `errors='replace'` on stdout gains `scripts/export_github_metadata.py`. The test is already red on plain main for other programs (`tools/pc_prompt_glyphs.py`, `tools/xbox_prompt_glyphs.py`, `scripts/bench_translate.py`, `scripts/export_old_pr_manifest.py`), so it is pre-existing, but this PR adds one more entry to fix. - Pre-existing on plain main, identical merged: `test_docs_cli_flags.py` (1 failure, README line 94, a PowerShell flag) and `test_docs_links.py` (1 failure, a relative link in the d3d12 README).
MoonEyes commented 2026-11-29 17:08:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T17:08:55Z.


Tested 9e4b0bab9 merged (no commit) with main 4364a4fa6: Python 3.12, Windows 11 10.0.26300, CPU only.

  • Green: python -I tests/test_export_github_metadata.py gives 6 tests OK.
  • Red: without scripts/export_github_metadata.py (new in this PR) the test cannot import it, so the red is only the missing module.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259460512 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1253#issuecomment-7259460512). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T17:08:55Z. --- Tested `9e4b0bab9` merged (no commit) with `main` `4364a4fa6`: Python 3.12, Windows 11 10.0.26300, CPU only. - Green: `python -I tests/test_export_github_metadata.py` gives 6 tests OK. - Red: without `scripts/export_github_metadata.py` (new in this PR) the test cannot import it, so the red is only the missing module. AI-assisted (Claude Code).
NinsonD commented 2026-12-01 08:36:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by NinsonD on 2026-12-01T08:36:34Z.


Thanks @zmasi, @enlight3d and @MoonEyes for reviewing and testing this.

I’ve added the stdout encoding guard in 2095f63. In an isolated copy on Windows, the six offline exporter tests and the relevant stdout guard check pass. I haven’t run the full repository suite; CI results are still pending.

@MoonEyes, thanks for pointing out the missing coordination claim. I proposed the work in #563 but did not post a claim before opening this PR. Since the PR is already open, would you prefer that I add a claim in the current coordination thread and link it here, or follow another process?

AI-assisted changes and testing.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7305545050 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1253#issuecomment-7305545050). Originally posted by [NinsonD](https://github.com/NinsonD) on 2026-12-01T08:36:34Z. --- Thanks @zmasi, @enlight3d and @MoonEyes for reviewing and testing this. I’ve added the stdout encoding guard in `2095f63`. In an isolated copy on Windows, the six offline exporter tests and the relevant stdout guard check pass. I haven’t run the full repository suite; CI results are still pending. @MoonEyes, thanks for pointing out the missing coordination claim. I proposed the work in #563 but did not post a claim before opening this PR. Since the PR is already open, would you prefer that I add a claim in the current coordination thread and link it here, or follow another process? AI-assisted changes and testing.
aslan2142 commented 2026-12-01 11:43:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:43:39Z.

Review: APPROVED


Reviewed scripts/export_github_metadata.py, tests/test_export_github_metadata.py, and docs/github-metadata-export.md on head 2095f63. Clean-room, standard-library-only, offline tests pass, and 2095f63 adds the sys.stdout.reconfigure(errors="replace") guard alongside LF line endings and atomic replacement.

Approving pending a fresh green CI run on this head. Minor non-blocking follow-ups you may want to tidy: remove the unused import os at scripts/export_github_metadata.py:59, update the example repo slug at docs/github-metadata-export.md:19, and link your coordination-issue claim in the PR description.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130550122 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1253#pullrequestreview-6130550122). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:43:39Z. **Review:** APPROVED --- Reviewed `scripts/export_github_metadata.py`, `tests/test_export_github_metadata.py`, and `docs/github-metadata-export.md` on head `2095f63`. Clean-room, standard-library-only, offline tests pass, and `2095f63` adds the `sys.stdout.reconfigure(errors="replace")` guard alongside LF line endings and atomic replacement. Approving pending a fresh green CI run on this head. Minor non-blocking follow-ups you may want to tidy: remove the unused `import os` at `scripts/export_github_metadata.py:59`, update the example repo slug at `docs/github-metadata-export.md:19`, and link your coordination-issue claim in the PR description. *(AI-assisted review.)*
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
ProjectLeonida/mandy!1253
No description provided.