FM-PS-LYNX-008: architecture stack + verify fixes - #32
Conversation
FM-PS-LYNX-008 E: one LynxHost interface with a PrimJS adapter and a fake test adapter. Native Module lookup, GlobalEventEmitter, platform, text codec, fetch, and AbortController install go through src/host.ts. LynxRemote transport stays in place (A deferred). Co-authored-by: 達達 <djwok@users.noreply.github.com>
Replace the LynxRemote mega-module with a SyncStreamTransport seam and three adapters: NativeHttpFetch (streamingId realtime primary), LynxFetchModule fallback, and identifier fetch. Delete the FM-PS-LYNX-003 one-shot diagnostic in favor of PowerSync logger debug. Idle-complete stays a fallback only (C deferred). Native HTTP module split is B, deferred. Co-authored-by: 達達 <djwok@users.noreply.github.com>
…lete Native sync HTTP lives in NativeSyncHttp (same Autolink lookup, not callNative). Android and iOS emit onData* → onError? → onEnd. Idle-complete is the streamingId fallback with one envelope and shared/sync_http_policy.h. Desktop N-API stays SQL-only. ADR-0003 records the seam. Co-authored-by: 達達 <djwok@users.noreply.github.com>
Presence-check httpFetch without type assertions; oxfmt the HTTP seam. Co-authored-by: 達達 <djwok@users.noreply.github.com>
Replay one catalog (checkpoint+ops, error-then-end, idle-complete) through native-http streamingId tests, Linux make test, make test-ios httpFetch, and Android instrumentation so the B terminal sequence cannot drift. Co-authored-by: 達達 <djwok@users.noreply.github.com>
D: Autolink NativePowerSyncModule SQL RPC is a thin Java/JNI binder over shared ps_sql, dropping androidx.sqlite-bundled. Core still loads from the Maven AAR via sqlite3_load_extension. NativeSyncHttp stays a separate sub-interface. G: iOS NativeSyncHttp no longer walks UIWindows for a LynxView. Hosts inject sendGlobalEvent via setSharedStreamEventSender or initWithParam; missing sender uses the idle-complete fallback. Co-authored-by: 達達 <djwok@users.noreply.github.com>
JNI binder methods must survive consumer minification so SQL RPC stays on shared ps_sql. Co-authored-by: 達達 <djwok@users.noreply.github.com>
Lynx-for-Web always has lynx.getJSModule("GlobalEventEmitter"). identifier
streaming was discarding Response.body and waiting for native onData, so
A↔B download never applied. Keep a usable fetch body; streamingId still
uses GlobalEventEmitter. Read NativeModules as unknown to avoid TS2559.
Co-authored-by: 達達 <djwok@users.noreply.github.com>
Read the PrimJS bag through isNonNullObject and assert NativeModulesHost at the lookup boundary so rspeedy typecheck stays green. Co-authored-by: 達達 <djwok@users.noreply.github.com>
Co-authored-by: 達達 <djwok@users.noreply.github.com>
Do not declare NativeModules, TextCodecHelper, lynx, or SystemInfo on the global namespace in src/globals.ts. @lynx-js/types already owns those vars. PrimJS lookup uses module-local declare const plus a globalThis probe so showcase pluginTypeCheck stays green. Co-authored-by: 達達 <djwok@users.noreply.github.com>
Co-authored-by: 達達 <djwok@users.noreply.github.com>
Mac tip verify: NativeSyncHttp.mm failed to compile sendGlobalEvent on untyped id (pod TU has no LynxView header). Declare PSLynxStreamEventSender and cast after respondsToSelector. Android NDK AttachCurrentThread wants JNIEnv**; keep OpenJDK void** behind !__ANDROID__ for make test. Web download / host-fetch NDJSON path is unchanged. Co-authored-by: 達達 <djwok@users.noreply.github.com>
FM-PS-LYNX-010 · code review of the landed stack (
|
Collapses the remaining FM-PS-LYNX-008 stack into one PR targeting
main.H (verification gate) already landed in #23. Tip branch
drkz/fm-ps-lynx-008-native-build-fix-4330was rebased onto currentmain: the duplicate verification-gate commit was skipped as already applied; no conflict resolutions. GitHub refused to retarget stacked #30 (Cannot change the base branch because the pull request is part of a stack), so #30 was closed and replaced by this PR from the same head.Intermediate stacked PRs #24–#29 (and closed #30) are superseded by this tip.
Stack (E → A → B+C → F → D+G + verify fixes)
E — one LynxHost for PrimJS globals
src/host.ts:PrimJSLynxHost+ fake test host. NativeModules, GlobalEventEmitter, platform, text codec, fetch, and AbortController install go through one seam. Not public API.A — SyncStreamTransport
Three adapters: NativeHttpFetch (primary;
streamingId/ GlobalEventEmitter — issue #21 realtime), LynxFetchModule, host-fetch.LynxRemote.tsis a thin pick. FM-PS-LYNX-003 diagnostics removed.B+C — NativeSyncHttp split + idle-complete fallback
Native
/sync/streamHTTP lives inNativeSyncHttp(Android + iOS), not on the SQL RPC module. Idle-complete is the fallback only whenstreamingIdis absent.F — shared NDJSON fixtures
Canonical catalog at
shared/fixtures/sync-stream.json, replayed by JS tests and native fixture tests.D+G — Android
ps_sqlJNI + iOS host event senderAndroid SQL RPC is JNI
PsSqlEngine→shared/ps_sql(androidx.sqlite-bundledremoved). iOS no longer walksUIWindow; incremental stream needssetSharedStreamEventSender:(showcase already registers the LynxView).Web download
Host-fetch keeps a usable Fetch
Response.body.PrimJSLynxHostfinds barelynxon lynx-bg, so an emitter is always present on web — do not wait on nativeonDatafor identifier fetch.streamingIdstill uses GlobalEventEmitter.src/globals.tsno longer redeclares Lynx globals (rspeedy TS2403).Native build fix
iOS: local
PSLynxStreamEventSenderprotocol sosendGlobalEvent:withParams:compiles without importing LynxView. Android NDK:AttachEnvusesJNIEnv**under__ANDROID__, OpenJDKvoid**for Linuxmake test.Confirmed not dropped
streamingIdrealtime path (native-http Hardening: keep native realtime on streamingId path (regression + README) #21)SyncStreamTransportpick orderLynxHost/PrimJSLynxHostNativeSyncHttpsplit from SQL RPCps_sqlJNI engineVerify
pnpm typecheck,pnpm lint,pnpm testmake test(Linux; includes JNI-cofps_sql_jni.cc)make test-ios/ Android NDK + instrumentation need MacTracking: #18