Skip to content

fix(editor-doc): ydoc::decode panics inside yrs 0.28.0 on a one-byte mutation, and its property test fails CI at random #114

Open

Description

@aRustyDev

What happens

ydoc::decode (crates/thrust-editor-doc/src/ydoc.rs) panics inside yrs 0.28.0 on an update that has been mutated by a single byte:

thread 'prop_decode_never_panics_on_mutated_updates' panicked at yrs-0.28.0/src/block.rs:92:13:
assertion failed: value & Self::MASK == 0

decode calls Update::decode_v1, then apply_update, then reads the fragment; the test catches the panic around all of it, and I have not narrowed which of the three it is in.

The property test that finds it, thrust-editor-doc's prop_decode_never_panics_on_mutated_updates (tests/roundtrip.rs), is randomized and has no committed regression file, so it fails only when the draw reaches the case. When it does, hermetic is red and so is gate, for any pull request, whatever it changed.

Evidence

Why it matters

  • The property is Thrust's own statement that decoding outside bytes never panics, and the repo's panic policy (ADR-0006, Cargo.toml: "request-derived data can never panic, because on the Worker (panic=abort) a panic fails its own request") is written for exactly this. On native the server keeps unwinding (CatchPanicLayer), but wasm32 on stable is always panic=abort, so a catch_unwind at the call site is not available to the Worker.
  • Reach today is small. ydoc is behind the yjs feature (default on). The product crates thrust-api-v1 and thrust-compat-plane turn defaults off and take sanitize only, so yrs is not in them. The one non-test caller is thrust-editor-worker (Spike 0006): POST /binary-to-all base64-decodes the request body and passes the bytes to ydoc::decode. I have not checked whether that Worker is deployed anywhere. Collaboration persistence (ADR-0061) would put this on a product path.

Not done, and what is open

  • I have not re-run the two seeds since; the local working tree was removed before I could. To reproduce, put the two cc lines in crates/thrust-editor-doc/tests/roundtrip.proptest-regressions and run scripts/rs cargo nextest run -p thrust-editor-doc -E 'test(prop_decode_never_panics_on_mutated_updates)' (proptest replays saved seeds first). [unverified: not re-run]
  • I have not checked whether a newer yrs fixes it, or whether it is already reported upstream.
  • Ways to close it, none chosen: a newer or patched yrs; a check on the bytes before they reach yrs (I do not know what would be enough, nor whether the panic is in decode_v1 or later); or an upstream report with the one-byte case above. Repo rule 3 applies to the test: it stays as it is, it is not ignored, weakened or retried.
  • Committing the two seeds as a regression file is right once a way to close it is chosen; committed now, it makes hermetic fail on every run until then.

Found while working on #58 (PR #113's CI); not part of it.

Activity

  1. aRustyDev commented on Nov 16, 2026

    @aRustyDev
    OwnerAuthor

    Another occurrence in CI, 2026-11-16, same panic (yrs-0.28.0/src/block.rs:92:13: assertion failed: value & Self::MASK == 0):

    Still no committed regression file, so any pull request's hermetic, and gate with it, can turn red at random until this is fixed.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions