Files
mandy/CONTRIBUTING.md
Mouad-Scriptz-0 364754de5c ci: the needs-rebase labeler no longer runs per pull request push (PR-CONFLICT-LABEL-LOAD)
conflict-label.yml (#155) started a run on every push to every pull
request through pull_request_target. On this repository that queued 265
runs within a day, some waiting five hours, in the same runner queue as
CI, No Game Data and Runtime, whose oldest queued run waited six hours.

Drop the pull_request_target trigger and put every run in one
concurrency group. Each run already checks every open pull request, so
a push to main and the hourly schedule cover what the per-PR runs did;
a rebased pull request loses the label within the hour instead of at
once. At most one run waits at a time. The workflow also no longer has a
trigger that hands a fork's pull request a write token.

tests/test_pr_conflict_label.py fails on the old workflow and checks
that no pull request trigger, per-PR group or --pr comes back; the tool's
docstring and CONTRIBUTING.md say what runs it now.
2026-11-24 20:51:58 +00:00

6.6 KiB

Contributing

Thanks for helping. A few rules keep the project safe to host:

  • No game data, ever. That covers archives, the executable, carved files, shaders (DXBC, FSSM, disassembly, SPIR-V), textures, models, audio, videos, and reports or logs that quote them. .gitignore blocks the common types; check git status before you commit anyway.
  • No keys, decryption or protection workarounds, and no links to where to get them. The tools only read files that are already plain on disk.
  • Short excerpts needed to explain a format (a few header bytes, one instruction sequence) are fine in docs and comments.

Before you start

Claim the work in the coordination issue first: the open issue titled "Coordinating who works on what" (it moves to a new issue when the thread gets long, so the link searches for it). Check its tables and the open pull requests, post claiming: <ID> there (or a one-line description for something not listed yet), and put the ID in your pull request. When the pull request is open, post done: <ID> -> #<PR> there. Found something that needs doing but won't do it yourself? Post finding: <one line> there, with where it is and why it matters, and it goes on the list for others. When two pull requests overlap anyway, the one that lands first is merged and the other is asked to rebase or close. Pull requests target main.

The original repository (ItsNotRexed/Leonida) went private on 23 November 2026, and its issues and pull requests went with it. A #N in the docs, in a code comment or in a commit message from before that date is an old number and links nowhere now, including the two this page used to send you to: #166 (GPU test results) and #313 (the D3D12 → Vulkan page).

  • The titles of the issues that were open there are indexed in #18. To carry one on, open it again here and link the index.
  • The pull requests that were open there are kept as old-pr/<old number> branches, listed in #17. To carry one on, rebase it on main, keep its author's commits and open a pull request here.
  • A GPU test result is a pull request that adds a file to gpu-test-results/ in the format of the files there; docs/testing.md has how to run the tests.
  • The plan and status of the D3D12 → Vulkan layer are in docs/d3d12_vulkan.md.

Working on the code

  • Python tools run with python -I and use only the standard library unless a file says otherwise.
  • A text file a tool writes (JSON, CSV, a manifest, an assembly listing) names its line ending: open(path, "w", encoding="utf-8", newline="\n") (the same for Path.open, Path.write_text and a text-mode tempfile.NamedTemporaryFile), so the output is LF on Windows too and the same input gives the same bytes on every platform. tests/test_text_write_line_endings.py fails for a writer that forgets it.
  • A report writer refuses an output that names one of its inputs or another output, and asks tools/report_paths.same_report_path(a, b) rather than deriving the answer again: it resolves both paths, applies the volume's case rules and falls back to os.path.samefile, so a new tool reuses one answer instead of a private copy. tests/test_report_paths.py covers it.
  • tools/rpf9dump needs the submodule: git submodule update --init.
  • A new shader-translator rule goes into the contract table in docs/design.md, with how it was confirmed: a GPU test, a Mesa/LLVM reference, or a count over the corpus.
  • python -I tests/test_<name>.py runs one of the unit tests (standard library only; CI runs them all). The test files with no __main__ block or an import pytest (they need the packages in tests/requirements.txt) run with python -m pytest tests/test_<name>.py instead, as AGENTS.md describes; under python -I they fail to import or run nothing.
  • Runtime tests: cmake -S runtime -B runtime/build, cmake --build runtime/build --config RelWithDebInfo, then ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure. The CPU tests that need no game data are configured on Windows; Linux and macOS configure the portable subset (gta6rt and the shims are Windows-only). Tests that need the retail package read LEONIDA_GAME_DIR (and LEONIDA_MOVIE for the Bink decode test) in place and print SKIP when the variable is unset; never copy or commit those files.
  • Viewer streaming tests: node --test tests/test_viewer_streaming.cjs (Node.js 22+, CI tests 24 LTS; no packages, browser, network or game data). These execute the viewer streaming code with a synthetic loader and clock.
  • loader_test writes small PE images to a leonida_loader_test folder in %TEMP%. Antivirus that blocks newly written executables makes it stop with that reason; exclude the folder or set LEONIDA_TEST_DIR to one it skips.
  • Tool checks: python -m compileall -q make_game.py tools tests. The optional vk_pipeline_check <spirv dir> [cache.bin] [--jobs N] creates a module (and, for compute shaders, a pipeline) for every translated shader and reports failures plus the saved cache path.
  • GPU tests are small hand-written RDNA2 programs in runtime/test/shaders. build.py turns them into SPIR-V using llvm-mc with the AMDGPU target (LLVM 21+). check.py runs them on your GPU and compares the results. A new test gets its expected values in the comment at its top and a check in check.py. docs/testing.md covers setup per OS, including native Windows options, and known problems.
  • Say what you tested and on which GPU in the pull request.
  • Run the translator tests with python -I scripts/run_semantic_tests.py tests/semantic (see tests/semantic/README.md). A new translator rule should come with a small hand-written .asm fixture and its expected output words.

Pull requests

  • One topic per pull request, based on current main. Follow-up work goes in a new pull request, not into an open one.
  • Fill in the template: the claim, Depends on:, Fixes: #N for an issue it closes, what you tested, GPUs tested: (vendor, model, driver and OS) and whether it was AI-assisted.
  • A pull request that conflicts with main is labeled needs rebase (tools/pr_conflict_label.py, run on every push to main and hourly). Rebase it on main yourself; the label goes within the hour once it merges cleanly. Reviews start with the pull requests that do.