# WRNexusJS v0.6.0 R10 peer-function state fix ## Failure The compiler test `browser codegen binds peer client functions through the scoped function table` failed because an outer client function captured local state before calling a peer function. The peer updated `context.state`, but the outer function's `finally` block copied its stale local value back over the peer update. ## Fix `packages/compiler/src/client-codegen.ts` now generates peer-function wrappers that: 1. synchronize the caller's local state into `context.state` before the peer call; 2. invoke the peer through `context.functions`; 3. refresh local aliases from `context.state` after synchronous completion, asynchronous completion, or a synchronous throw; 4. copy local state back only when it actually changed from the function-entry snapshot. This preserves shared scoped state for nested client/shared function calls without changing synchronous functions into promises. ## Regression validation - Exact peer-call execution probe: passed (`run()` calls `increment()`, final state is `1`). - Focused TypeScript compiler check: passed. - UI browser targets generated and syntax-checked: 108/108. - UI and showcase WRN files parsed: 250/250. - VS Code tests: 28/28. - Root v0.6 validator: 18 passed, 0 failed (Bun availability warning only in the packaging environment).