Skip to content

tests: rebase_check reports conflict markers and unclosed CMake blocks - #8316

Open
Skyloq wants to merge 1 commit into
ItsNotRexed:mainfrom
Skyloq:test/rebase-check
Open

Skyloq wants to merge 1 commit into
ItsNotRexed:mainfrom
Skyloq:test/rebase-check

Conversation

@Skyloq

@Skyloq Skyloq commented Nov 23, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: #8186 (comment) (new test item, no ID assigned yet)

Rebased on main@47428cc22 (2,267 tracked files checked, clean).

What and why

Two shapes come out of a hand-resolved rebase and are cheap to commit and expensive to notice:

  1. A conflict marker block kept as is. The file still parses, so nothing fails until a reader sees it.
  2. A CMake block keyword whose ender was consumed by the other side. Resolving runtime/CMakeLists.txt by keeping both sides while the conflict sat inside an if() gives the merged file one endif() short: it still parses, and CMake only fails later at configure time, naming the wrong line.

The second one happened today: rebasing #4348 onto main@dde82f27e, the PR's two-line dstorage test block was appended after main's 44 test-registration lines, so its endif() closed if(BUILD_TESTING) and left that block open. Koro4e hit the same trap in the same hour.

tools/rebase_check.py reads the tracked files (or only those changed against --base), reports committed conflict marker blocks with both ends, and walks every CMakeLists.txt and *.cmake for if/foreach/function/macro/while/block without their ender, plus orphan enders. Comments and quoted arguments are ignored. Exit 0 clean, 1 findings, 2 unreadable. No existing test covers either shape: test_build_runtime_cmake.py checks the source list against the build script and the test_docs_* family checks pages.

Tested

python -I tools/rebase_check.py            # 2,267 files checked, clean on main@47428cc22
python -I tools/rebase_check.py --root <broken> --no-git
  runtime/CMakeLists.txt:445: 'if(' at line 445: unclosed, needs endif(
python -I tests/test_rebase_check.py       # 15 tests, OK
python -m compileall -q tools/rebase_check.py tests/test_rebase_check.py   # OK

<broken> is the merge that lost the endif() (that CMakeLists.txt copied to a temporary folder), so the exact regression is reproduced rather than described.

The repository's own checks that are red today on main@47428cc22 fail identically here, and none of them names a file this PR adds:

  • test_tool_stdout_encoding.py: 11 tools without the stdout guard (this one sets it);
  • test_docs_cli_flags.py: docs/embedded_shaders.md:372;
  • test_docs_design_rows, test_docs_links: same two failures with and without this branch checked out.

No GPU and no game files were involved.

AI-assisted: yes (Claude Code, following AGENTS.md)

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md — not applicable, no translator change.

A hand-resolved rebase leaves two shapes that are cheap to commit and expensive to notice: a conflict marker block
kept as is, and a CMake block keyword whose ender was consumed by the other side. The second one produced an
unclosed `if(BUILD_TESTING)` in runtime/CMakeLists.txt today while rebasing ItsNotRexed#4348 onto main, and the file only
fails later at CMake configure time, naming the wrong line.

tools/rebase_check.py reads the tracked files (or the files changed against --base), reports committed conflict
marker blocks with both ends, and walks every CMakeLists.txt and *.cmake for if/foreach/function/macro/while/block
without their ender, plus orphan enders. Comments and quoted arguments are ignored. Exit 0 clean, 1 findings,
2 unreadable; --json for machines, --no-git to walk a tree without git.

tests/test_rebase_check.py has 15 tests over fixtures written to a temporary folder, including the exact shape that
lost the endif() and the Markdown `=======` underline that must not read as a conflict.

On main: 2,265 files checked, clean. Against the merge that lost the endif():
runtime/CMakeLists.txt:445: 'if(' at line 445: unclosed, needs endif(

Claimed in the coordination issue: ItsNotRexed#8186 (comment)

No game data. Standard library only.
@morodirule

Copy link
Copy Markdown

Tested 96c2bdc on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. New tests/test_rebase_check.py 15/15 OK (tool absent at base, so tests are load-bearing by construction; verified the import fails without it). No game files. AI-assisted.

@morodirule

Copy link
Copy Markdown

Tested 96c2bdc on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. New tests/test_rebase_check.py 15/15 OK (tool absent at base by construction; verified the suite errors on import without it). No game files. AI-assisted.

@Skyloq

Skyloq commented Nov 23, 2026

Copy link
Copy Markdown
Author

CI does not start on this branch, and it is not the branch. The CI workflow run for 96c2bdcb4 is completed / action_required, with 0 check runs: GitHub holds the run for a first-time contributor until a maintainer approves it. The same holds for other first-time branches in the queue right now (fix/test-streaming-and-line-endings at f4a5d00b2 is action_required too), so this is repo-wide, not specific to this PR. @ItsNotRexed @KoertLichtendonk, approving the run is all it needs.

Meanwhile, the check job was run by hand, exactly as ci.yml writes it (every tests/test_*.py with a __main__ block, excluding tests/semantic, failing on the first non-zero):

333 files run, 30 failed
the same 30 files fail on unmodified main@47428cc22 (same loop, same machine)

The failing set is byte-identical with and without this branch, so the PR adds no failure: test_bink_index, test_bink_names, test_build_batch_launch, test_bvh_slot_check, test_docs_cli_flags, test_docs_design_rows, test_docs_links, test_f64_conversion, test_f64_output_modifiers, test_first_look_paths, test_first_look_shim_report, test_gamedata_blobs, test_guest_scene_reference, test_joaat_agreement, test_make_game_* (11 files), test_mc_command, test_missing_input_exit_codes, test_opus_tags, test_psocache_extract, test_report_source_collision, test_runtime_paths.

They look environmental rather than logic: this machine has no dotnet and no LLVM tools, and third_party/rpf9-explorer was a submodule checkout rather than a full remote one. That is a hypothesis, not a measurement; the CI job on a stock runner is what settles it, which is why the approval matters.

The one file this PR adds passes on both: python -I tests/test_rebase_check.py → 15 tests, OK.

agent: yes

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 96c2bdcb on Windows Server 2022, CPython 3.13.12 / Node 24: pass

  • python -I tests/test_rebase_check.py -> OK

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants