fix: harden editor and tree-sitter parser for iOS Cordova (WKWebView/JSC) - #110
Open
rajkumargaramie wants to merge 3 commits into
Open
fix: harden editor and tree-sitter parser for iOS Cordova (WKWebView/JSC)#110rajkumargaramie wants to merge 3 commits into
rajkumargaramie wants to merge 3 commits into
Conversation
Two iOS Cordova/WKWebView failures in createParser:
1. A boolean 'hasBeenLoaded' flag was flipped to true before Parser.init()
resolved, so a concurrent createParser call skipped init and reached
'new Parser()' before the runtime was ready, throwing 'cannot construct a
Parser before calling init()'. Replaced with a shared initPromise that every
caller awaits (reset on failure to allow retry).
2. web-tree-sitter's findWasmBinary() still runs even when wasmBinary is
supplied; without locateFile it falls back to
new URL('web-tree-sitter.wasm', import.meta.url), which throws 'Invalid
scheme' inside an iOS Cordova WKWebView. Pass a locateFile that returns the
asset name (never fetched, since wasmBinary is present).
The commit-message lint iterated $(git log ...) unquoted, so each word of a subject was validated separately and no conventional-commit subject with spaces could ever pass. The pre-push hook had the same word-splitting bug and also used origin/$BRANCH, which resolves to the ambiguous origin/HEAD under a detached-HEAD CI checkout. Iterate messages line by line and skip the range check when the upstream branch is not available.
rajkumargaramie
force-pushed
the
fix/ios-setupextensions-not-iterable
branch
from
July 22, 2026 00:00
eb96f95 to
b9aeeb9
Compare
Author
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 #101
Summary
Fixes three iOS-only failures that prevented the Kerebron editor from loading in an iOS Cordova / WKWebView (JavaScriptCore) environment. All three reproduce deterministically on iOS while desktop V8/Chromium happens to avoid them, so they were only surfaced by on-device testing.
Changes
1.
ExtensionManager— non-iterable extensions ({} is not iterable)iOS JSC threw
TypeError: {} is not iterablefromsetupExtensions/ExtensionManager. Added atoArraySafe()helper (prefers.forEachforSet/Map, falls back toArray.from, otherwise warns and returns[]) and applied it at every iteration site, and replacedMap/Setfor...ofloops with.forEach.2.
createParser—cannot construct a Parser before calling init()A boolean
hasBeenLoadedflag was flipped totruebeforeParser.init()resolved, so a concurrentcreateParsercall skipped initialization and reachednew Parser()before the runtime was ready. Replaced the flag with a sharedinitPromisethat every caller awaits (reset on failure to allow retry).3.
createParser—Invalid schemeweb-tree-sitter's
findWasmBinary()still runs even whenwasmBinaryis supplied; without alocateFileit falls back tonew URL('web-tree-sitter.wasm', import.meta.url), which throwsInvalid schemeinside an iOS Cordova WKWebView. We now pass alocateFilethat returns the asset name. BecausewasmBinaryis already provided, the returned path is never fetched.CI
The
pull_requestcommit-message lint and thepre-pushhook iterated$(git log ...)unquoted, so each word of a subject was validated separately and no conventional-commit subject with spaces could pass; the pre-push hook additionally usedorigin/$BRANCH, which resolves to the ambiguousorigin/HEADunder a detached-HEAD CI checkout. Both now iterate messages line by line, and the hook skips the range check when the upstream branch is unavailable.Testing