Skip to content

fix: shared-state trust-flip re-init, atomic storage writes, falsy RPC cache#80

Merged
antfu merged 5 commits into
mainfrom
sixty-moose-sniff
Jul 9, 2026
Merged

fix: shared-state trust-flip re-init, atomic storage writes, falsy RPC cache#80
antfu merged 5 commits into
mainfrom
sixty-moose-sniff

Conversation

@antfubot

@antfubot antfubot commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements plans 010, 012, and 025 from plans/:

  • fix(client): createRpcSharedStateClientHost's trust-flip listener re-ran initSharedState() on every true emit, registering a duplicate updatedserver-state:set/patch bridge each time. Guard init to run at most once per key.
  • fix(storage): createStorage's debounced writer used an unguarded, non-atomic fs.writeFileSync. A crash mid-write could corrupt the file, and a write error (EACCES/ENOSPC) threw uncaught inside the debounce timer. Now writes to a pid-scoped temp file in the same directory and atomically renames it into place, with failures reported via a new DF0035 diagnostic instead of throwing.
  • fix(rpc): the client RPC response cache used a truthiness check (if (cached)), so a legitimately cached 0/''/false/null read as a miss and was re-fetched on every call. Added RpcCacheManager.has() (presence check) and switched the client cache path to use it.

Each fix ships with a regression test proving the previously-buggy behavior is fixed. plans/README.md status rows for 010/012/025 are marked DONE, and the three now-executed plan files are removed.

Verification

  • pnpm --filter devframe build — clean
  • pnpm exec vitest run packages/devframe — 32 files / 308 tests pass
  • pnpm --filter devframe typecheck — clean
  • pnpm lint — clean

Created with the help of an agent.

@netlify

netlify Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 7d1a482
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a4f2abc6cef75000898d203
😎 Deploy Preview https://deploy-preview-80--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@antfu antfu merged commit 455c801 into main Jul 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants