tests: the registration scan walks a root that is not a repository, even inside one (CI-REGISTRATION-OUTER-REPO) #2472

Open
robot00f wants to merge 1 commit from upstream-pr/2472 into main
robot00f commented 2026-11-27 15:34:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-27T15:34:02Z.


tests: the registration scan walks a root that is not a repository, even inside one (CI-REGISTRATION-OUTER-REPO)

Claimed in the coordination issue as: CI-REGISTRATION-OUTER-REPO.

What and why

tests/test_ci_registration.py builds a scratch tree in tempfile.TemporaryDirectory() and expects claimed_test_files to walk it. tracked_under_tests asks git ls-files -- tests first, and git looks upward for a repository: when the scratch root is not one but sits under a directory that is, the outer repository answers (returncode 0) with no record of tests/, the list comes back empty and the walk never runs.

Measured on this machine (Windows 10 Pro 19045): %TEMP% is C:\Users\<user>\AppData\Local\Temp, under a repository at C:/Users/<user>, so tests/test_ci_registration.py:703 fails with KeyError: 'tests/left_out_test.py'. The failure is not the path separator: line 133 already normalizes os.sep to / in the walk. On Linux and on the CI runners %TEMP% is not inside a repository, which is why only a native Windows run sees it.

What

The tracked list is used only when the root is the repository's top level:

top = subprocess.run(["git", "rev-parse", "--show-toplevel"], cwd=root, ...)
if top.returncode == 0 and normcase(realpath(top.stdout)) == normcase(realpath(root)):
    ...git ls-files...
# else: walk, as for a tree with no git

GIT_CEILING_DIRECTORIES was tried first and does not hold here: Git for Windows parses the drive's C: as a list separator.

Test

  • test_a_tree_that_is_not_a_repository_is_walked_even_inside_one: git init in a temporary directory, a scratch tree inside it with tests/test_inside.py, and the scan must return ["tests/test_inside.py"] (skipped when git is absent).
  • The test that already failed on this host (test_the_scan_flags_an_unlisted_file_and_a_file_pytest_cannot_collect) passes again.

With the previous code both fail here ([] != ['tests/test_inside.py'] and the KeyError). 19 of 19 pass with the change; the real scan of this checkout is unaffected, because ROOT is the top level (normcase(realpath) equal) and takes the same ls-files path as before.

Which GPU

None needed: no GPU and no game data (pages of a temporary directory). Run on Windows 10 Pro 19045.

