Skip to content

Fix shared Python lint failures in Unreal engine-region rewriting - #756

Closed
thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/fix-ue-region-lint
Closed

thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/fix-ue-region-lint

Conversation

@thehobbit85

@thehobbit85 thehobbit85 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

This PR is fully superseded by upstream commit 2aae9f8c4e054d2178743a9fbec29075089eddd2, included in fixed main 635e8008d67053214ddd302a0196f5ec971b63ea. It adds the same instruction binding in ue_region.py and the same size-register assertion in patch_nso.py. Both complete files are byte-identical between this PR head and current main. There is no remaining source change to carry forward; closure is recommended. The PR remains open and its branch has not been rebased or rewritten.

Fresh verification of those upstream sources: the pinned Python lint ratchet passes with 392 baseline findings, zero new findings and zero stale entries. The focused UE-region/lint/docs tests are also included in the fresh packing validation recorded on #376; historical tests below retain their original tested revisions.

Historical PR content and validation on earlier revisions

Main still has the two Unreal engine-region lint findings: the operand helper captures the loop instruction, and the observation gate shifts a possibly-optional size-register value. Bind the instruction and assert the detector's size-register invariant, without changing the lint baseline or valid rewrite behavior.

Maintenance pass (2026-10-31, 01:10 UTC): rebased onto fixed main f11018a1f312, producing 39752d582c7f. No conflicts; range-diff confirms the patch is unchanged. #376 also includes the same fix as an author-added prerequisite commit; this standalone PR keeps the correction available independently.

Fresh validation on 39752d582c7f:

  • Native arm64 Python 3.14: python3 -m unittest dm.tools.tests.test_ue_region dm.tools.tests.test_lint_python dm.tools.tests.test_docs — 28 passed.
  • Pinned ruff/pyright ratchet against fixed main: 392 baseline findings, 0 new, 0 stale; baseline unchanged.
  • git diff --check passes. No game-module execution or iPhone validation was performed.

Exact fixed-main f11018a1f312 → 39752d582c7f Z-A shader/interface comparison: PASS on chain d1043b780a74. All 28,603 shaders build in both revisions, with 0 changed MSL, new failures or interface issues. The completed shared cache and current reflection hashing were used; this comparison started no shader translation. Z-A has no smoke route, so this is not gameplay or rewritten-module execution coverage.
The local Z-A build is not Unreal-based; the focused synthetic UE-region tests remain the detector-specific verification.

Fresh exact-base shader/interface report

regress.py check (full): PASS

Baseline f11018a1f3125ec3046c30faae6147956a1a7c60 f11018a, candidate 39752d582c7f24787c9e401e3e2f3be19f79a856 39752d5; Apple M2 Max, macOS 26.6, Xcode 27.0; 85.7 s

game status shaders (base → cand) newly failing newly building changed MSL interface (new / known) boot fps p50 frame p99 ms peak MB prepare s new RED
LegendsZA 0100F43008C44000 PASS 28603/28603 → 28603/28603 0 0 0 0 / 0 – – – – – –

LegendsZA 0100F43008C44000: PASS

  • time: chain 85.4 s
Original investigation, wider tool tests and historical regression results

What and why

lint-python fails on main at 2006d5ed with two findings introduced by the Unreal engine-region detector. The initial audit found the same inherited failures on #221, #376 and #684; their feature changes do not cause either finding.

Bind the current Capstone instruction in the operand helper, and assert the detector supplied a size register before encoding the observation gate. This makes the existing invariants explicit and leaves the lint baseline unchanged. Valid rewrite behavior is unchanged.

This is a standalone fix against main so the unrelated PRs do not have to own the underlying correction. Equivalent fixes reached #221 and #684 concurrently; #376 now includes this fix as a separate prerequisite commit. This standalone PR makes the correction available to main and other contributors.

Checked

  • Reproduced the two failures on main with the pinned tools: ruff 0.17.2 / pyright 1.1.414; 394 findings against 392 baseline findings.
  • After the fix: python3 dm/tools/lint_python.py --against origin/main passes with 392 baseline findings, zero new findings and zero stale entries.
  • All 68 dm/tools/tests/test_*.py files passed (698 tests reported: 682 passed, 16 skipped), including the seven synthetic Unreal engine-region cases and documentation/lint-ratchet tests.
  • git diff --check passed; independent review found no issues.
  • scripts/regress.py impact origin/main..HEAD reports broad rewriter reach. Only Pokémon Legends: Z-A (0100F43008C44000, build v393216) is discoverable locally, so the regression check covered that build. Its profile has no smoke route: the report below checks shaders, not gameplay or rewritten-module execution. No five-game or iPhone validation is claimed. The synthetic tests exercise the detector's Unreal-specific instruction patterns.
  • Device: Apple M2 Max, macOS 26.6, Xcode 27.0.

regress.py check (full): PASS

Baseline 2006d5ed8690d79ef4865a60917eb938cdb4c8dc 2006d5e, candidate worktree 2006d5e (+ uncommitted changes); Apple M2 Max, macOS 26.6, Xcode 27.0; 28.4 s

game status shaders (base → cand) newly failing newly building changed MSL interface (new / known) boot fps p50 frame p99 ms peak MB prepare s new RED
LegendsZA 0100F43008C44000 PASS 28603/28603 → 28603/28603 0 0 0 0 / 0 – – – – – –

LegendsZA 0100F43008C44000: PASS

  • time: chain 28.2 s

Docs

The existing engine-region mechanism remains documented in memory.md. This is an invariant/lint correction, with no new runtime mechanism or shader-chain change. No game files, keys or extracted data are included.

@thehobbit85
thehobbit85 force-pushed the codex/fix-ue-region-lint branch from d1e7f23 to 39752d5 Compare October 31, 2026 01:14
seedds added a commit that referenced this pull request Oct 31, 2026
Bind the current Capstone instruction in the operand helper and assert
that a detected engine-region gate has a size register before encoding it.
These make the existing invariants explicit without changing valid rewrite
behavior or widening the Python lint baseline.

Reviewed PR #756. Focused UE-region, lint-ratchet and docs tests pass
(28 tests); the pinned lint check has 392 baseline findings, zero new
findings and zero stale entries. Regression risk is low: instruction
matching and emitted gate encoding are unchanged, so no game regression
run was needed.

Co-authored-by: Eliran Zach <4012041+thehobbit85@users.noreply.github.com>
@seedds

seedds commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Thanks for isolating these shared lint failures. Closing this PR as superseded by 2aae9f8.

Main contains the instruction binding in ue_region.py and the size-register invariant assertion in patch_nso.py. The PR's latest verification reports both files identical to main, with no remaining source change to merge.

@seedds seedds closed this Oct 31, 2026
@thehobbit85
thehobbit85 deleted the codex/fix-ue-region-lint branch November 1, 2026 04:44
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.

2 participants