Repository navigation
fix(lynx): count only real symbols in wire-value validation (PrimJS compat) - #392
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
trueadm
approved these changes
Jul 29, 2026
4 tasks done
This branch was previously deployed
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.
Summary
hasOwnSymbolFieldshelper and use it at every "no symbol fields" wire-value validation site in@octanejs/lynx, so validation counts only real symbols.Why
Object.getOwnPropertySymbolscontract for arrays: it returns the integer index keys as strings (Object.getOwnPropertySymbols([7, 8])→["0", "1"], eachtypeof "string"). Verified on Lynx Explorer 3.9 (iOS) via CDPRuntime.evaluate.Object.getOwnPropertySymbols(value).length !== 0guard therefore false-positives on any array, and array-valued payloads are everywhere in the transport: on device, every main-thread event handler with captures failed withOctane Lynx thread captures: contains symbol fields.before this change. jsdom-based tests never see this because Node's engine is conformant.Changes
packages/lynx/src/core/own-symbols.tswithhasOwnSymbolFields(), which filterstypeof key === 'symbol'.getOwnPropertySymbols(...).length !== 0checks inworklets.ts,protocol.ts(2×),native-events.ts,nodes-ref.ts,lifecycle-data.ts, andmain-thread.ts(2×).worklets-core.test.ts: regression that emulates PrimJS's behavior via agetOwnPropertySymbolsspy — array captures must pass, while a genuine symbol field must still be rejected.runtime-compatibility.test.ts: the runtime source-graph inventory gainsown-symbols.tsin both thread graphs.Validation
vitest run --project lynx— 23 files, 260 tests passedtsgo --noEmit -p packages/lynx/tsconfig.jsonprettier --checkon all changed filesmain-thread:bindscroll/bindtapcaptures validate and run on Lynx Explorer 3.9 (iOS)pnpm test/pnpm typechecknot run for this PR in isolationRisk / follow-ups
@octanejs/lynxis a private package.Note
Low Risk
Behavior on conformant engines is unchanged except for the PrimJS fix; scope is validation helpers and tests with no auth or data-model changes.
Overview
Fixes false “contains symbol fields” failures on Lynx device when payloads include arrays (e.g. main-thread event captures), caused by PrimJS returning array index keys from
Object.getOwnPropertySymbolsinstead of only real symbols.Adds shared
hasOwnSymbolFieldsinown-symbols.ts(treats a key as a symbol only whentypeof key === 'symbol') and swaps every Lynx wire-value / clone guard that usedgetOwnPropertySymbols(...).length !== 0for that helper across lifecycle data, protocol, worklets, native events, nodes-ref, and main-thread tuple checks.Adds a worklets regression test that mocks PrimJS’s
getOwnPropertySymbolsbehavior (arrays pass, genuine symbol keys still fail) and updates the runtime source-graph inventory for the new module.Reviewed by Cursor Bugbot for commit 786047d. Bugbot is set up for automated code reviews on this repo. Configure here.