Repository navigation
Reset encoder anchor state between documents - #993
Open
peterolkhov wants to merge 1 commit into
Open
peterolkhov wants to merge 1 commit into
peterolkhov wants to merge 1 commit into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #993 +/- ##
==========================================
+ Coverage 80.65% 80.72% +0.06%
==========================================
Files 22 22
Lines 6845 6848 +3
==========================================
+ Hits 5521 5528 +7
+ Misses 905 903 -2
+ Partials 419 417 -2 🚀 New features to boost your workflow:
|
2 tasks done
This branch has not been deployed
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.
Before submitting your PR, please confirm the following.
Reusing an Encoder with the same anchored pointer can write aliases to the previous document instead of encoding the current value. For example, changing a shared settings object's timeout between two Encode calls loses that update, and the second document cannot be decoded independently.
Clear the document's anchor and alias bookkeeping in EncodeToNodeContext. This also covers repeated node conversions while preserving SmartAnchor's two passes. The tests cover updated snapshots, independent document decoding, custom anchor names, and SmartAnchor reuse when the next document stops sharing a value.
Tested locally:
make teston Go 1.21.13 and 1.26.7,make lintwith golangci-lint 2.1.2,make cover,go build ./..., the ycat build and run, and the playground wasm and page builds. These ran on macOS arm64; the page build used Node 24.13.0. The full hosted CI matrix and generated fuzzing were not run.AI assistance was used to implement the fix and tests.