Port upstream Muya history identity op guard#61
Open
Renakoni wants to merge 3 commits into
Open
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.
Summary
Ports upstream marktext/marktext PR #4838 into the Android Muya copy.
Upstream source: marktext/marktext#4838
This is a follow-up hardening PR for upstream #4815, so this Android PR is stacked on Android PR #60 (
sync/upstream-4815-identity-flush).json-changecan still carry the identity operation (null) through non-deferred paths such asEditor.updateContents(null). History readsop.length, so it must treatnullas a no-op rather than recording or transforming it.Changes
json-changelistener to acceptNullable<JSONOpList>.nullidentity ops before_record()/_transform().updateContents(null)and the compose-to-null deferred flush path.Verification
pnpm test -- src/history/__tests__/identityOpJsonChange.spec.ts src/state/__tests__/flushPendingOps.spec.tsfromthird_party/muyapassed: 7 tests.pnpm exec eslint src/history/index.ts src/history/__tests__/identityOpJsonChange.spec.ts --no-ignore --max-warnings 0fromthird_party/muyapassed.pnpm typecheckfrom repo root passed.Audit Decision
This upstream PR is Android-relevant because it hardens Muya's state/history path for identity operations, including IME-like edit cancellation cases. Android heavily depends on IME behavior in the WebView editor, and this PR closes the consumer-side crash even if another emitter forwards
nullin the future.