Skip to content

feat(relinker): validate conversions without writing outputs - #13926

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
dr-hoseyn:feat/relinker-dry-run
Nov 1, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
dr-hoseyn:feat/relinker-dry-run

Conversation

@dr-hoseyn

Copy link
Copy Markdown
Contributor

What

Add --dry-run to validate a full conversion in memory and list its planned outputs before creating artifacts. For example, relinker --dry-run --windows --registry input.elf output.exe converts the executable and bundled modules, analyzes imports and applies/verifies byte patches, then reports the executable, module and sidecar destinations without writing them.

The same path also handles additional executables, patch manifests, Windows diagnostics and Linux desktop metadata. It preserves existing files and permissions, rejects --autorun and --verify-patches, and keeps normal conversion error codes. Read-only input/output collision checks still run; temporary filesystem alias probes are skipped. Help, documentation and the final message state that destination write access and aliases of absent files are not validated.

Tested

Windows 11 (10.0.26340), MinGW-w64 GCC 15.2.0, Python 3.10.10; synthetic ELF fixtures, no retail-title or console execution.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

At head b2343e91ec74f477a317a017f6f125ebbced282f, dry-run converts in memory, reports its planned outputs, and returns before the write path; the added fixtures check filesystem contents, permissions, and modification times.

What I ran

Reviewed head b2343e91ec74f477a317a017f6f125ebbced282f against base cd087bd12c258cf6dbb82e203bafd20d9fe2596c; GitHub reports it mergeable. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build or run the C++/relinker tests locally.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13926
git diff --check cd087bd12c258cf6dbb82e203bafd20d9fe2596c...b2343e91ec74f477a317a017f6f125ebbced282f
python3 tools/check_test_registration.py --scripts
python3 tools/pr_test_quality.py --root /marc/AnyPS5 --json core/relinker/cli/tests/CliArgsTests.cpp core/relinker/relinker/tests/test_dry_run.py

Results

Check Result
Diff and conventions Passed
Python syntax and test registration Passed; 231 test scripts registered
Test-quality heuristic Its possible-unregistered-test warning for CliArgsTests.cpp is a false positive; the target is registered in CMake
Relinker-only build and 217 relinker tests The author reports these passed on Windows 11/GCC 15.2.0 after rebasing on this base; I did not run them
Hosted CI Eligibility, conventions, intake, labels and relinker ASAN passed; Ubuntu and Windows relinker jobs were running, macOS jobs queued; the unrelated full Linux/Windows jobs were skipped
Raw local output
All conventions checks passed.
231 test script(s), each run by an add_test or a workflow

git diff --check produced no output. The precheck report is at /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13926-b2343e91ec74/report.md; its test-quality helper could not run from the isolated PR checkout because that helper is not part of the PR. The local helper reported only the registration heuristic noted above, which I checked against CMake.

Sources

Not verified

I did not independently run the relinker tests or verify behavior on macOS. Hosted Ubuntu and Windows relinker jobs had not completed at the last status refresh.

@blawesom

Copy link
Copy Markdown
Contributor

Independent verification at head b2343e91ec74f477a317a017f6f125ebbced282f (Linux; CachyOS, kernel 7.2.10, GCC 16.2.1, Ninja 1.13.2, Ryzen 7 9800X3D).

What I checked

  • Reviewed the diff: --dry-run converts in memory and returns in Run() before any write path (core/relinker/main.cpp), so artifacts, sidecars, diagnostics and metadata are not written. Output-collision checks still run, with the filesystem-alias probe disabled via the probeAliases parameter; --dry-run is rejected with --verify-patches (added to kVerifyRejectedOptions) and conflicts with --autorun. Help/USAGE.md state the write-access/alias limitations. Generic behavior, no title-specific logic, no code comments.
  • Built relinker-only (Release, BUILD_TESTING=ON, -DANYPS5_RELINKER_ONLY=ON); build succeeded.

Test runs

Run Command Result
Focused dry-run + CLI tests, 3x repeats ctest -R 'dry_run|^cli_args$|^cli_help$' 7/7 passed, each of 3 repeats
Dry-run tests after negative control ctest -R '^dry_run_(formats|modules|failures)$' formats/modules failed as expected (see below), failures group still passed since it exercises error paths
Full relinker-only suite ctest (all) 544/544 passed
Relinker tests ctest -R relinker 3/3 passed
Conventions python3 tools/check_conventions.py --base origin/main Passed

Negative control

Removed the if (args.dryRun) guard around the early return in core/relinker/main.cpp (leaving the write path active), rebuilt: dry_run_formats and dry_run_modules failed consistently across 3 runs (snapshot assertions detect written outputs). Restored the file, rebuilt: all 4 dry_run_* tests pass again. No edits left behind.

Limitation

No GPU environment was used; not applicable to a relinker CLI change.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/relinker/CMakeLists.txt
docs/user/USAGE.md
PR 5925 docs/user/USAGE.md
PR 6924 docs/user/USAGE.md
PR 7642 docs/user/USAGE.md
PR 9345 docs/user/USAGE.md
PR 9508 docs/user/USAGE.md
PR 9793 core/relinker/CMakeLists.txt
core/relinker/main.cpp
PR 10861 core/relinker/CMakeLists.txt
docs/user/USAGE.md
PR 11628 core/relinker/CMakeLists.txt
PR 11661 core/relinker/CMakeLists.txt
PR 11689 core/relinker/CMakeLists.txt
PR 11698 core/relinker/CMakeLists.txt
PR 12678 core/relinker/CMakeLists.txt
core/relinker/cli/include/Cli.hpp
core/relinker/cli/src/CliArgs.cpp
core/relinker/cli/tests/CliArgsTests.cpp
core/relinker/main.cpp
docs/user/USAGE.md
PR 12746 docs/user/USAGE.md
PR 12863 docs/user/USAGE.md
PR 13801 docs/user/USAGE.md
PR 14107 core/relinker/CMakeLists.txt

@adriadam10 adriadam10 self-assigned this Nov 1, 2026
@adriadam10
adriadam10 merged commit e67cc81 into boykopovar:main Nov 1, 2026
13 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked that --dry-run returns in Run() before any write, the collision checks still run (alias probe skipped), --autorun/--verify-patches are rejected, the CLI tests and the four dry_run_* snapshot tests pin it, and the relinker jobs are green on this head; merged.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants