#420
Add an onInvalid hook for patch lines that do not parse
Version: @json-render/core 0.21.0
A line that starts with { and has an "op" key, but fails parseSpecStreamLine, is handled in one of two ways, and neither reports it:
- Outside a fence,
createJsonRenderTransformshows it as prose. - Inside a fence, it drops the line without telling anyone.
createMixedStreamParserdoes the same.
This happens, for example, when the token limit cuts a patch short. Nothing downstream can catch the loss: a dropped replace leaves the spec valid, so a validator sees nothing wrong, and the user sees an edit that never happened.
Repro
Stream Intro\n{"op":"add","path":"/elements/x","value":{\nDone.:
- Outside a fence, the broken line appears in the prose.
- Inside a
```specfence, it vanishes with no signal.
Ask
- An
onInvalid(line)option oncreateJsonRenderTransformandcreateMixedStreamParser. - An option to drop a patch-shaped line that appears outside a fence, instead of showing it as prose.
Activity
0No activity yet.