Skip to content

v0.7.0

Choose a tag to compare

@github-actions github-actions released this 09 Nov 09:26
· 19 commits to main since this release

Minor changes

  • cca58f9: JSON input with a lone surrogate escape is rejected. JSON.parse accepts "\ud800", half of a UTF-16 surrogate pair escaped without its other half, and kgdiff used to carry it through ids and labels into its diffs and deltas; such text is not Unicode, and the Rust implementation (RFC 0002) cannot hold it. parseGraph now throws invalid-input for one in JSON and JSON-LD, located at the escape (Invalid JSON on line 6, column 35: the escape \ud83d is a lone surrogate (half of a UTF-16 pair), which kgdiff does not accept.), and so does a JSON-LD context text a documentLoader returns; kgdiff apply refuses a delta that has one. Escaped surrogate pairs ("😀") read as before.

    @kgdiff/cli · @kgdiff/formats

  • d01c4e0: Matching gives the same result in every JavaScript engine. Its neighbour and key weights (1 / log₂(2 + degree), 1 / log₂(1 + postings)) now use a log₂ built from exactly rounded operations only, the one the layout already used, instead of Math.log2, which engines may approximate differently: V8 ports FreeBSD's e_log2.c, while an engine that calls the platform's C library gets that library's rounding (Apple's differs from V8 on 439 of the integers up to 2,000,000). A diff computed in a browser, as the playground does, now equals the CLI's whatever the engine. The new log₂ differs from V8's by one unit in the last place on about 2% of integers; no match, suggestion or score changes in the conformance corpus, the example datasets or 144 synthetic diffs, but a score that sits exactly on a rounding boundary or a tie can move. The function is exported as log2, and @kgdiff/layout uses it from core.

    @kgdiff/core

  • 7586808: Reports open the same way whatever Unicode version the browser has. diffFromJSON takes the labels, aliases and types of a document's snapshots as written instead of composing them to NFC again with the runtime's ICU, and the content hashes in the delta check that text: a report made with Node 24 (Unicode 17) no longer fails to open in a browser with older tables when a label holds a character whose composition changed in between, and a snapshot whose text was edited or is not in NFC is still rejected. To restore a label it left out without Unicode tables either, kgdiff JSON (diffs, graphs and deltas) now leaves an edge label out only when it equals predicateLabel(predicate) before its NFC step; a predicate whose readable part is written decomposed keeps its label in the document. A diff written by an earlier version for such a predicate, with that label left out, no longer opens: write it again. normalize composes API input to NFC as before.

    @kgdiff/core · @kgdiff/viewer

  • cca58f9: Numbers beyond the range of a double in JSON graphs are kept instead of lost. JSON may write 1e400, which JSON.parse reads as Infinity; the JSON reader used to drop such a number without a word (an attribute or meta member disappeared, an array item became null), so a diff could report nothing for a value that changed, or a change that did not happen. It now keeps the value as the string "Infinity" or "-Infinity", as normalize keeps a non-finite number an API caller passes, and reports how many with a json-non-finite warning (ParseWarningCode), in every JSON dialect.

    @kgdiff/formats

  • 9ebb278: layoutFromJSON reads version 2 of the layout document, which kgdiff's Rust layout engine will write. Version 2 is version 1's members plus generator, a non-empty string such as "kgdiff-layout/1" that names the engine generation that computed the positions. It becomes the new optional LayoutResult.generator. Positions read from either version are valid pins for anchored layouts and extendLayout. A version 2 document without a generator is rejected (invalid-input), and versions other than 1 and 2 are rejected as before (unsupported-version). layoutToJSON still writes version 1, so a layout read from version 2 is written back as version 1 without its generator. Types: LayoutJSON is now the union of the documents layoutFromJSON reads, LayoutJSONV1 | LayoutJSONV2, and layoutToJSON returns LayoutJSONV1. Code that relied on LayoutJSON['version'] being 1 should use LayoutJSONV1. Through ReportPayload.layout (a LayoutJSON), the viewer opens reports whose layout is version 2.

    @kgdiff/layout

  • e510258: Report payloads may leave their layout out. ReportPayload.layout is optional: a payload without one (the member left out) is laid out in the browser when the viewer reads it, with layoutDiff's default options, so an application that computed a diff itself can show it by passing its diff.v1 JSON as a payload. The ESM build imports the compute module on demand for it; the standalone viewer takes it from the @kgdiff/viewer/standalone/compute add-on (globalThis.KgdiffCompute), and without the add-on shows an error that says what is missing instead of failing to read the layout. The diff engine never runs for a payload, and payloads with a layout open exactly as before, without loading the compute module. A layout that is present but not an object (null, for instance) is rejected. The CLI keeps writing the layout into its reports.

    @kgdiff/viewer


Every package is at 0.7.0: @kgdiff/cli · @kgdiff/core · @kgdiff/formats · @kgdiff/layout · @kgdiff/scene · @kgdiff/renderer · @kgdiff/viewer · @kgdiff/g6.

GitHub Action: uses: iiwish/kgdiff@v0.7.0.