CollationDelta
Detect string ordering and equality changes before a runtime upgrade.
CollationDelta records a comparator's results for your string corpus, saves a portable capture, and compares captures offline. Capture a baseline in one runtime and the same corpus and requested profile in another. The original runtimes are needed only to create the captures.
It reports equality merges, equality splits, and order reversals as individual pair
witnesses. Equality means compare(a, b) == 0; it does not mean matching bytes or SQL
equality. A runtime version change alone is not drift.
The Python CLI has no runtime dependencies. The included Node and optional native
Chromium adapters implement the same strict intl.collator.v1 contract. Custom
executable adapters can record an application's own comparator.
Install
CollationDelta 0.2 requires Python 3.10+ on Linux or macOS. Node is needed for Node capture; browser capture also requires an explicitly installed Chromium runtime and optional Playwright toolchain. Windows adapter execution is unsupported.
From source
git clone https://github.com/0then0/collationdelta.git
cd collationdelta
uv sync --locked --python 3.10
uv run --locked collationdelta --help
To install a local wheel:
uv build
uv venv /tmp/collationdelta-install --python 3.10
uv pip install --python /tmp/collationdelta-install/bin/python \
dist/collationdelta-0.2.0-py3-none-any.whl
/tmp/collationdelta-install/bin/collationdelta --version
Published releases
pip install collationdelta==0.2.0
collationdelta --version
Version 0.2.0 includes Node capture, optional native browser capture and Python 3.10 support. The older 0.1.0 release requires Python 3.12+ and includes Node capture only.
Capture and compare
Node is required for this example. Run it from the source checkout:
adapter="$(uv run --locked collationdelta node-adapter)"
uv run --locked collationdelta capture \
--corpus examples/corpus.json --profile examples/profile.json \
--output /tmp/baseline.json -- node "$adapter"
uv run --locked collationdelta capture \
--corpus examples/corpus.json --profile examples/profile.json \
--output /tmp/current.json -- node "$adapter"
uv run --locked collationdelta compare /tmp/baseline.json /tmp/current.json \
--json-output /tmp/report.json
Using the same runtime twice gives a control capture. To check an upgrade, run the first capture in the old environment and the second in the new environment. Offline comparison needs only Python and the two capture files.
For native browser capture, see the
browser guide.
collationdelta browser-adapter prints the bundled browser adapter path. Browser
installation and executable selection are explicit; capture never downloads a browser.
Capture from an open browser (0.3.0)
The source build also includes a small static capture page. Open it in your browser,
choose corpus/profile JSON (or the built-in example), run native Intl.Collator in a
Dedicated Worker and download the observations. No browser installation or Node is
needed on that device. Import and compare on the CLI machine:
uv run --locked collationdelta import-browser collationdelta.browser-export.json \
--output /tmp/browser.capture.json
uv run --locked collationdelta compare /tmp/baseline.capture.json /tmp/browser.capture.json
Use the page for user-opened browsers and the executable adapter for automated Chromium/executable selection. The browser guide covers local HTTP serving, Pages preparation, exact limits, provenance, privacy and manual Safari/mobile checks. Actual page acceptance passed in Chromium 156.0.8078.4 and Firefox 157.0. Safari and physical mobile devices are not yet verified. The page and its resources use the network; file contents/results are not uploaded.
Browser export v1 becomes capture v2 with separate browser metadata, caller labels and importer metadata. Existing capture v1 files remain readable and comparable. Unsupported evidence stays INCOMPLETE; metadata and digests do not authenticate a runtime. This feature requires version 0.3.0 or newer. The Pages site has not been published.
Capture PostgreSQL text comparisons (0.4.0)
The postgres-adapter records what a PostgreSQL 15–18 server returns for <, = and
> on text under one named, schema-qualified collation, using psql in a read-only
transaction. Capture the same corpus and profile on the old and the new server, then
compare the two files offline:
uv run --locked collationdelta capture \
--corpus examples/postgres/corpus.json --profile examples/postgres/order.profile.json \
--output /tmp/old.json -- python "$(uv run --locked collationdelta postgres-adapter)"
Connection and authentication come from the standard psql/libpq environment;
credentials never go into argv, the script or captures. For deterministic collations PostgreSQL resolves ties
by bytes, so equality here is the server's =. Server version, encoding and collation
properties are recorded as metadata, and only differing pairs are findings. The
PostgreSQL guide covers support, limits and failures, and the
saved two-server case is a configuration
control with reproduction steps. This feature requires version 0.4.0 or newer.
Inputs
Corpus JSON assigns a stable ID to each exact string:
{
"version": 1,
"entries": [
{ "id": "rupee", "value": "₨" },
{ "id": "letters", "value": "Rs" },
{ "id": "zero", "value": "0" }
]
}
A requested profile identifies the comparator contract and configuration:
{
"version": 1,
"contract": "intl.collator.v1",
"locale": "en",
"options": { "sensitivity": "base" }
}
IDs must be unique and nonempty. Duplicate values under different IDs are allowed. Strings are preserved exactly: no trimming, case folding, normalization, or removal of controls. Empty strings, U+0000, newlines, combining marks and supplementary characters are supported. Invalid UTF-8 and unpaired surrogates are rejected.
Each capture requests all n² ordered comparisons, including the diagonal, for 1–256 entries. There is no sampling. JSON files are limited to 32 MiB; long strings can reach file or transport limits before the entry limit.
The reference adapters fix localeMatcher to lookup. They support sensitivity,
numeric, caseFirst, ignorePunctuation, usage, and collation. Locale
canonicalization and supported lookup negotiation are allowed. Explicit options and
recognized co, kn, kf extensions must resolve, with explicit options taking
precedence. An unsupported locale or ignored explicit request returns unsupported,
a reason, any known resolved settings, and no comparisons.
See the protocol specification for option values, schemas and custom adapters.
Results and exit codes
Human reports show status, coverage and pair witnesses with IDs, escaped original
strings, Unicode code points and old/new signs. Findings appear once per unordered
pair. --limit N limits displayed findings only; full JSON evidence remains available.
compare --format json prints a deterministic report, and --json-output FILE saves it.
- 0: complete
CAPTUREDorSTABLE; informational commands. - 1: complete
DRIFTwith one or more findings. - 2:
INCOMPLETEorDRIFT_INCOMPLETE. Valid partial or unsupported capture evidence is saved with this code. - 3:
ERROR: invalid or incompatible inputs, corrupt digests, contradictory relations, malformed protocol, launch/crash/timeout or output-limit failure. Capture leaves an existing destination untouched.
Unknown comparisons are never treated as equality. Incomplete evidence can retain a
finding when either direction of the pair was successfully observed on each side;
this does not increase completed coverage or justify STABLE.
Saved runtime examples
The Node upgrade case
compares official Node 18.20.8 and 24.21.0 binaries. It records an equality merge for
₨ / Rs and an order reversal for ₨ / 0, with repeated captures and offline
reports. An unchanged sorted snapshot hides the equality change; a small deduplication
example shows its application consequence.
The Node/browser case
uses eight Icelandic names, Node 24.21.0 and Google Chrome for Testing 156.0.8078.4 on
macOS arm64. Both support en and return STABLE on this corpus. Node supports is;
this browser reports no supported lookup match and known resolved locale en-US.
Strict offline comparison returns INCOMPLETE, zero findings. Fallback relations are
not substituted for missing strict observations.
These are finite comparison experiments, not production incidents or evidence about every browser distribution. Newer builds may legitimately change locale support.
Evidence and guarantees
Captures embed the original corpus, requested profile, effective settings, runtime and adapter metadata, relation signs, explicit failures, coverage and a SHA-256 digest. Executable captures also record invocation details, limits and diagnostics; browser imports record separate page/caller/importer provenance. Loading revalidates the digest, schema, coverage and finite-order consistency.
Compatible captures must have identical ID/value mappings and requested profiles, including locale spelling. Entry order may differ. Effective settings may differ and are reported for interpretation. Validation rejects nonzero self comparisons, nonzero comparisons of identical strings, contradictory reciprocals/equality and strict-order cycles. Partial validation checks only known constraints.
Transport bounds time and stdout/stderr output. The POSIX supervisor terminates the adapter process group on completion and failure. Capture files are written through a temporary file and atomically replaced after validation and serialization succeed.
A digest detects content alteration; it is not a signature or runtime authentication. Version labels and user agents are observations or adapter claims. Preserve executable provenance separately when it matters. Captures may include sensitive strings and argv.
Scope
Stability on a finite corpus says nothing about all Unicode strings. Drift means a
change from the selected baseline, not a specification violation. CollationDelta does
not implement UCA, supply locale data, repair sorting, validate database indexes, or
establish SQL UNIQUE/GROUP BY behavior. The PostgreSQL adapter observes text
comparison operators under a named collation; it still does not inspect indexes or data.
Unicode Conformance tests against Unicode/CLDR specifications. CollationDelta uses your saved comparator baseline. glibc-unicode-sorting studies sorting changes through PostgreSQL over large datasets. CollationDelta uses a bounded user corpus and explicit equality/order witnesses.
Contributing and support
Read the contributing guide for setup, coding conventions, tests and pull requests. Use the issue forms for reproducible bugs and feature requests. Use synthetic inputs rather than private application captures.
Participation follows the Code of Conduct. For suspected vulnerabilities, follow the security policy before sharing details publicly.
Development
uv sync --locked --python 3.10
uv run --locked ruff check .
uv run --locked ruff format --check .
uv run --locked pytest
uv build
See testing and environments for browser integration, supported-runtime coverage and packaging checks. See the changelog and release guide for release maintenance. The project uses the Apache-2.0 license.
Metadata
Release files for collationdelta 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| collationdelta-0.4.0.tar.gz | 201.2 kB | With provenance | Details for collationdelta-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| collationdelta-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for collationdelta-0.4.0-py3-none-any.whl |
Total release size: 237.5 kB
Release files / collationdelta-0.4.0.tar.gz
| Download URL | collationdelta-0.4.0.tar.gz |
|---|---|
| Size | 201.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5c6fe34683e2abdb8d56b19dc4d5b421e9f0498d6609dcdcbdc3773b39b1a8f
|
|
BLAKE2b-256 checksum How to use checksums |
bf9a7d60532a81b938e6bbe82e295777503efa741e5487409fab8a7d003a3a5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / collationdelta-0.4.0-py3-none-any.whl
| Download URL | collationdelta-0.4.0-py3-none-any.whl |
|---|---|
| Size | 36.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f7bdfdba66739657b0eba570922b46c66c29f690ac77a7c104f11810ec32bf0
|
|
BLAKE2b-256 checksum How to use checksums |
40e9f4fdde3cb293d3eea5215f22638632a0ffb8131545dab2b4c4f17a2ee980
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logSecurity for collationdelta 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for collationdelta-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.