Skip to content

feat(tools): inspect SELF header metadata without conversion - #13302

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
StoneDC:b42/self-inspect
Oct 30, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
StoneDC:b42/self-inspect

Conversation

@StoneDC

@StoneDC StoneDC commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

What

Adds inspect_self.py to report SELF record metadata and original inner ELF program headers as JSON without unwrapping or writing an output ELF.

Implementation basis: Uses unwrap_self's existing record/ELF parsers, minimum header area and recognized magic values. A constructed ELF64/SELF fixture fixes offsets and sizes independently, includes an intentionally stale original ELF offset, and verifies read-only behavior and clean malformed-input errors.

Known limits: Metadata inspection is not conversion validation, segment placement, decryption, entropy checking or an execution check. Original ELF offsets can be stale inside SELF. JSON consumers must preserve integer precision for ELF64 addresses and offsets. The parser's existing scope and limits remain.

Source/schema: tools/inspect_self.py tools/unwrap_self.py

Exact topic head ab1efd11f8ecb739a43cb3965ee8e96a8efdcf1c is one independent commit on main 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9. The current-main repository overlap checker against 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9 reported no confirmed overlap. It could not finish comparisons for these older PRs already conflicting with main: #674, #1835, #3786, #5021, #7642, #9539, #10897, #12862. Their shared-file diffs were reviewed separately. 7 scoped file changes projected onto main and then combined with this topic without a new conflict; 1 peer file changes already conflict with main and are not claimed automatically mergeable. They do not provide this command or test matrix. Registration uses a separate target/name and there is no landing-order dependency. Changes to shared registration before landing need a refreshed merge/test check. Depends on: none. The twenty current topic heads are also merged into tested integration cedab5157a32822332671c90812c6780d05157e8.

Tested

Topic head: ab1efd11f8ecb739a43cb3965ee8e96a8efdcf1c. Combined integration: cedab5157a32822332671c90812c6780d05157e8, based on main 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9. Ubuntu/WSL GCC 15.2, CMake 4.2.3, Python 3.14.4; Windows MinGW GCC 15.2, CMake 4.3.1, Python 3.14.3.

python tools/tests/test_inspect_self.py: 2 tests passed on each platform, no skips. A mutation in the actual new tool was rejected by the fixture.

Registered CTest tools_self_inspect passed on Linux and Windows as part of the filtered twenty-topic run: ctest --test-dir <build> -R <20-topic-pattern> -j 8 -V --output-on-failure, 20/20 passed on each platform, zero skips. cmake --build <linux-full-build> --parallel 8: complete default Linux product build passed. Windows used the full configuration and built the sixteen affected libc test targets plus relinker with --parallel 8; a complete default Windows build is not claimed. Conventions, whitespace, script registration and the public-header declaration/umbrella audit passed. No PS5, title or GPU validation run is claimed. macOS, WASM execution and hosted full-build CI are not reported as passed.

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

The exact-head SELF inspector is read-only, reuses the existing parser, reports the documented metadata limits, and its focused tests pass.

What I ran

  • Reviewed head ab1efd11f8ecb739a43cb3965ee8e96a8efdcf1c against current main 42d009f5f37c8f388b01fbfe38d2e704c792c46f.
  • Merge preview was clean: tree c6c18c213719d66d080333cd8c5b8d24f5626933.
  • Environment: Debian Linux, Python 3.11.2. The test ran in an isolated detached worktree at the PR head. I did not build or configure AnyPS5.
  • Commands:
git merge-tree --write-tree 42d009f5f37c8f388b01fbfe38d2e704c792c46f ab1efd11f8ecb739a43cb3965ee8e96a8efdcf1c
python3 -m unittest tools.tests.test_inspect_self
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13302

Results

Check Result
Merge preview Pass; clean tree c6c18c213719d66d080333cd8c5b8d24f5626933.
Focused Python tests Pass; 2 tests.
Precheck Syntax, unit tests, Python test registration, conventions, diff check, and live mergeability passed. Its test-quality heuristic could not run because tools/pr_test_quality.py is absent from the isolated PR snapshot.
Hosted checks Labels, conventions, eligibility, and intake were queued at the last snapshot; I did not treat them as passed.
Unedited test output
..
----------------------------------------------------------------------
Ran 2 tests in 0.231s

OK

Findings

Blocking

None found in the reviewed head.

Non-blocking

The PR’s reported CTest registration was statically checked by the precheck, but I did not configure CMake or run CTest. The author-reported integration build and mutation control were not independently reproduced.

Sources

Not verified

I did not configure or build the CMake project, run CTest, or independently reproduce the reported mutation control.

@github-actions

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 674 CMakeLists.txt
PR 1835 CMakeLists.txt
PR 3786 CMakeLists.txt
PR 5021 CMakeLists.txt
PR 7642 CMakeLists.txt
PR 9539 CMakeLists.txt
PR 10897 CMakeLists.txt
PR 12862 CMakeLists.txt

@adriadam10 adriadam10 self-assigned this Oct 30, 2026
@adriadam10
adriadam10 merged commit 842789a into boykopovar:main Oct 30, 2026
13 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked that the imported helpers exist in unwrap_self.py, the fixture test pins exact record and program-header values plus clean rc 2 errors on malformed input, and it is registered in ctest (tools_self_inspect); conventions, relinker and Windows CI green, MarcZX10's approval on the same head; merged.

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