Skip to content

bugfix(filesystem): Fix existing files being reported as missing after they are created again - #3473

Draft
tintinhamans wants to merge 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/file-exist-cache-wrap
Draft

tintinhamans wants to merge 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/file-exist-cache-wrap

Conversation

@tintinhamans

Copy link
Copy Markdown

Creating a file that the existence cache already knows about marks it as missing. doesFileExist then says no for it until the game is closed, even though the file is on disk.

FileInstance is an UnsignedByte, so ~FileInstance(0) is the int -1. The unset instanceDoesNotExist of 255 never equals that, so it gets incremented anyway and wraps to 0.

I ran into this while reloading game data in one process. The map preview gets copied to MapPreviews a second time and then draws as the missing texture.

On main the map transfer can run into it. ConnectionManager::processFile asks if the file exists and then creates it, so receiving a file you already have marks it as missing. GameLogic::loadMapINI then skips that map's map.ini, solo.ini and map.str.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5b5e8261-28fc-44fb-ba0a-b28ddba8e23e

📥 Commits

Reviewing files that changed from the base of the PR and between f746af7 and 0e1e242.


📒 Files selected for processing (1)
  • Core/GameEngine/Source/Common/System/FileSystem.cpp

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



Walkthrough

The file-existence cache’s maximum-value check now casts the complemented FileInstance value back to FileInstance before comparison.

Changes

File-existence cache

Layer / File(s) Summary
Update sentinel comparison
Core/GameEngine/Source/Common/System/FileSystem.cpp
The sentinel comparison casts the complemented FileInstance value back to FileInstance.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: bobtista

Merge Risk: ⚪ Minimal · up to 0e1e2

The cache now preserves the missing-file sentinel when an existing file is recreated, avoiding the reported false-missing result. No actionable merge-blocking risk remains.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check Passed The description clearly explains the filesystem cache bug, its cause, and the affected workflows. It directly relates to the changeset.
Title check Passed The title clearly and concisely identifies the filesystem bug: existing files are reported as missing after they are created again.
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.

  • 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.

@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; the cast fixes the missing-file marker comparison.

Summary

Fixes the file-existence cache when an existing file is created again.

  • Opening a known file no longer marks it as missing.

Reviews (1) · Last reviewed commit: "bugfix(filesystem): Fix existing files b..." · Reviewed by Greptile

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I will put a block on this because I also have a big pending filesystem change coming up which also touches many things here.

@tintinhamans
tintinhamans marked this pull request as draft October 11, 2026 15:15
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