fix(apr): resolve marked backing files for missing guest paths #1764

Closed
github-bot wants to merge 1 commit from gh-pr/1764/head into gh-pr/1764/base
Owner

@⁠SilentBless on GitHub · 2026-10-20 15:52 UTC · original
SilentBless:fix/apr-marker-path-resolution → main · +73 −1 · 3 files · 1 commits · closed without merging

Summary

  • Prefer the exact APR guest path, then try regular backing files with .sndr and .emf suffixes.
  • Keep the resolved backing path in the APR file ID so size, stat and queued reads use the same file.
  • Cover marker precedence, directory rejection and queued reads; add a headless --apr-only regression mode.

Related to #1540. This only addresses APR path resolution; ordinary directory listings and the separate exit/logging problems are unchanged. It does not claim that the affected game boots.

Verification

  • Reproduced missing marker resolution before the fix.
  • Built kernel_file_system_tests on macOS x86_64/Rosetta; --apr-only passes.
  • Checked changed C++ blocks with the pinned clang-format 22.1.3.
  • cubic review --json completed with no findings, without an additional prompt. Repository-specific cubic settings/learnings were unavailable (Repository not found).

The complete filesystem executable stops before APR at mutex lock defers cancellation until explicit cancellation point on this host; the full suite is not reported as passing.

**@⁠SilentBless** on GitHub · 2026-10-20 15:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1764) `SilentBless:fix/apr-marker-path-resolution` → `main` · +73 −1 · 3 files · 1 commits · closed without merging ## Summary - Prefer the exact APR guest path, then try regular backing files with `.sndr` and `.emf` suffixes. - Keep the resolved backing path in the APR file ID so size, stat and queued reads use the same file. - Cover marker precedence, directory rejection and queued reads; add a headless `--apr-only` regression mode. Related to #1540. This only addresses APR path resolution; ordinary directory listings and the separate exit/logging problems are unchanged. It does not claim that the affected game boots. ## Verification - Reproduced missing marker resolution before the fix. - Built `kernel_file_system_tests` on macOS x86_64/Rosetta; `--apr-only` passes. - Checked changed C++ blocks with the pinned clang-format 22.1.3. - `cubic review --json` completed with no findings, without an additional prompt. Repository-specific cubic settings/learnings were unavailable (`Repository not found`). The complete filesystem executable stops before APR at `mutex lock defers cancellation until explicit cancellation point` on this host; the full suite is not reported as passing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:05:07 +00:00
github-bot closed this pull request 2026-11-26 10:05:07 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 15:56 UTC · original

Review in Change Stack →

📝 Walkthrough

ResolveOnePath now checks .sndr and .emf backing-file candidates when an exact path is missing. APR tests verify resolution, precedence, rejection cases, metadata, and cached IDs. The test executable adds an APR-only mode, with macOS build and run instructions in the README.

Suggested reviewers: chenxiao07, nmzik, pipe530

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: 🔵 Low · up to 15dcf

