[PR #8] [MERGED] fix(kb, publish): PRs from forks, and UTF-8 / forward slashes on Windows #54

Closed
opened 2026-10-15 20:53:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rehan-remade/universal-modder/pull/8
Author: @taras-ryzhenko
Created: 10/2/2026
Status: ✅ Merged
Merged: 10/4/2026
Merged by: @rehan-remade

Base: main ← Head: fix/kb-pr-fork-head


📝 Commits (1)

  • 4dc681b fix(kb, publish): PRs from forks, and UTF-8 / forward slashes on Windows

📊 Changes

3 files changed (+41 additions, -16 deletions)

View changed files

📝 tests/test_um.py (+14 -3)
📝 um/kb.py (+25 -11)
📝 um/publish.py (+2 -2)

📄 Description

Two bugs hit while contributing a field note from Windows (#7), plus one small cross-platform fix.

1. um kb pr --yes can't open the PR from a fork. Without push access the route is fork → push → gh pr create --repo rehan-remade/universal-modder --head <branch>. gh looks a bare --head branch up in the base repo, so the last step fails after the branch is already pushed:

GraphQL: Head sha can't be blank, Base sha can't be blank, No commits between main and kb/..., Head ref must be a branch

The head is now <fork owner>:<branch>, read from the fork remote's URL (kb.pr_head, tests for https and ssh remotes). Pushing to the repo itself (maintainers) is unchanged.

2. um kb index on Windows writes an invalid-UTF-8 index. Path.read_text() / write_text() default to the ANSI code page there (and \r\n), so the · separators in INDEX.md became lone 0xB7 bytes; um kb check --index and test_repo_knowledge_is_valid then fail on Linux. Notes and the index are now read/written as UTF-8 with \n (kb.TEXT), as on Linux/macOS.

3. um publish check printed src\Mod.cs on Windows (the test expects src/Mod.cs): paths are reported with forward slashes.

Tests: the suite read the knowledge files with the default encoding too; it now passes on Windows 10 / Python 3.12 (uv run --with pytest pytest -q tests: 27 passed), plus um kb check --index and every um <group> --help.

Written with Claude Code (Opus 5.5).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rehan-remade/universal-modder/pull/8 **Author:** [@taras-ryzhenko](https://github.com/taras-ryzhenko) **Created:** 10/2/2026 **Status:** ✅ Merged **Merged:** 10/4/2026 **Merged by:** [@rehan-remade](https://github.com/rehan-remade) **Base:** `main` ← **Head:** `fix/kb-pr-fork-head` --- ### 📝 Commits (1) - [`4dc681b`](https://github.com/rehan-remade/universal-modder/commit/4dc681ba06aabb21edbcab00d2f12c92b9f459cb) fix(kb, publish): PRs from forks, and UTF-8 / forward slashes on Windows ### 📊 Changes **3 files changed** (+41 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_um.py` (+14 -3) 📝 `um/kb.py` (+25 -11) 📝 `um/publish.py` (+2 -2) </details> ### 📄 Description Two bugs hit while contributing a field note from Windows (#7), plus one small cross-platform fix. **1. `um kb pr --yes` can't open the PR from a fork.** Without push access the route is fork → push → `gh pr create --repo rehan-remade/universal-modder --head <branch>`. gh looks a bare `--head` branch up in the *base* repo, so the last step fails after the branch is already pushed: ``` GraphQL: Head sha can't be blank, Base sha can't be blank, No commits between main and kb/..., Head ref must be a branch ``` The head is now `<fork owner>:<branch>`, read from the `fork` remote's URL (`kb.pr_head`, tests for https and ssh remotes). Pushing to the repo itself (maintainers) is unchanged. **2. `um kb index` on Windows writes an invalid-UTF-8 index.** `Path.read_text()` / `write_text()` default to the ANSI code page there (and `\r\n`), so the `·` separators in `INDEX.md` became lone `0xB7` bytes; `um kb check --index` and `test_repo_knowledge_is_valid` then fail on Linux. Notes and the index are now read/written as UTF-8 with `\n` (`kb.TEXT`), as on Linux/macOS. **3. `um publish check` printed `src\Mod.cs` on Windows** (the test expects `src/Mod.cs`): paths are reported with forward slashes. Tests: the suite read the knowledge files with the default encoding too; it now passes on Windows 10 / Python 3.12 (`uv run --with pytest pytest -q tests`: 27 passed), plus `um kb check --index` and every `um <group> --help`. Written with Claude Code (Opus 5.5). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 20:53:02 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
rehan-remade/universal-modder#54
No description provided.