Repository navigation
test: check random edit sequences against a reference edit model - #381
Merged
Merged
Conversation
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.
Adds
tests/fuzz/. It holds a small reference model of magic-string's edit semantics (per-character text plus left/right inserts at each boundary), and a seeded harness. The harness runs random sequences ofappend*/prepend*/update/overwrite/remove/resetagainstIntegrityCheckingMagicStringand the model. After every op it checks that:toString,length,hasChanged,isEmpty,sliceandcloneagree with the modelreplace#367 violated)Most of the recent
fix:PRs (#352–#367) were found by contributors' out-of-tree fuzzers. This keeps the same kind of check in the repo. It runs 1000 sequences in about 3 s underpnpm test. RunFUZZ_SEQUENCES=100000 FUZZ_SEED=2 pnpm exec vitest run tests/fuzzfor a deep run.There are no divergences at 100k sequences × 2 seeds. Two open questions are recorded in
tests/fuzz/FINDINGS.md:sliceanchors inside removed text shouldBoth currently do, and the model follows the library on each. No changes under
src/.Plan:
plans/011-edit-model-oracle-fuzz-spike.mdin #370.This PR was created with the help of an agent.