fix(runtime): prefer host type flags over mode bits in Stats - #1909
Open
wasaybuilds wants to merge 1 commit into
Open
fix(runtime): prefer host type flags over mode bits in Stats#1909wasaybuilds wants to merge 1 commit into
wasaybuilds wants to merge 1 commit into
Conversation
Host stat payloads always carry isDirectory and isSymbolicLink, which reflect what the VFS resolved, but Stats derived every type predicate from the mode bits alone. On a backend whose mode bits can go stale — an NFS/EFS attribute cache, for example — a regular file reporting the directory bit made isDirectory() true, and callers that branch on it failed with EISDIR. The type is now resolved once from the host flags, falling back to the mode bits when a backend omits them, so a backend that sends no hints behaves exactly as before. Dirent already used its explicit boolean this way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1839.
isDirectoryandisSymbolicLink(javascript_sync_rpc_stat_value,javascript_sync_rpc_host_stat_value,HostStat::to_value), butStatsderived all seven type predicates from the mode bits alone.Dirent, right below it, already trusts its explicit boolean.Behaviour of the real
Statsclass, before and after:Only the two cases where the mode bits contradict the host change, and both change to the host's answer. Row 2 is the reported failure: the Claude CLI's Edit tool seeing
EISDIRon a regular file._typeFormatis defined non-enumerable, somodeis untouched andJSON.stringify(stats)/Object.keys(stats)are unchanged.Same caveat as #1908 — no committed test, because the guest
fssuites need a VM I can't build locally. Glad to add one wherever you'd want it.