fix: shared-state trust-flip re-init, atomic storage writes, falsy RPC cache#80
Merged
Conversation
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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
Implements plans 010, 012, and 025 from
plans/:createRpcSharedStateClientHost's trust-flip listener re-raninitSharedState()on everytrueemit, registering a duplicateupdated→server-state:set/patchbridge each time. Guard init to run at most once per key.createStorage's debounced writer used an unguarded, non-atomicfs.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 newDF0035diagnostic instead of throwing.if (cached)), so a legitimately cached0/''/false/nullread as a miss and was re-fetched on every call. AddedRpcCacheManager.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.mdstatus rows for 010/012/025 are marked DONE, and the three now-executed plan files are removed.Verification
pnpm --filter devframe build— cleanpnpm exec vitest run packages/devframe— 32 files / 308 tests passpnpm --filter devframe typecheck— cleanpnpm lint— cleanCreated with the help of an agent.