Skip to content

refactor(kernel-platforms): fs promises-only - #1055

Draft
ci-belphegor wants to merge 1 commit into
grypez/narrowing-8-default-guardedfrom
grypez/narrowing-9a-fs-promises-only
Draft

refactor(kernel-platforms): fs promises-only#1055
ci-belphegor wants to merge 1 commit into
grypez/narrowing-8-default-guardedfrom
grypez/narrowing-9a-fs-promises-only

Conversation

@ci-belphegor

Copy link
Copy Markdown

Explanation

Removes existsSync and all synchronous operation from the fs platform capability: the FsCapability member, the fsConfigStruct field, makeCaveatedSyncFsOperation, and the node and browser sync variants.

Why: narrowed methods always forward through E() and every derived guard is M.callWhen, so a synchronous method cannot survive narrowing. Going promises-only is a precondition for vending fs as a narrowable exo in the next two PRs.

makeNoSymlinksCaveat and its lstatSync are 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 that main sees one breaking change to @metamask/kernel-platforms rather 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.ts passed platformConfig: { fs: { rootDir: '/tmp', existsSync: true } } and asserted isVatConfig returns true. Since fsConfigStruct is a superstruct object(), it rejects unknown keys, so removing the field would have silently flipped that assertion to false. Now uses promises: { readFile: true } so the case still exercises a populated fs config.

SyncPathCaveat is 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.

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
ci-belphegor force-pushed the grypez/narrowing-9a-fs-promises-only branch from 37cd194 to 99c774c Compare September 11, 2026 11:42
@ci-belphegor
ci-belphegor added this pull request to stack #1060 September 11, 2026 11:44
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.

1 participant