Repository navigation
Conversation
…ock transport) Adds package/windows/Ecr17, a WinAppSDK DLL for RNW New Architecture, following the approach of StasDoskalenko/NitromelonDB#65: - react-native-nitro-modules has no Windows project, so the DLL provides the `NitroModules` TurboModule: install() runs margelo::nitro::install with RNW's JSI runtime + CallInvoker, then registers Ecr17Client (the shared C++ core) and Ecr17Transport. - HybridEcr17TransportWindows implements the Ecr17Transport spec in C++ with Winsock, mirroring the Kotlin transport: reader thread, onDisconnect once per unexpected drop, and a write-free, non-consuming pre-send liveness probe (instant select + MSG_PEEK). The reader waits without the I/O lock (MSVC mutexes are unfair) and locks only around recv; connect() runs on its own thread so it can't queue behind busy Nitro pool workers. - Nitro platform hooks (ThreadUtils, Logger, UI dispatcher) for Windows. - scripts/windows-nitro-shims.mjs generates the <NitroModules/...> header map MSVC lacks; MSBuild runs it before compiling. - windows-autolink.js + react-native.config.js windows entry; apps spread windowsAppDependencies() to skip Nitro's missing Windows project. Money-safety is unchanged: RetryPolicy still never replays a financial command; recovery stays sendLastResult (G). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Standalone CMake + GoogleTest suite (no RNW needed) that builds the real transport plus Nitro's C++ runtime and JSI, and runs it against a loopback TCP server: drop detected before send (also while the reader is busy, so only the probe can see the FIN), probe never writes or consumes bytes, exactly one disconnect signal per drop, none on caller disconnect, fast probe on an idle socket, reconnect isolation, and disconnect from inside a callback. Per-test ctest TIMEOUT so a blocking probe fails instead of hanging. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RNW 0.84 (cpp-app, New Architecture) console: connect, status, totals, last result (G) and one payment. A separate npm project, not a bun workspace: RNW 0.84 pins react-native 0.84.1 while the Expo example is on 0.86. Links the library with file:../package; Metro loads ../package/src and resolves its bare imports from this app, so the repo root's RN never leaks into the bundle. Windows SDK pinned to 10.0.26100 (the generated app vcxproj no longer overrides the pin). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- README (package + root mirror): platforms badge, feature status, Windows install snippet, architecture tree; example now Expo SDK 57 / RN 0.86. - docs-site: new Windows page (in Get Started nav) + installation section. - AGENTS.md: Windows has no CI job; verify locally (transport tests + RNW app build). New package/cpp sources also go in Ecr17.vcxproj. - LESSON.md: Windows lessons (Nitro install shim, header map, unfair MSVC mutex / blocking-peek race, SDK on D:, MSIX-only runtime, SDK pin trap). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RNW enables RestorePackagesWithLockFile; the first MSIX deploy generated the packaging project's lock file. README: npm run windows needs VS's MSIX packaging tools, and how to start the app when the final launch step fails under PowerShell 7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The deployed example app passed a runtime smoke test against a fake terminal: Nitro install through Ecr17.dll, client creation, connection state events, Winsock connect, a correct status frame with 3 retransmits, and drop detection after the terminal's FIN. Still not run against a physical terminal. AGENTS.md/LESSON.md: local verification steps, installing VS's MSIX packaging workload, the PowerShell 7 Get-AppxPackage launch failure and how to launch the deployed app, Metro no longer printing console.log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47PADO47
added this pull request to stack #27
October 5, 2026 19:29
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
Adds React Native Windows (New Architecture, RNW 0.84+) support, following the approach of StasDoskalenko/NitromelonDB#65.
How it works
react-native-nitro-moduleshas no Windows project (mrousavy/nitro#168), sopackage/windows/Ecr17(a WinAppSDK DLL) provides theNitroModulesTurboModule. Itsinstall()runsmargelo::nitro::installwith RNW's JSI runtime +CallInvoker, then registersEcr17Client(the shared C++ core, unchanged) andEcr17Transport.HybridEcr17TransportWindowsimplements theEcr17Transportspec in C++ and mirrors the Kotlin transport: reader thread,onDisconnectonce per unexpected drop (never ondisconnect()), and a write-free, non-consuming pre-send liveness probe (instantselect+recv(MSG_PEEK)), so a socket the terminal closed between transactions is found before a financial command is sent.scripts/windows-nitro-shims.mjsgenerates<NitroModules/…>shims; MSBuild runs it before compiling.react-native.config.jsgains awindowsentry; apps spreadwindowsAppDependencies()from@padosoft/react-native-ecr17/windows-autolinkto skip Nitro's missing Windows project.example-windows/is a separate npm project (RNW 0.84 pins RN 0.84.1, while the Expo example is on 0.86): connect, status, totals, last result (G), one payment.Money-safety is unchanged.
RetryPolicystill never replays a financial command; a lost result is recovered withsendLastResult()(G).Limitation: only one native module per app can provide the
NitroModulesTurboModule; another Nitro library using the same shim would conflict.Verification (all local; no Windows CI job by decision)
package/windows/tests, CMake + GoogleTest, MSVC): 13/13 pass, and 30 repeated runs (390 test runs) pass. They cover drop detected before send (including while the reader is busy, so only the probe sees the FIN), probe never writes or consumes bytes, exactly one disconnect signal, none on caller disconnect, fast probe, reconnect isolation, and disconnect from inside a callback.example-windows(VS 2026, SDK 10.0.26100):Ecr17.dlland the app compile, link, package and install.createEcr17Clientworks, state eventsconnecting → connected → disconnected, Winsock connect, a corrects(status) frame on the wire with 3 retransmits (no ACK after 4 attempts), andisConnected() == falseafter the terminal's FIN.react-native bundle --platform windows(no repo-rootnode_modulesleaks in); docscheck+build; README mirror in sync.Found and fixed during verification
select(MSVC mutexes are unfair: ~340 ms perisConnected()); dropping the lock entirely caused a blocking-peek hang (caught by a test). The reader now locks only aroundrecv, and each test has a 30 s timeout.connect()runs on its own thread instead of Nitro's shared pool, soconnectionTimeoutMsstill bounds it when the pool is busy.Ecr17.sln, and the generated app vcxproj overriding the Windows SDK pin.Not yet verified
disconnect()joins the reader without a time limit (Kotlin uses 1 s);disconnect()during an in-flightconnect()doesn't cancel it (same as Kotlin).Local verification commands
run-windowsneeds Visual Studio's "Windows application development" workload (MSIX packaging). If its final launch step fails with aGet-AppxPackageerror (PowerShell 7), the app is installed anyway: start Ecr17Example from the Start menu.🤖 Generated with Claude Code