Skip to content

Swift-JSON 1.10.0 — Exact Interchange

Latest

Choose a tag to compare

@ThorFuchs ThorFuchs released this 26 Nov 15:54
564ca8c

This minor release is about exact interchange: canonical bytes for hashing and
signing, a versioned envelope for stored records, structural differences as RFC
6902 patches and as a visual page, and RFC 7464 JSON text sequences. Preparation
and tagging do not establish publication; the official GitHub release and its
qualification asset identify the final source and actual outcomes.

Added

Canonical JSON (RFC 8785). JSONCanonicalWriter writes JSON
Canonicalization Scheme bytes: compact output, keys ordered by UTF-16 code units,
short string escapes and ECMAScript spelling of binary64 numbers. Equal values
produce equal bytes, so the output can be hashed, signed or used as a content
address. Because JSONNumber is an exact decimal, NumberPolicy.preserving (the
default) refuses a number whose binary64 spelling would denote a different value;
.rounding rounds as RFC 8785 does. Tests cover the RFC's Appendix B number
vectors, its sample document and its key-sorting example. The existing writer and
its scalar key order are unchanged.

Versioned envelopes. JSONEnvelope stores one payload with a caller-chosen
type and schema version as one canonical object:

{"digest":"sha256:…","format":"swift-json-envelope","formatVersion":1,"payload":{…},"type":"mcp.task","version":3}

The digest is the SHA-256 of the payload's canonical bytes. Decoding accepts any
strict spelling, checks the marker, the six members, the format version, the
fields and the digest, and reports JSONEnvelopeFailure for invalid or damaged
records. Equal envelopes encode to equal bytes, and equal payloads have equal
digests. Format version 1 is fixed. Schema versions use Int64 on every platform and retain the
same range 1 through 2^53 − 1, including wasm32. Stores built on
Swift-SQLite are the intended users;
Swift-JSON itself adds no persistence.

Structural differences. JSONPatch.difference(from:to:options:) computes RFC
6902 operations that turn one exact value into another. Equal values produce no
operation, objects are compared by key, and arrays keep their longest equal prefix
and suffix and compare the rest by position. The result always applies to the
source to give the target. It is deterministic but not minimal, and it never uses
move, copy or test.

Visual differences. JSONHTMLRenderer.renderDifference(from:to:) renders two
values as one static, script-free tree. Added, removed and changed values carry
text markers as well as color, and unchanged parts stay visible but collapsed. The
page has a summary, a change list linked by JSON Pointer, a CSS-only "Show changes
only" toggle and downloads of the patch, the source and the target. Its CSP sets
script-src 'none' and authorizes its stylesheets by hash. The comparison is a
package walker in JSON shared with JSONPatch.difference, so JSONHTML still
depends on JSON only.

JSON text sequences (RFC 7464). JSONTextSequence reads
application/json-seq streams with the same pull model and budgets as NDJSON.
A top-level number, true, false or null without trailing whitespace is
treated as possibly truncated. Malformed texts fail by default; the .skip
policy skips and counts them as RFC 7464 recommends, but never skips resource
failures. JSONTextSequenceWriter writes RS, strict JSON and LF per value, as a
whole sequence or in awaited bounded chunks.

Maintenance

These changes were collected for a 1.9.1 hygiene release that was not published
separately; they ship in 1.10.0.

  • A platform-floor CI lane checks the macOS 15 / iOS 18 manifest minimums,
    cross-compiles every library for iOS 18 devices and the simulator, and builds
    and runs an external consumer with the same minimums.
  • The CLI source identity no longer covers DocC catalogs.
  • Developer kit 0.2.0 targets published 1.9.0. The repository is a Claude Code
    plugin marketplace. A kit update for 1.10.0 follows the 1.10.0 tag.

Platforms

Unchanged from 1.9.0: macOS 15 and iOS 18 minimums, developed with Swift 6.4 and
the macOS 27 SDK (Xcode 27). Linux and WASI scope is unchanged.

Compatibility and qualification

The release is additive over 1.9.0. The package keeps twelve library products
plus swift-json, thirteen DocC catalogs, Swift tools and compiler 6.4+, Swift
language mode 6, an empty root dependency graph, Apache-2.0 and retained upstream
notices. No product dependency changes. CLI metadata reports 1.10.0 with the
deterministic final-source identity.

The maintainer recorded an explicit exception for the 1.10.0
controlled-performance gate
. It is not a pass. This release makes no speed,
throughput, allocation or RSS claim.

See the 1.10 qualification record for the API
compatibility check, the local and CI lane outcomes and the exception.

The work was integrated through
PR #94,
PR #95,
PR #96,
PR #97,
PR #98 and
PR #99. PR #102 made the envelope schema-version width independent of the target platform.

Final qualification

The annotated 1.10.0 tag targets 564ca8ce5ea057edc847666c4223da20084fc59c, tree 3ee5c5f6946a4548116d8b7aa80e83b432e47f83.

  • Hosted checks. All 21 checks passed on this commit, including native behavior, safety, documentation, composition, platform-floor checks, Git-free source reproduction, and Linux behavior, safety and composition on ARM64 and x86_64. Native CI · Linux CI
  • WASI. All 82 qualification subprocesses passed on Swift 6.4.2 with the full-language wasm32-unknown-wasip1 SDK. The receipt records 2,046 passing test-method executions across Debug and Release, covering the Node root suites and scoped Node and WasmKit consumers. These figures exclude controlled host performance measurements.
  • Documentation and source. DocC covers all 1,805 authored public declarations across 13 catalogs. The Git-free source archive reproduced byte-for-byte and passed all 62 native qualification commands after extraction.
  • Public API compatibility. The SwiftPM API digester reported two package-internal signature changes and exited 1. Review confirmed both findings concern package-only declarations. The public surface is additive over 1.9.0.
  • Exact-version SwiftPM consumer. A fresh package resolved exact: "1.10.0" from this repository to the release commit and tree. Five tests passed in both Debug and Release with Swift 6.4.2 on arm64 macOS 27.3. They exercised canonical writing, six accepted and two rejected envelope schema versions, deterministic structural patch application, and RFC 7464 framing and recovery.

The controlled-performance gate has a maintainer exception for 1.10.0 only. The disposition is excepted_explicitly. Controlled performance was unmeasured, and this release makes no speed, throughput, allocation, RSS, or performance parity claim.

The five assets contain the exact source archive, compiled DocC, the DocC member manifest, the source-bound prepublication qualification receipt, and SHA256SUMS.