AI-assisted (OpenCode, DeepSeek).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5529211940 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472). Originally posted by [robot00f](https://github.com/robot00f) on 2026-11-27T15:34:02Z. --- tests: the registration scan walks a root that is not a repository, even inside one (CI-REGISTRATION-OUTER-REPO) Claimed in the coordination issue as: CI-REGISTRATION-OUTER-REPO. ### What and why `tests/test_ci_registration.py` builds a scratch tree in `tempfile.TemporaryDirectory()` and expects `claimed_test_files` to walk it. `tracked_under_tests` asks `git ls-files -- tests` first, and git looks **upward** for a repository: when the scratch root is not one but sits under a directory that is, the outer repository answers (`returncode 0`) with no record of `tests/`, the list comes back empty and the walk never runs. Measured on this machine (Windows 10 Pro 19045): `%TEMP%` is `C:\Users\<user>\AppData\Local\Temp`, under a repository at `C:/Users/<user>`, so `tests/test_ci_registration.py:703` fails with `KeyError: 'tests/left_out_test.py'`. The failure is not the path separator: line 133 already normalizes `os.sep` to `/` in the walk. On Linux and on the CI runners `%TEMP%` is not inside a repository, which is why only a native Windows run sees it. ### What The tracked list is used only when the root **is** the repository's top level: ```python top = subprocess.run(["git", "rev-parse", "--show-toplevel"], cwd=root, ...) if top.returncode == 0 and normcase(realpath(top.stdout)) == normcase(realpath(root)): ...git ls-files... # else: walk, as for a tree with no git ``` `GIT_CEILING_DIRECTORIES` was tried first and does not hold here: Git for Windows parses the drive's `C:` as a list separator. ### Test - `test_a_tree_that_is_not_a_repository_is_walked_even_inside_one`: `git init` in a temporary directory, a scratch tree inside it with `tests/test_inside.py`, and the scan must return `["tests/test_inside.py"]` (skipped when git is absent). - The test that already failed on this host (`test_the_scan_flags_an_unlisted_file_and_a_file_pytest_cannot_collect`) passes again. With the previous code both fail here (`[] != ['tests/test_inside.py']` and the `KeyError`). 19 of 19 pass with the change; the real scan of this checkout is unaffected, because `ROOT` is the top level (`normcase(realpath)` equal) and takes the same `ls-files` path as before. ### Which GPU None needed: no GPU and no game data (pages of a temporary directory). Run on Windows 10 Pro 19045. AI-assisted (OpenCode, DeepSeek).
djrolfes commented 2026-11-27 17:36:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-27T17:36:22Z.


Independent Linux review/test at 0078060a3 (merged cleanly on origin/main c0201a806). AI-assisted.

  • Diff looks clean: tracked_under_tests verifies git rev-parse --show-toplevel matches root before using git ls-files, falling back to walking when root is a non-repo directory nested inside an outer git repository.
  • python3 -I tests/test_ci_registration.py: 19/19 OK (including test_a_tree_that_is_not_a_repository_is_walked_even_inside_one).
  • python3 -I tests/test_text_write_line_endings.py: 3/3 OK.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7224590901 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2472#issuecomment-7224590901). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-27T17:36:22Z. --- Independent Linux review/test at `0078060a3` (merged cleanly on `origin/main` `c0201a806`). AI-assisted. - Diff looks clean: `tracked_under_tests` verifies `git rev-parse --show-toplevel` matches `root` before using `git ls-files`, falling back to walking when `root` is a non-repo directory nested inside an outer git repository. - `python3 -I tests/test_ci_registration.py`: **19/19 OK** (including `test_a_tree_that_is_not_a_repository_is_walked_even_inside_one`). - `python3 -I tests/test_text_write_line_endings.py`: **3/3 OK**.
TheGeogeo commented 2026-11-27 18:40:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-27T18:40:46Z.


Independent review of 0078060a31e83f1f5464b9d0ae01118123546bf1, merged with main 43a9d562d355e7c5c428e486071b456353de8b05 (local merge e4b7dfe19b0836bc8236aa588291e7f0f91282dc).

Finding — Windows checkout paths with non-ASCII characters: tests/test_ci_registration.py:128–130 reads git rev-parse --show-toplevel with text=True and the default Windows encoding. On this machine Git outputs UTF-8 while Python 3.12.4 under -I uses cp1252. In a synthetic checkout named café, the decoded root no longer matches and the fallback walk includes an untracked test, making test_every_test_file_is_selected_by_a_job fail. In a checkout containing ā, decoding fails and top.stdout.strip() raises AttributeError in setUpClass. The same entry-point test passes on main in both checkouts. Specifying encoding="utf-8" for this Git output fixed all three ASCII/non-ASCII probes and preserved the new nested-repository test in an isolated in-memory check.

Windows 11 build 26300, PowerShell 7.6.10, Python 3.12.4 and Git for Windows 2.36.0:

  • test_ci_registration.py: ordinary TEMP: main 18/18, merged PR 19/19. TEMP inside a synthetic Git repository: main 17/18, merged PR 19/19. The new test fails as expected against main's implementation.
  • test_text_write_line_endings.py 3/3, test_run_standalone_tests.py 5/5 and test_ctest_registration.py 6/6 on each revision. No-game-data check and git diff --check passed.
  • The full Windows standard-library CI step exceeded its 240-second limit on both revisions. Partial output: 178/509 files on main and 162/509 on the merge; no overall result is claimed.

No game files or GPU were used. The targeted nested-repository improvement is demonstrated; the Unicode-path regression needs attention.

AI-assisted: yes (Codex, GPT-6.2 Sol).

Status: Please fix the Windows Unicode-path regression before merging.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7225748876 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2472#issuecomment-7225748876). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-27T18:40:46Z. --- Independent review of `0078060a31e83f1f5464b9d0ae01118123546bf1`, merged with `main` `43a9d562d355e7c5c428e486071b456353de8b05` (local merge `e4b7dfe19b0836bc8236aa588291e7f0f91282dc`). **Finding — Windows checkout paths with non-ASCII characters:** `tests/test_ci_registration.py:128–130` reads `git rev-parse --show-toplevel` with `text=True` and the default Windows encoding. On this machine Git outputs UTF-8 while Python 3.12.4 under `-I` uses cp1252. In a synthetic checkout named `café`, the decoded root no longer matches and the fallback walk includes an untracked test, making `test_every_test_file_is_selected_by_a_job` fail. In a checkout containing `ā`, decoding fails and `top.stdout.strip()` raises `AttributeError` in `setUpClass`. The same entry-point test passes on `main` in both checkouts. Specifying `encoding="utf-8"` for this Git output fixed all three ASCII/non-ASCII probes and preserved the new nested-repository test in an isolated in-memory check. Windows 11 build 26300, PowerShell 7.6.10, Python 3.12.4 and Git for Windows 2.36.0: - `test_ci_registration.py`: ordinary TEMP: main 18/18, merged PR 19/19. TEMP inside a synthetic Git repository: main 17/18, merged PR 19/19. The new test fails as expected against main's implementation. - `test_text_write_line_endings.py` 3/3, `test_run_standalone_tests.py` 5/5 and `test_ctest_registration.py` 6/6 on each revision. No-game-data check and `git diff --check` passed. - The full Windows standard-library CI step exceeded its 240-second limit on both revisions. Partial output: 178/509 files on main and 162/509 on the merge; no overall result is claimed. No game files or GPU were used. The targeted nested-repository improvement is demonstrated; the Unicode-path regression needs attention. AI-assisted: yes (Codex, GPT-6.2 Sol). **Status:** Please fix the Windows Unicode-path regression before merging.
Andretuta commented 2026-11-27 21:00:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-27T21:00:43Z.

Review: CHANGES_REQUESTED


The outer-repository fix and os.path.normcase(os.path.realpath(...)) comparison handle nested %TEMP% directories, Windows junctions/short paths, and worktrees well, but requesting changes to address the Windows non-ASCII path decoding issue noted by @TheGeogeo (and the matching git ls-files -z call right below it) before we merge:

  1. Locale decoding on git rev-parse --show-toplevel (tests/test_ci_registration.py:128-130) and git ls-files -z (tests/test_ci_registration.py:131-133):
    Under python -I on Windows, text=True without an explicit encoding decodes subprocess output with locale.getencoding() (typically cp1252), whereas Git for Windows emits UTF-8 bytes for both commands:

    • If the repository path (or %TEMP% in test_a_tree_that_is_not_a_repository_is_walked_even_inside_one) contains UTF-8 bytes undefined in cp1252 (e.g. č -> 0xc4 0x8d or ā -> 0xc4 0x81), _readerthread fails with UnicodeDecodeError, leaving stdout as None and raising AttributeError: 'NoneType' object has no attribute 'strip' (or 'split' on line 133 for a non-ASCII path under tests/).
    • If the UTF-8 bytes happen to decode under cp1252 (e.g. café -> café), top.stdout.strip() silently mismatches here and falls back to os.walk, picking up untracked files under tests/.
  2. Suggested fix:
    Drop text=True and decode the raw path bytes with os.fsdecode(...), matching tests/test_docs_links.py:107-112 (on Windows os.fsdecode always uses UTF-8 even under -I, and on POSIX it preserves non-UTF-8 paths via surrogateescape):

    top = subprocess.run(["git", "rev-parse", "--show-toplevel"], cwd=root, capture_output=True)
    here = os.path.normcase(os.path.realpath(root))
    if top.returncode == 0 and os.path.normcase(os.path.realpath(os.fsdecode(top.stdout.rstrip(b"\r\n")))) == here:
        result = subprocess.run(["git", "ls-files", "-z", "--", "tests"], cwd=root, capture_output=True)
        if result.returncode == 0:
            return [os.fsdecode(n) for n in result.stdout.split(b"\0") if n]
    

    (Similarly, in test_a_tree_that_is_not_a_repository_is_walked_even_inside_one at lines 729-731, please pass encoding="utf-8", errors="replace" or read bytes so added.stderr cannot become None if git init fails in a non-CP1252 temp path.)

  3. Regression test:
    Please add a test covering a synthetic repository root with non-ASCII characters (including a byte undefined in cp1252 such as č and a multi-byte Latin character such as é) verifying that tracked_under_tests still takes the git ls-files path (ignoring untracked files) rather than raising or falling back to os.walk.

AI-assisted review.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6093315995 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#pullrequestreview-6093315995). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-27T21:00:43Z. **Review:** CHANGES_REQUESTED --- The outer-repository fix and `os.path.normcase(os.path.realpath(...))` comparison handle nested `%TEMP%` directories, Windows junctions/short paths, and worktrees well, but requesting changes to address the Windows non-ASCII path decoding issue noted by @TheGeogeo (and the matching `git ls-files -z` call right below it) before we merge: 1. **Locale decoding on `git rev-parse --show-toplevel` (`tests/test_ci_registration.py:128-130`) and `git ls-files -z` (`tests/test_ci_registration.py:131-133`):** Under `python -I` on Windows, `text=True` without an explicit encoding decodes subprocess output with `locale.getencoding()` (typically `cp1252`), whereas Git for Windows emits UTF-8 bytes for both commands: - If the repository path (or `%TEMP%` in `test_a_tree_that_is_not_a_repository_is_walked_even_inside_one`) contains UTF-8 bytes undefined in `cp1252` (e.g. `č` -> `0xc4 0x8d` or `ā` -> `0xc4 0x81`), `_readerthread` fails with `UnicodeDecodeError`, leaving `stdout` as `None` and raising `AttributeError: 'NoneType' object has no attribute 'strip'` (or `'split'` on line 133 for a non-ASCII path under `tests/`). - If the UTF-8 bytes happen to decode under `cp1252` (e.g. `café` -> `café`), `top.stdout.strip()` silently mismatches `here` and falls back to `os.walk`, picking up untracked files under `tests/`. 2. **Suggested fix:** Drop `text=True` and decode the raw path bytes with `os.fsdecode(...)`, matching `tests/test_docs_links.py:107-112` (on Windows `os.fsdecode` always uses UTF-8 even under `-I`, and on POSIX it preserves non-UTF-8 paths via `surrogateescape`): ```python top = subprocess.run(["git", "rev-parse", "--show-toplevel"], cwd=root, capture_output=True) here = os.path.normcase(os.path.realpath(root)) if top.returncode == 0 and os.path.normcase(os.path.realpath(os.fsdecode(top.stdout.rstrip(b"\r\n")))) == here: result = subprocess.run(["git", "ls-files", "-z", "--", "tests"], cwd=root, capture_output=True) if result.returncode == 0: return [os.fsdecode(n) for n in result.stdout.split(b"\0") if n] ``` (Similarly, in `test_a_tree_that_is_not_a_repository_is_walked_even_inside_one` at lines 729-731, please pass `encoding="utf-8", errors="replace"` or read bytes so `added.stderr` cannot become `None` if `git init` fails in a non-CP1252 temp path.) 3. **Regression test:** Please add a test covering a synthetic repository root with non-ASCII characters (including a byte undefined in `cp1252` such as `č` and a multi-byte Latin character such as `é`) verifying that `tracked_under_tests` still takes the `git ls-files` path (ignoring untracked files) rather than raising or falling back to `os.walk`. AI-assisted review.
robot00f commented 2026-11-27 21:48:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-27T21:48:53Z.


Addressed in d47eb157 (rebased onto current main):

  • Dropped text=True in tracked_under_tests and decoded raw Git path bytes with os.fsdecode(...) (plus -c core.quotepath=false on rev-parse --show-toplevel), matching tests/test_docs_links.py.
  • Switched git init / git add subprocess calls in the tests to encoding='utf-8', errors='replace'.
  • Added test_non_ascii_repository_root_uses_tracked_list_not_walk covering a repository root and tracked test path containing both é (valid in cp1252) and č (undefined in cp1252) alongside an untracked test under python -I (20/20 pass on Windows 10 Pro 19045).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7228778021 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#issuecomment-7228778021). Originally posted by [robot00f](https://github.com/robot00f) on 2026-11-27T21:48:53Z. --- Addressed in d47eb157 (rebased onto current `main`): - Dropped `text=True` in `tracked_under_tests` and decoded raw Git path bytes with `os.fsdecode(...)` (plus `-c core.quotepath=false` on `rev-parse --show-toplevel`), matching `tests/test_docs_links.py`. - Switched `git init` / `git add` subprocess calls in the tests to `encoding='utf-8', errors='replace'`. - Added `test_non_ascii_repository_root_uses_tracked_list_not_walk` covering a repository root and tracked test path containing both `é` (valid in `cp1252`) and `č` (undefined in `cp1252`) alongside an untracked test under `python -I` (20/20 pass on Windows 10 Pro 19045).
OreoFR commented 2026-11-28 22:02:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:02:33Z.


Verified by OreoFR

  • Base: main 3408969a7 + PR head d47eb1570
  • Test: python -I tests/test_ci_registration.py
  • Red on main: 20 OK
  • Green with the PR: 20 OK
  • Verdict: NO RED
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246454369 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#issuecomment-7246454369). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T22:02:33Z. --- **Verified by OreoFR** - Base: main `3408969a7` + PR head `d47eb1570` - Test: `python -I tests/test_ci_registration.py` - Red on main: 20 OK - Green with the PR: 20 OK - Verdict: NO RED - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 00:47:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T00:47:08Z.


#2472 | head d47eb15704 (merged cleanly onto origin/main e66c65b950) | Windows 11 (10.0.26200.9974, NTFS), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11)

  • Diff & safety audit: Inspected 100% of the diff (+61/-6 in tests/test_ci_registration.py). python -I scripts/check_no_game_data.py tests/test_ci_registration.py passed (rc=0).
  • Red -> Green on Windows 11 (origin/main e66c65b950 vs #2472 + origin/main):
    • Red (origin/main): Initialized an outer Git repository in %TEMP% with a non-repository scratch\tests\test_x.py subdirectory inside it; tracked_under_tests(inside) returned [] on origin/main because git ls-files -z -- tests succeeded against the outer repository and skipped the directory walk.
    • Green (#2472 + origin/main): tracked_under_tests(root) checks git -c core.quotepath=false rev-parse --show-toplevel (os.path.normcase(os.path.realpath(...)) + raw byte os.fsdecode) before trusting git ls-files, and python -I tests/test_ci_registration.py passed 20/20 (OK) on Windows 11 — including both test_a_tree_that_is_not_a_repository_is_walked_even_inside_one and test_non_ascii_repository_root_uses_tracked_list_not_walk (café_č_repo under python -I Windows ANSI/cp1252 defaults).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248348436 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#issuecomment-7248348436). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T00:47:08Z. --- #2472 | head d47eb15704ca0f3cbe5ff2b497b0f6091e8f23ae (merged cleanly onto origin/main e66c65b950) | Windows 11 (10.0.26200.9974, NTFS), Python 3.12.10 | AI-assisted: yes ### Independent Verification (Windows 11) - **Diff & safety audit**: Inspected 100% of the diff (`+61/-6` in `tests/test_ci_registration.py`). `python -I scripts/check_no_game_data.py tests/test_ci_registration.py` passed (`rc=0`). - **Red -> Green on Windows 11 (`origin/main` `e66c65b950` vs `#2472 + origin/main`)**: - **Red (`origin/main`)**: Initialized an outer Git repository in `%TEMP%` with a non-repository `scratch\tests\test_x.py` subdirectory inside it; `tracked_under_tests(inside)` returned `[]` on `origin/main` because `git ls-files -z -- tests` succeeded against the outer repository and skipped the directory walk. - **Green (`#2472 + origin/main`)**: `tracked_under_tests(root)` checks `git -c core.quotepath=false rev-parse --show-toplevel` (`os.path.normcase(os.path.realpath(...))` + raw byte `os.fsdecode`) before trusting `git ls-files`, and `python -I tests/test_ci_registration.py` passed **`20/20` (`OK`)** on Windows 11 — including both `test_a_tree_that_is_not_a_repository_is_walked_even_inside_one` and `test_non_ascii_repository_root_uses_tracked_list_not_walk` (`café_č_repo` under `python -I` Windows ANSI/cp1252 defaults).
timbot103 commented 2026-11-29 04:28:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T04:28:59Z.

Review: COMMENTED


Static audit of d47eb1570 in tests/test_ci_registration.py. No builds, tests, or GPU runs were performed.

The linked worktree’s .git file is sufficient for Git to identify its own top level. On Windows, the comparison resolves existing short names and symlink targets before normalizing slash spelling and case, including drive-letter case. The added tests cover discovery of a scratch tree inside an outer repository and selection of a tracked Unicode filename alongside an untracked test. The fallback prunes .git directories. Untracked files are excluded when the scan uses the Git index.

  • Minor — tests/test_ci_registration.py:134 strips all trailing CR and LF bytes from --show-toplevel. A POSIX checkout whose directory name ends in a carriage return therefore falls back to the walk, which can flag an untracked tests/left_out_test.py as a registration failure. Remove exactly one output LF and strip a preceding CR only on Windows. A POSIX fixture with a CR-ending root and an untracked test would exercise this case.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6101400862 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#pullrequestreview-6101400862). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-29T04:28:59Z. **Review:** COMMENTED --- Static audit of `d47eb1570` in `tests/test_ci_registration.py`. No builds, tests, or GPU runs were performed. The linked worktree’s `.git` file is sufficient for Git to identify its own top level. On Windows, the comparison resolves existing short names and symlink targets before normalizing slash spelling and case, including drive-letter case. The added tests cover discovery of a scratch tree inside an outer repository and selection of a tracked Unicode filename alongside an untracked test. The fallback prunes `.git` directories. Untracked files are excluded when the scan uses the Git index. - **Minor** — `tests/test_ci_registration.py:134` strips all trailing CR and LF bytes from `--show-toplevel`. A POSIX checkout whose directory name ends in a carriage return therefore falls back to the walk, which can flag an untracked `tests/left_out_test.py` as a registration failure. Remove exactly one output LF and strip a preceding CR only on Windows. A POSIX fixture with a CR-ending root and an untracked test would exercise this case. AI-assisted.
fiestorra commented 2026-11-30 06:05:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T06:05:58Z.


Verified on this machine (Windows 11, Python 3.13.14). Additive test coverage, and I want to be precise that it is that - there is no negative control available here, because the new cases test code that this same file introduces.

1. It applies. merge-tree clean; d47eb1570 cherry-picks onto main 0ae217ceb without a conflict. One file, 59 insertions(+), 4 deletions(-) in tests/test_ci_registration.py.

2. With the change:

python3 -m pytest tests/test_ci_registration.py -q   -> 20 passed, 44 subtests

3. On main the same file runs 18 passed, 44 subtests - the two extra cases are the ones the commit adds, and nothing on main fails. So this is new coverage, not a fix: the rule that the registration scan walks a root that is not a repository (and therefore finds nothing to register) had no test before, and now it has two.

Why that is still worth merging: it is the case that produced a false red in CI - a scan rooted at a non-repository returning nothing looks identical to a scan that found every test already registered. A test that pins the distinction is what makes the next person trust the output.

What I did not test: the CI selector itself (the python -I <file> path versus pytest). The two new cases are inside the same file, so they run wherever the file runs; I confirmed the file's pytest path only.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7270302017 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#issuecomment-7270302017). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T06:05:58Z. --- Verified on this machine (Windows 11, Python 3.13.14). **Additive test coverage, and I want to be precise that it is that** - there is no negative control available here, because the new cases test code that this same file introduces. **1. It applies.** `merge-tree` clean; `d47eb1570` cherry-picks onto `main` `0ae217ceb` without a conflict. One file, `59 insertions(+), 4 deletions(-)` in `tests/test_ci_registration.py`. **2. With the change:** ``` python3 -m pytest tests/test_ci_registration.py -q -> 20 passed, 44 subtests ``` **3. On `main` the same file runs 18 passed, 44 subtests** - the two extra cases are the ones the commit adds, and nothing on `main` fails. So this is **new coverage**, not a fix: the rule that the registration scan walks a root that is **not** a repository (and therefore finds nothing to register) had no test before, and now it has two. **Why that is still worth merging:** it is the case that produced a false red in CI - a scan rooted at a non-repository returning nothing looks identical to a scan that found every test already registered. A test that pins the distinction is what makes the next person trust the output. **What I did not test:** the CI selector itself (the `python -I <file>` path versus pytest). The two new cases are inside the same file, so they run wherever the file runs; I confirmed the file's pytest path only. Written with an AI assistant.
KelboLive commented 2026-11-30 17:25:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T17:25:03Z.


Independent check on Windows (not the author), at d47eb1570.

  • python -I tests/test_ci_registration.py: 20 tests OK in 10.6 s, including the outer-repository root case.

Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7286246285 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#issuecomment-7286246285). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T17:25:03Z. --- Independent check on Windows (not the author), at `d47eb1570`. - `python -I tests/test_ci_registration.py`: **20 tests OK** in 10.6 s, including the outer-repository root case. Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10. AI-assisted: yes (opencode).
aslan2142 commented 2026-12-01 11:44:03 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed the diff against main: tests/test_ci_registration.py:120-143 cleanly checks git rev-parse --show-toplevel against root before trusting git ls-files (preventing an outer repo from masking a scratch tree) and decodes raw git output with os.fsdecode, covered by both outer-repo and non-ASCII tests. Clean-room verified. Approving; please merge/rebase current main so CI runs green before merge.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130556567 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#pullrequestreview-6130556567). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:44:03Z. **Review:** APPROVED --- Reviewed the diff against `main`: `tests/test_ci_registration.py:120-143` cleanly checks `git rev-parse --show-toplevel` against `root` before trusting `git ls-files` (preventing an outer repo from masking a scratch tree) and decodes raw `git` output with `os.fsdecode`, covered by both outer-repo and non-ASCII tests. Clean-room verified. Approving; please merge/rebase current `main` so CI runs green before merge. *(AI-assisted review.)*
andrew-ai commented 2026-12-02 00:57:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-02T00:57:36Z.


Checked a Windows checkout created with git init --separate-git-dir, with a non-ASCII working directory and a .git file pointing to separate metadata. At main 4fe371f90 and at the local merge with d47eb1570, tracked_under_tests at the checkout root selected the one staged test and omitted a neighboring untracked test. For a scratch tree inside that same checkout, claimed_test_files returned an empty list on main and exactly tests/test_nested.py after the merge. This reproduces the nested-directory fix while exercising the real repository case where .git is a file. Codex-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7331152208 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#issuecomment-7331152208). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-02T00:57:36Z. --- Checked a Windows checkout created with git init --separate-git-dir, with a non-ASCII working directory and a .git file pointing to separate metadata. At main 4fe371f90 and at the local merge with d47eb1570, tracked_under_tests at the checkout root selected the one staged test and omitted a neighboring untracked test. For a scratch tree inside that same checkout, claimed_test_files returned an empty list on main and exactly tests/test_nested.py after the merge. This reproduces the nested-directory fix while exercising the real repository case where .git is a file. Codex-assisted.
MoonEyes commented 2026-12-02 18:13:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:13:09Z.


Verified #2472 on Linux: 20/20 pass merged onto current main; the nested-repository case is red with main's tracked_under_tests and green with this one.

Head d47eb15704 (unchanged since 27 November)
Merged onto main 45dc41f95c (git merge --no-ff, clean; merge base 39f52f39c4, 2,929 commits behind)
Machine Linux, Python 3.13.18, git present, no game files

Ran

python -I tests/test_ci_registration.py                              Ran 20 tests  OK
python -I scripts/check_no_game_data.py tests/test_ci_registration.py   exit 0

Red/green. Source and test live in the same file, so I replaced only the body of tracked_under_tests with main's version (kept the new tests) and reran:

FAIL: test_a_tree_that_is_not_a_repository_is_walked_even_inside_one
AssertionError: Lists differ: [] != ['tests/test_inside.py']
Ran 20 tests  FAILED (failures=1)

That is the bug the title names: inside an outer repository, git ls-files -- tests succeeds with an empty list and the walk never runs. test_non_ascii_repository_root_uses_tracked_list_not_walk passes on both sides here, as expected on Linux (UTF-8 locale); its red side is the Windows cp1252 decode, which I could not reproduce. KelboLive, fiestorra and andrew-ai report it on Windows.

Review. Comparing realpath/normcase of rev-parse --show-toplevel with the root, and decoding -z output as bytes with os.fsdecode, is the root-cause fix, not a fallback. except (OSError, UnicodeDecodeError) falls through to the walk, which is the safe answer. No defects.

CI. The red check on the head is tests/test_windows_boot_journal_seed.py and macos-python was cancelled, both from a 27 November run on a 2,929-commits-old base; this PR does not touch either. A merge of main into the branch would refresh CI.

Verdict: ready (needs a fresh CI run on a current base; the code needs no change).

AI-assisted: Claude Opus 5.5 (Claude Code), verification only.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354147556 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#issuecomment-7354147556). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:13:09Z. --- **Verified #2472 on Linux: 20/20 pass merged onto current `main`; the nested-repository case is red with `main`'s `tracked_under_tests` and green with this one.** | | | |---|---| | Head | `d47eb15704` (unchanged since 27 November) | | Merged onto | `main` `45dc41f95c` (`git merge --no-ff`, clean; merge base `39f52f39c4`, 2,929 commits behind) | | Machine | Linux, Python 3.13.18, git present, no game files | **Ran** ``` python -I tests/test_ci_registration.py Ran 20 tests OK python -I scripts/check_no_game_data.py tests/test_ci_registration.py exit 0 ``` **Red/green.** Source and test live in the same file, so I replaced only the body of `tracked_under_tests` with `main`'s version (kept the new tests) and reran: ``` FAIL: test_a_tree_that_is_not_a_repository_is_walked_even_inside_one AssertionError: Lists differ: [] != ['tests/test_inside.py'] Ran 20 tests FAILED (failures=1) ``` That is the bug the title names: inside an outer repository, `git ls-files -- tests` succeeds with an empty list and the walk never runs. `test_non_ascii_repository_root_uses_tracked_list_not_walk` passes on both sides here, as expected on Linux (UTF-8 locale); its red side is the Windows cp1252 decode, which I could not reproduce. KelboLive, fiestorra and andrew-ai report it on Windows. **Review.** Comparing `realpath`/`normcase` of `rev-parse --show-toplevel` with the root, and decoding `-z` output as bytes with `os.fsdecode`, is the root-cause fix, not a fallback. `except (OSError, UnicodeDecodeError)` falls through to the walk, which is the safe answer. No defects. **CI.** The red `check` on the head is `tests/test_windows_boot_journal_seed.py` and `macos-python` was cancelled, both from a 27 November run on a 2,929-commits-old base; this PR does not touch either. A merge of `main` into the branch would refresh CI. **Verdict: ready** (needs a fresh CI run on a current base; the code needs no change). AI-assisted: Claude Opus 5.5 (Claude Code), verification only. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 21:54:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:54:24Z.


The check failure here (job 143766686004: BootJournalSeedTest, runneradmin != runner~1) is not from this PR. That job tested refs/pull/2472/merge on base 34e33d3d (27 Nov), which predates d98fc7fb (#2593, merged 29 Nov). That commit makes the boot journal seed test compare long paths on the runner's 8.3 %TEMP%. Merging current main into this branch should turn check green. #3231 adds explicit 8.3 short-path cases for the same test.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359950706 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2472#issuecomment-7359950706). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:54:24Z. --- The `check` failure here (job 143766686004: `BootJournalSeedTest`, `runneradmin` != `runner~1`) is not from this PR. That job tested `refs/pull/2472/merge` on base `34e33d3d` (27 Nov), which predates d98fc7fb (#2593, merged 29 Nov). That commit makes the boot journal seed test compare long paths on the runner's 8.3 `%TEMP%`. Merging current `main` into this branch should turn `check` green. #3231 adds explicit 8.3 short-path cases for the same test. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2472:upstream-pr/2472'
git switch 'upstream-pr/2472'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2472'
git switch 'upstream-pr/2472'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2472'
git switch 'upstream-pr/2472'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2472'
git switch 'main'
git merge --squash 'upstream-pr/2472'
git switch 'main'
git merge --ff-only 'upstream-pr/2472'
git switch 'main'
git merge 'upstream-pr/2472'
git push origin 'main'
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!2472
No description provided.