Skip to content

SemanticTokenDecodeDrops

SemanticTokenDecodeDrops = object

What the decoder threw away, one count per rejection rule.

Counts rather than samples, and all of them zero in the healthy case. They exist because every rule below discards input from an untrusted source, and a silent discard is indistinguishable from a server that simply sent fewer tokens — which is how a legend ends up two thirds on the floor while everything looks like it is working.

The decoder neither aggregates nor logs. Whether these are summed per server, reported once per session, or ignored is the host’s policy, on the host’s side of the seam: this package does not know what a session is, or which server answered.

readonly malformedTuple: number

A trailing partial tuple, or a tuple carrying a value that is not a non-negative integer. Neither is one of the five rules — it is input that was never a 5-tuple to begin with — but a truncated frame that decoded to silence would be indistinguishable from a short answer.


readonly outOfLegendType: number

Rule 2: tokenTypeIndex outside the legend. Tuple dropped, cursor still advanced.


readonly pastEndOfDocument: number

Rule 5: the token began past the end of the text it addresses — either because deltaLine ran past the last line, or because character ran past the end of the line it did reach. Both axes of the same failure, and both usually mean one thing: the response describes a longer document than the lineStarts and textLength it was decoded against, i.e. the host’s own snapshot has moved. Counting that under zeroLength would point the host at the server.

The character axis is checked against lineStarts[line + 1], not against textLength. Clamped to the document alone, a character past the end of line 1 of a long file is still a valid offset — one somewhere on line 3 — so the tuple decoded to a plausible span over unrelated text and reported nothing.


readonly unknownModifierBits: number

Rule 3: modifier bits beyond the legend’s length. The SPAN SURVIVES; only the bits are lost.


readonly zeroLength: number

Rule 4: zero-length tuple.