Skip to content

ontos v0.17.1

Latest

Choose a tag to compare

@github-actions github-actions released this 12 Nov 02:13
· 18 commits to main since this release
156ff02

ontos v0.17.1

A patch release. It fixes a regression and two related gaps in the TypeScript core that
shipped in v0.17.0, adds one Rust API, and brings the four command-line tools into line
with each other. The value model, structural identity, the ontos-codec-v1 bytes,
decoding and its limits are unchanged, and so are Rust's allocation counts for the
v0.17.0 fast path.

TypeScript: copyBytes and Atom keep their contract

v0.17.0 made copyBytes, and with it new Atom(...), read the caller's bytes once and
store exactly what it validated. Three gaps remained:

  • A claimed length was allocated before anything was validated. A sparse array, or
    a Proxy, claiming 2³²−1 elements made v0.17.0 reserve 4 GiB before reading index 0.
    Under a memory limit that surfaced as "Array buffer allocation failed" instead of the
    element error. Now at most 64 KiB is allocated up front. The result then grows only
    after the element that needs the room has been validated, and ends at exactly the
    input's length.
  • The copy used built-ins looked up at call time. A redefined
    Uint8Array.prototype.set could change the stored bytes. Every built-in the copy uses
    is now captured when the module loads and called without a lookup.
  • An Atom's own methods did too. length, bytes(), toString/toJSON and
    equals handed the Atom's private bytes to built-ins looked up at call time, so a
    redefined built-in could change an existing Atom. They now use only the captured ones.

The guarantee starts when ontos-core loads: code that runs before it can still replace
built-ins, as with any library.

Supported runtimes. The six TypeScript packages now declare
"engines": { "node": ">=18.3.0" }. The fast path for a genuine Uint8Array runs no
caller code only on engines that implement ecma262#2719, first in V8 10.2.85 and so in
Node 18.3.0. On older engines, copying reads the source buffer's constructor. See
distribution, "TypeScript runtimes". Node 18 is past its end of
life; every supported Node line meets the floor.

Rust: unbounded decimals at the byte level

ontos_data gains encode_decimal_bytes and read_decimal_bytes. They take and return
the mantissa and exponent as IntBytes (a sign and a big-endian minimal magnitude), like
encode_int_bytes/read_int_bytes, so a canonical decimal of any size can be built and
read without i128. The canonical rule now lives in one place, shared with
recognize_decimal. encode_decimal and read_decimal are unchanged. The addition is
compatible: a 0.17 requirement picks it up.

The command-line tools read input the same way

The four ontos CLIs (go, rs, ts, py) now read --from-json and hex input
identically, as the new "Reading the text" section of ontos-cli
specifies. A new reading mode in the conformance harness checks them case by case, through
both argv and stdin.

Inputs that are now refused (they were accepted by one or more CLIs):

  • in --from-json: a duplicate member name (compared after escape decoding), anything
    after the value such as a stray ], whitespace other than space, tab, LF and CR, a BOM,
    and a lone surrogate escape;
  • around hex input: any character other than space, tab, LF and CR (before, the CLIs
    variously stripped a BOM, NBSP, form feed, vertical tab, NEL or U+001C);
  • a --from-json text nested deeper than 1024 value levels, which is now
    limit_exceeded (exit 1), the codec's default depth.

Bytes that are not UTF-8 are read as U+FFFD, so they are always refused.

Fixed: crashes on deep input (Python, TypeScript, Rust), and on rendering a valid
1024-deep value (Python); a Rust panic on non-UTF-8 arguments; a TypeScript crash reading
a large stdin from a slow pipe; TypeScript output cut short on a pipe while still exiting
0; and quadratic string reading in Rust.

Also in this release

  • Go: codec.Measure gets its memo key from core through a module-internal package,
    checked by the compiler, instead of reading an unexported field through reflect. The
    public API is unchanged.
  • Generated tests: generated limit-policy tests check that every face reports the
    same limit kind inside an agreement zone, and a metamorphic relation over valid values
    (#13).
  • 32-bit coverage: the Rust core, data and data-json crates now also run on a 32-bit
    target in CI, not only the codec.
  • JSON projections: design record 0010 decides
    ontos's two JSON projections, after consultation 0001.
    They are not in this release.

Upgrade

Every published package carries version 0.17.1. A Rust graph on 0.17 and npm ranges
like ^0.17.0 pick it up with no change. The root Go tag v0.17.1 and the nested tags
projection/deixis/go/v0.17.1 and wire/go/v0.17.1 name the same release commit.