APR suffix resolution works for the main case. A stale cached suffix file is possible if an exact file appears after the first lookup. The precedence test should be strengthened so it can catch a wrong selection. Neither point is likely to block merge, but both are worth addressing.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description accurately summarizes APR backing-file resolution, precedence, tests, verification, and known scope limits.
Title check Passed The title is concise and clearly identifies the main change: resolving marked backing files for missing APR guest paths.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 15:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1764#issuecomment-6295146729) <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1764?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> `ResolveOnePath` now checks `.sndr` and `.emf` backing-file candidates when an exact path is missing. APR tests verify resolution, precedence, rejection cases, metadata, and cached IDs. The test executable adds an APR-only mode, with macOS build and run instructions in the README. **Suggested reviewers:** `chenxiao07`, `nmzik`, `pipe530` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"15dcf315c4f3ebf494a185d02be135e4b4a533de" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>🔵 Low</strong> · up to <code>15dcf</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🔵 Low** · up to `15dcf` --> <!-- final_review_risk_coverage:{"sourceCommitId":"15dcf315c4f3ebf494a185d02be135e4b4a533de","coveredCommitId":"15dcf315c4f3ebf494a185d02be135e4b4a533de","kind":"reviewed"} --> APR suffix resolution works for the main case. A stale cached suffix file is possible if an exact file appears after the first lookup. The precedence test should be strengthened so it can catch a wrong selection. Neither point is likely to block merge, but both are worth addressing. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 warning</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------- | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description accurately summarizes APR backing-file resolution, precedence, tests, verification, and known scope limits. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title is concise and clearly identifies the main change: resolving marked backing files for missing APR guest paths. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.) **Resolution** Write docstrings for the functions missing them to satisfy the coverage threshold. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1764)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -218,0 +222,4 @@
if (Common::File::IsFileExisting(candidate)) {
info.host_path = std::move(candidate);
info.file_size = Common::File::Size(info.host_path);
info.result = OK;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 15:56 UTC · original

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Invalidate a suffix resolution when an exact file becomes available.

If an exact file appears after this fallback succeeds, g_resolved_paths retains the OK suffix result. InvalidateFailedResolves() does not remove it. Later resolves return the suffixed file ID, and queued reads continue to use the suffixed file instead of the exact file. Recheck exact-path precedence when the filesystem or mounts change, or invalidate successful fallback entries at that point.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 15:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1764#discussion_r4327138556) **🗄️ Data Integrity & Integration** | **🟠 Major** | **🏗️ Heavy lift** **Invalidate a suffix resolution when an exact file becomes available.** If an exact file appears after this fallback succeeds, `g_resolved_paths` retains the `OK` suffix result. `InvalidateFailedResolves()` does not remove it. Later resolves return the suffixed file ID, and queued reads continue to use the suffixed file instead of the exact file. Recheck exact-path precedence when the filesystem or mounts change, or invalidate successful fallback entries at that point. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:65e57e7351d707534f1e2db6 --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -1732,0 +1738,4 @@
create_marker_file("content.pak.emf", "wrong container");
create_marker_file("engine.ucas.emf", "engine");
create_marker_file("exact.pak", "exact");
create_marker_file("exact.pak.sndr", "wrong");
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 15:56 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the exact-path precedence fixture distinguishable.

exact.pak contains "exact" and exact.pak.sndr contains "wrong". Both are five bytes. If APR incorrectly selects the suffixed file, the marked_sizes[2] == 5 assertion still passes. Give the suffixed file a different size or read the resolved ID and check its contents. The PR identifies exact-path precedence as required behavior. (github.com)

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 15:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1764#discussion_r4327138566) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Make the exact-path precedence fixture distinguishable.** `exact.pak` contains `"exact"` and `exact.pak.sndr` contains `"wrong"`. Both are five bytes. If APR incorrectly selects the suffixed file, the `marked_sizes[2] == 5` assertion still passes. Give the suffixed file a different size or read the resolved ID and check its contents. The PR identifies exact-path precedence as required behavior. ([github.com](https://git.gtahub.st/github/KytyPS5--KytyPS5/pulls/1764)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:1d2b349a6f5dd24b34cf5a74 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 15:56 UTC · original · reviewed

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 395d6c82-34ed-405b-b9e2-9c80023931dc
📥 Commits

Reviewing files that changed from the base of the PR and between 7b7f9a70c6 and 15dcf315c4.

📒 Files selected for processing: 3
  • README.md
  • src/libs/libAmpr.cpp
  • tests/KernelFileSystemTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 15:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1764#pullrequestreview-5587815670) · **reviewed** **Actionable comments posted: 2** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `395d6c82-34ed-405b-b9e2-9c80023931dc` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 7b7f9a70c652afd6ec8ea8599884d9b4b3abc9f3 and 15dcf315c4f3ebf494a185d02be135e4b4a533de. </details> <details> <summary>📒 Files selected for processing: 3</summary> * `README.md` * `src/libs/libAmpr.cpp` * `tests/KernelFileSystemTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=65dc510c-7e79-4872-ad7f-b6328eafe75a attempt=3c371ed1-d40b-47c5-b71b-40ed313ec565 batch=1/1 -->

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.