Title: fix(shared-state): avoid echoing received updates by dvcolomban · Pull Request #422 · devframes/devframe · GitHub
Open Graph Title: fix(shared-state): avoid echoing received updates by dvcolomban · Pull Request #422 · devframes/devframe
X Title: fix(shared-state): avoid echoing received updates by dvcolomban · Pull Request #422 · devframes/devframe
Description: Background A browser-side shared-state update received from the node side emits the same write back. If that write arrives after its key is deleted and recreated, the replacement accepts the old synchronization ID and loses its new value. Changes Suppress only the received state object and synchronization ID while applying a snapshot or patch. Restore the previous receive context after synchronous callbacks. Local writes, nested callback writes and writes to another key with the same ID still propagate. The production change adds 20 lines and removes 3 in one file. No public API or wire-format change. Reproduction The added tests use native RpcFunctionsHostImpl and createRpcSharedStateClientHost. Only outgoing I/O is queued. Publish { count: 5 } from the node side and deliver its update to the browser side. Hold the resulting outgoing write. Delete the state on both sides and recreate its key as { count: 6 }. Read the replacement normally. Release the held write. Unchanged code replaces 6 with 5. This fix preserves 6 for both snapshots and patches. In a disposable checkout of this branch, install the locked dependencies with pnpm install --frozen-lockfile. Run the same tests with the production file restored to the unchanged base, then with the fix: git restore --source=72d917d5a57837b748bc9c950a0216049d13363e -- packages/devframe/src/client/rpc-shared-state.ts pnpm exec vitest run --project devframe packages/devframe/src/client/rpc-shared-state-echo.test.ts # Two failures: expected { count: 6 }, received { count: 5 }. git restore --source=HEAD -- packages/devframe/src/client/rpc-shared-state.ts pnpm exec vitest run --project devframe packages/devframe/src/client/rpc-shared-state-echo.test.ts # All three cases pass. Verification Reproduced both failures on unchanged main 72d917d5, using native source only. Four focused shared-state/RPC test files pass: 18 tests, including all three regressions. ESLint on both changed files, devframe TypeScript checks and the devframe package build pass. Local source checks use a cached dependency graph with Vitest 5.0.1, TypeScript 6.0.3 and Vite 8.3.1. Full CI also passes with the current lockfile: lint, Ubuntu/Windows Node 22/24/26 test jobs, end-to-end tests and Bun/Deno runtime checks.
Open Graph Description: Background A browser-side shared-state update received from the node side emits the same write back. If that write arrives after its key is deleted and recreated, the replacement accepts the old sy...
X Description: Background A browser-side shared-state update received from the node side emits the same write back. If that write arrives after its key is deleted and recreated, the replacement accepts the old sy...
Opengraph URL: https://github.com/devframes/devframe/pull/422
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:18841587-f7c6-d4e8-a23a-1d89a364af6c |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | EA38:2F9B80:10EA94:17A5B7:6AFB6B01 |
| html-safe-nonce | 7bfe540e8923044dbed217e0b9e2055313cc08b68e8546f3e80415da9d464757 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTM4OjJGOUI4MDoxMEVBOTQ6MTdBNUI3OjZBRkI2QjAxIiwidmlzaXRvcl9pZCI6IjM2MjcyNDU0MDUzNDg3ODQ4OTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 61e3b15c386de946cd725eea99f2039f3a9c35967ad2c4e3bf6a28edb28a25f4 |
| hovercard-subject-tag | pull_request:4714489411 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/devframes/devframe/pull/422/files |
| twitter:image | https://avatars.githubusercontent.com/u/90617742?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/90617742?s=400&v=4 |
| og:image:alt | Background A browser-side shared-state update received from the node side emits the same write back. If that write arrives after its key is deleted and recreated, the replacement accepts the old sy... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cca289ecd54650fcf3c0b037a58b97186dee2cc4406819d87fab93728fd83700 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/devframes/devframe git https://github.com/devframes/devframe.git |
| octolytics-dimension-user_id | 279879373 |
| octolytics-dimension-user_login | devframes |
| octolytics-dimension-repository_id | 1231722386 |
| octolytics-dimension-repository_nwo | devframes/devframe |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1231722386 |
| octolytics-dimension-repository_network_root_nwo | devframes/devframe |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 88808b1fae5ab8a526a73e7ce5542a10eb9d6971 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width