refactor(kernel-platforms): fs promises-only - #1055
Draft
ci-belphegor wants to merge 1 commit into
Draft
Conversation
Remove `existsSync` from the fs capability, its config field, and the synchronous operation wrapper it was the only user of. Narrowed methods always forward through `E()` and every derived guard is `M.callWhen`, so a synchronous method cannot survive narrowing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ci-belphegor
force-pushed
the
grypez/narrowing-9a-fs-promises-only
branch
from
September 11, 2026 11:42
37cd194 to
99c774c
Compare
ci-belphegor
added this pull request to stack #1060
September 11, 2026 11:44
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.
Explanation
Removes
existsSyncand all synchronous operation from thefsplatform capability: theFsCapabilitymember, thefsConfigStructfield,makeCaveatedSyncFsOperation, and the node and browser sync variants.Why: narrowed methods always forward through
E()and every derived guard isM.callWhen, so a synchronous method cannot survive narrowing. Going promises-only is a precondition for vendingfsas a narrowable exo in the next two PRs.makeNoSymlinksCaveatand itslstatSyncare untouched — patterns cannot see the filesystem, so anti-aliasing stays in the base implementation and narrowings inherit it by forwarding.Deletion-dominated: +8 / −189.
Notes for reviewers
This is the first of a three-PR chain (9a → 9b → 9c) intended to squash to a single commit on
main, so thatmainsees one breaking change to@metamask/kernel-platformsrather than three. Intermediate states never ship. The changelog entry therefore lands only in 9c — its absence here is deliberate, not an oversight.One migration the plan for this work had claimed was unnecessary.
packages/ocap-kernel/src/types.test.tspassedplatformConfig: { fs: { rootDir: '/tmp', existsSync: true } }and assertedisVatConfigreturnstrue. SincefsConfigStructis asuperstructobject(), it rejects unknown keys, so removing the field would have silently flipped that assertion tofalse. Now usespromises: { readFile: true }so the case still exercises a populated fs config.SyncPathCaveatis kept — it does not become unreferenced, because the caveats themselves stay synchronous even though the operations do not.Breaking for
@metamask/kernel-platforms, intentionally and with no compatibility shim.Stack
PR 9 of 12. Base: #1054.