collationdelta 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. collationdelta-0.1.0/.github/workflows/ci.yml +38 -0
  2. collationdelta-0.1.0/.github/workflows/release.yml +135 -0
  3. collationdelta-0.1.0/CHANGELOG.md +16 -0
  4. collationdelta-0.1.0/LICENSE +201 -0
  5. collationdelta-0.1.0/MANIFEST.in +8 -0
  6. collationdelta-0.1.0/PKG-INFO +181 -0
  7. collationdelta-0.1.0/README.md +155 -0
  8. collationdelta-0.1.0/docs/case-study.md +76 -0
  9. collationdelta-0.1.0/docs/icon.svg +17 -0
  10. collationdelta-0.1.0/docs/protocol.md +100 -0
  11. collationdelta-0.1.0/docs/releasing.md +54 -0
  12. collationdelta-0.1.0/docs/validation.md +95 -0
  13. collationdelta-0.1.0/evidence/node-upgrade/experiment.json +71 -0
  14. collationdelta-0.1.0/evidence/node-upgrade/linux-experiment.json +71 -0
  15. collationdelta-0.1.0/evidence/node-upgrade/new-control.report.json +89 -0
  16. collationdelta-0.1.0/evidence/node-upgrade/new-repeat.capture.json +134 -0
  17. collationdelta-0.1.0/evidence/node-upgrade/new.capture.json +134 -0
  18. collationdelta-0.1.0/evidence/node-upgrade/old-control.report.json +89 -0
  19. collationdelta-0.1.0/evidence/node-upgrade/old-repeat.capture.json +134 -0
  20. collationdelta-0.1.0/evidence/node-upgrade/old.capture.json +134 -0
  21. collationdelta-0.1.0/evidence/node-upgrade/upgrade.report.json +130 -0
  22. collationdelta-0.1.0/evidence/node-upgrade/upgrade.txt +22 -0
  23. collationdelta-0.1.0/examples/application.mjs +23 -0
  24. collationdelta-0.1.0/examples/application_adapter.py +68 -0
  25. collationdelta-0.1.0/examples/corpus.json +8 -0
  26. collationdelta-0.1.0/examples/profile.json +6 -0
  27. collationdelta-0.1.0/pyproject.toml +61 -0
  28. collationdelta-0.1.0/scripts/node-pins.json +18 -0
  29. collationdelta-0.1.0/scripts/reproduce_case.py +143 -0
  30. collationdelta-0.1.0/setup.cfg +4 -0
  31. collationdelta-0.1.0/src/collationdelta/__init__.py +3 -0
  32. collationdelta-0.1.0/src/collationdelta/__main__.py +3 -0
  33. collationdelta-0.1.0/src/collationdelta/adapters/node.mjs +127 -0
  34. collationdelta-0.1.0/src/collationdelta/cli.py +86 -0
  35. collationdelta-0.1.0/src/collationdelta/evidence.py +231 -0
  36. collationdelta-0.1.0/src/collationdelta/formats.py +168 -0
  37. collationdelta-0.1.0/src/collationdelta/observations.py +154 -0
  38. collationdelta-0.1.0/src/collationdelta/transport.py +92 -0
  39. collationdelta-0.1.0/src/collationdelta.egg-info/PKG-INFO +181 -0
  40. collationdelta-0.1.0/src/collationdelta.egg-info/SOURCES.txt +48 -0
  41. collationdelta-0.1.0/src/collationdelta.egg-info/dependency_links.txt +1 -0
  42. collationdelta-0.1.0/src/collationdelta.egg-info/entry_points.txt +2 -0
  43. collationdelta-0.1.0/src/collationdelta.egg-info/top_level.txt +1 -0
  44. collationdelta-0.1.0/tests/conftest.py +50 -0
  45. collationdelta-0.1.0/tests/test_core.py +241 -0
  46. collationdelta-0.1.0/tests/test_node.py +163 -0
  47. collationdelta-0.1.0/tests/test_regressions.py +257 -0
  48. collationdelta-0.1.0/tests/test_saved_evidence.py +41 -0
  49. collationdelta-0.1.0/tests/test_transport_cli.py +141 -0
  50. collationdelta-0.1.0/uv.lock +108 -0
@@ -0,0 +1,38 @@
1
+ name: Python core and Node adapter
2
+ on: [push, pull_request, workflow_dispatch, workflow_call]
3
+ permissions:
4
+ contents: read
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ os: [ubuntu-latest, macos-latest]
11
+ python: ['3.12', '3.13', '3.14']
12
+ runs-on: ${{ matrix.os }}
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: ${{ matrix.python }}
18
+ - uses: actions/setup-node@v4
19
+ with:
20
+ node-version: '24.21.0'
21
+ - uses: astral-sh/setup-uv@v6
22
+ with:
23
+ version: '0.12.23'
24
+ - run: uv sync --locked --python '${{ matrix.python }}'
25
+ - run: uv run --locked ruff check .
26
+ - run: uv run --locked ruff format --check .
27
+ - run: uv run --locked pytest -q
28
+ - run: uv build
29
+ - name: Install wheel without dependencies and exercise installed CLI
30
+ shell: bash
31
+ run: |
32
+ uv venv "$RUNNER_TEMP/collationdelta-install" --python '${{ matrix.python }}'
33
+ uv pip install --no-deps --python "$RUNNER_TEMP/collationdelta-install/bin/python" dist/*.whl
34
+ cli="$RUNNER_TEMP/collationdelta-install/bin/collationdelta"
35
+ cd "$RUNNER_TEMP"
36
+ "$cli" --help
37
+ "$cli" capture --corpus "$GITHUB_WORKSPACE/examples/corpus.json" --profile "$GITHUB_WORKSPACE/examples/profile.json" --output baseline.json -- node "$("$cli" node-adapter)"
38
+ "$cli" compare baseline.json baseline.json --json-output report.json
@@ -0,0 +1,135 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: ['v*']
6
+ release:
7
+ types: [published]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: pypi-${{ github.event.release.tag_name || github.ref_name }}
14
+ cancel-in-progress: false
15
+
16
+ jobs:
17
+ checks:
18
+ if: startsWith(github.event.release.tag_name || github.ref_name, 'v') && !github.event.release.prerelease
19
+ uses: ./.github/workflows/ci.yml
20
+
21
+ build:
22
+ needs: checks
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ with:
27
+ ref: ${{ github.event.release.tag_name || github.ref_name }}
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: '3.12'
31
+ - uses: astral-sh/setup-uv@v6
32
+ with:
33
+ version: '0.12.23'
34
+ - name: Validate release version
35
+ env:
36
+ RELEASE_TAG: ${{ github.event.release.tag_name || github.ref_name }}
37
+ run: |
38
+ python - <<'PY'
39
+ import os
40
+ import runpy
41
+ import tomllib
42
+ from pathlib import Path
43
+
44
+ project = tomllib.loads(Path('pyproject.toml').read_text())['project']
45
+ version = project['version']
46
+ runtime_version = runpy.run_path('src/collationdelta/__init__.py')['__version__']
47
+ if project['name'] != 'collationdelta' or os.environ['RELEASE_TAG'] != f'v{version}' or runtime_version != version:
48
+ raise SystemExit('Release tag, package name, and version metadata must agree')
49
+ PY
50
+ - run: uv lock --check
51
+ - run: uv build
52
+ - run: uvx --from twine==6.2.0 twine check --strict dist/*
53
+ - uses: actions/upload-artifact@v4
54
+ with:
55
+ name: distributions
56
+ path: dist/*
57
+ if-no-files-found: error
58
+
59
+ github-release:
60
+ needs: build
61
+ runs-on: ubuntu-latest
62
+ permissions:
63
+ contents: write
64
+ steps:
65
+ - uses: actions/checkout@v4
66
+ with:
67
+ ref: ${{ github.event.release.tag_name || github.ref_name }}
68
+ - uses: actions/download-artifact@v4
69
+ with:
70
+ name: distributions
71
+ path: dist
72
+ - name: Create GitHub Release and attach distributions
73
+ env:
74
+ GH_TOKEN: ${{ github.token }}
75
+ RELEASE_TAG: ${{ github.event.release.tag_name || github.ref_name }}
76
+ run: |
77
+ python - <<'PY'
78
+ import json
79
+ import os
80
+ import urllib.error
81
+ import urllib.parse
82
+ import urllib.request
83
+ from pathlib import Path
84
+
85
+ headers = {
86
+ 'Authorization': f"Bearer {os.environ['GH_TOKEN']}",
87
+ 'Accept': 'application/vnd.github+json',
88
+ 'X-GitHub-Api-Version': '2022-11-28',
89
+ }
90
+ base = f"https://api.github.com/repos/{os.environ['GITHUB_REPOSITORY']}"
91
+ tag = os.environ['RELEASE_TAG']
92
+
93
+ def request(url, data=None, content_type='application/json'):
94
+ req = urllib.request.Request(url, data=data, headers={**headers, 'Content-Type': content_type})
95
+ with urllib.request.urlopen(req, timeout=60) as response:
96
+ return json.load(response)
97
+
98
+ try:
99
+ release = request(f'{base}/releases/tags/{urllib.parse.quote(tag, safe="")}')
100
+ except urllib.error.HTTPError as error:
101
+ if error.code != 404:
102
+ raise
103
+ notes = Path('CHANGELOG.md').read_text().split(f'## {tag[1:]}\n', 1)[1].split('\n## ', 1)[0].strip()
104
+ release = request(f'{base}/releases', json.dumps({
105
+ 'tag_name': tag,
106
+ 'target_commitish': os.environ['GITHUB_SHA'],
107
+ 'name': tag,
108
+ 'body': notes,
109
+ 'draft': False,
110
+ 'prerelease': False,
111
+ }).encode())
112
+ existing = {asset['name'] for asset in release['assets']}
113
+ upload = release['upload_url'].split('{', 1)[0]
114
+ artifacts = sorted([*Path('dist').glob('*.whl'), *Path('dist').glob('*.tar.gz')])
115
+ for artifact in artifacts:
116
+ if artifact.name not in existing:
117
+ request(f'{upload}?name={urllib.parse.quote(artifact.name)}', artifact.read_bytes(), 'application/octet-stream')
118
+ print(release['html_url'])
119
+ PY
120
+
121
+ publish:
122
+ needs: [build, github-release]
123
+ runs-on: ubuntu-latest
124
+ environment:
125
+ name: pypi
126
+ url: https://pypi.org/project/collationdelta/
127
+ permissions:
128
+ id-token: write
129
+ steps:
130
+ - uses: actions/download-artifact@v4
131
+ with:
132
+ name: distributions
133
+ path: dist
134
+ - name: Publish distributions with Trusted Publishing
135
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ First release of the local capture and offline comparison CLI.
6
+
7
+ - Observe all ordered pairs in a corpus of up to 256 records through an executable application adapter.
8
+ - Detect equality merges, equality splits, and order reversals with deterministic pair witnesses and explicit coverage.
9
+ - Preserve original Unicode scalar strings and validate finite-order consistency, capture digests, and corpus/profile compatibility.
10
+ - Keep confirmed findings from partial observations, including opposite observed pair directions, without claiming complete coverage.
11
+ - Bound subprocess time and output, and write JSON files atomically.
12
+ - Include a Node `Intl.Collator` reference adapter and a custom application adapter example.
13
+ - Include a reproducible Node 18.20.8 to 24.21.0 upgrade experiment, saved evidence, and same-runtime controls.
14
+ - Support Python 3.12+ on Linux and macOS, with no Python runtime dependencies.
15
+
16
+ See the [validation report](https://github.com/0then0/collationdelta/blob/main/docs/validation.md) for tested environments and limitations.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ include uv.lock
2
+ include CHANGELOG.md
3
+ recursive-include docs *.md *.svg
4
+ recursive-include examples *.json *.py *.mjs
5
+ recursive-include scripts *.py *.json
6
+ recursive-include evidence *.json *.txt
7
+ recursive-include tests *.py
8
+ recursive-include .github *.yml
@@ -0,0 +1,181 @@
1
+ Metadata-Version: 2.4
2
+ Name: collationdelta
3
+ Version: 0.1.0
4
+ Summary: Detect string ordering and equality changes before a runtime upgrade.
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/0then0/collationdelta
7
+ Project-URL: Repository, https://github.com/0then0/collationdelta
8
+ Project-URL: Documentation, https://github.com/0then0/collationdelta/blob/main/README.md
9
+ Project-URL: Issues, https://github.com/0then0/collationdelta/issues
10
+ Project-URL: Changelog, https://github.com/0then0/collationdelta/blob/main/CHANGELOG.md
11
+ Keywords: collation,unicode,cli,runtime-upgrade,drift-detection
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Operating System :: MacOS :: MacOS X
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Software Development :: Testing
22
+ Requires-Python: >=3.12
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Dynamic: license-file
26
+
27
+ <p align="center"><img src="https://raw.githubusercontent.com/0then0/collationdelta/main/docs/icon.svg" width="88" height="88" alt="CollationDelta: two string relations joined by a delta" /></p>
28
+
29
+ # CollationDelta
30
+
31
+ **Detect string ordering and equality changes before a runtime upgrade.**
32
+
33
+ [![PyPI](https://img.shields.io/pypi/v/collationdelta)](https://pypi.org/project/collationdelta/)
34
+ ![Python requirement](https://img.shields.io/badge/requires-Python%203.12%2B-blue)
35
+ ![Runtime dependencies](https://img.shields.io/badge/core-runtime%20dependencies%200-green)
36
+ ![License](https://img.shields.io/badge/license-Apache%202.0-blue)
37
+
38
+ CollationDelta records the actual comparison results for your finite string corpus through an executable adapter. Capture a baseline in the old environment, capture the same corpus and requested profile in the new environment, then compare the two files offline. The old runtime is no longer needed.
39
+
40
+ It reports equality merges, equality splits, and order reversals as individual pair witnesses. **Equality means `compare(a, b) == 0`**, not matching bytes, Unicode identity, or SQL equality. A runtime version change alone is not drift; a changed relation is drift even when version labels stay the same.
41
+
42
+ ## Install and try
43
+
44
+ Python 3.12 or newer is required. Node is needed only to capture through the included `Intl.Collator` adapter. There are no Python runtime dependencies and no npm dependencies.
45
+
46
+ For a published release, install from PyPI:
47
+
48
+ ```sh
49
+ pip install collationdelta==0.1.0
50
+ collationdelta --help
51
+ ```
52
+
53
+ To try the source checkout, including the example input files:
54
+
55
+ ```sh
56
+ git clone https://github.com/0then0/collationdelta.git
57
+ cd collationdelta
58
+ ```
59
+
60
+ Then run:
61
+
62
+ ```sh
63
+ uv sync --locked --python 3.12
64
+ uv run collationdelta --help
65
+ uv run collationdelta capture \
66
+ --corpus examples/corpus.json --profile examples/profile.json \
67
+ --output /tmp/baseline.json -- node "$(uv run collationdelta node-adapter)"
68
+ uv run collationdelta capture \
69
+ --corpus examples/corpus.json --profile examples/profile.json \
70
+ --output /tmp/current.json -- node "$(uv run collationdelta node-adapter)"
71
+ uv run collationdelta compare /tmp/baseline.json /tmp/current.json \
72
+ --json-output /tmp/report.json
73
+ ```
74
+
75
+ The same-runtime control returns `STABLE`. Use the old environment for the first command and the upgraded environment for the second to check an upgrade. The shell substitution above locates the installed adapter; CollationDelta itself runs the supplied argv without shell interpolation.
76
+
77
+ To build and install locally:
78
+
79
+ ```sh
80
+ uv build
81
+ uv venv /tmp/collationdelta-install --python 3.12
82
+ uv pip install --python /tmp/collationdelta-install/bin/python dist/collationdelta-0.1.0-py3-none-any.whl
83
+ /tmp/collationdelta-install/bin/collationdelta --help
84
+ ```
85
+
86
+ The Node adapter ships inside the wheel; `collationdelta node-adapter` prints its location after installation.
87
+
88
+ ## Inputs and guarantees
89
+
90
+ Corpus JSON:
91
+
92
+ ```json
93
+ {
94
+ "version": 1,
95
+ "entries": [
96
+ { "id": "rupee", "value": "₨" },
97
+ { "id": "letters", "value": "Rs" },
98
+ { "id": "zero", "value": "0" }
99
+ ]
100
+ }
101
+ ```
102
+
103
+ Profile JSON:
104
+
105
+ ```json
106
+ {
107
+ "version": 1,
108
+ "contract": "intl.collator.v1",
109
+ "locale": "en",
110
+ "options": { "sensitivity": "base" }
111
+ }
112
+ ```
113
+
114
+ IDs are unique, nonempty, stable strings. Duplicate values under different IDs are allowed. Values are preserved exactly: no trimming, case folding, normalization, control-character removal, or deduplication. Empty strings, embedded U+0000, newlines, combining marks, and supplementary characters are supported. Invalid UTF-8 and unpaired surrogates are rejected. JSON-escaped valid surrogate pairs decode to their scalar character.
115
+
116
+ The corpus must have **1–256 entries**. Each capture requests all `n²` ordered comparisons, including the diagonal, in a single process. A complete capture of 256 entries contains 65,536 comparisons. No sampling is used. JSON input/output files are limited to 32 MiB; long strings may reach transport or file limits before the entry limit.
117
+
118
+ The requested profile is distinct from adapter-reported effective settings and runtime/provider metadata. The Node adapter reports `process.version`, ICU, CLDR and Unicode versions when available, and `resolvedOptions()`. A custom adapter's version claim is evidence supplied by that adapter, not independent verification of its environment.
119
+
120
+ Supported Node options are `sensitivity`, `numeric`, `caseFirst`, `ignorePunctuation`, `usage`, and `collation`. The adapter delegates every comparison to `Intl.Collator`. It allows locale canonicalization and lookup negotiation, such as `EN-us` or a supported language with an unavailable region. Unsupported locales and silently ignored explicit collations are reported as unsupported. Explicit options and the recognized `co`, `kn`, `kf` locale extensions must resolve; explicit options take precedence over extensions. Other locale extensions do not define this adapter's comparison contract. See [the protocol guide](https://github.com/0then0/collationdelta/blob/main/docs/protocol.md) for the exact option values and custom adapters.
121
+
122
+ ## Results and exit codes
123
+
124
+ Human reports begin with status and coverage: entries, expected/completed comparisons, missing/failed comparisons, and completeness. Each finding contains both IDs, safely escaped original values, Unicode code points, old/new relation signs, runtime metadata, and effective settings. Reciprocal comparisons validate the observation; findings appear once per unordered pair. A pair is a direct witness, not a claim of global minimization.
125
+
126
+ `compare --format json` emits a versioned, deterministic full report. `--json-output FILE` also saves it alongside human output. `--limit N` affects only the number of findings shown in human output; total counts and JSON evidence remain complete. The full JSON report contains shared old/new runtime and effective metadata in `sides`, referenced by every finding's old/new relations.
127
+
128
+ - **0:** `STABLE` for complete, valid, compatible captures; `CAPTURED` for a successful complete capture; informational commands.
129
+ - **1:** `DRIFT`, with complete observations and one or more findings.
130
+ - **2:** `INCOMPLETE` or `DRIFT_INCOMPLETE`. Capture also returns 2 for unsupported/unresolved configuration or missing/failed comparisons and saves the valid partial evidence.
131
+ - **3:** `ERROR`: invalid input, incompatible captures, inconsistent relations, digest failure, launch/crash/timeout/output limit failure, or malformed protocol. No new capture is written on a transport/protocol error.
132
+
133
+ Incomplete comparison preserves findings for a pair observed successfully in either direction on each side, even when diagonal or reciprocal observations are missing. Each side is independently oriented by stable IDs; the inferred reverse sign does not increase completed coverage. Unknown results are never equality. A successful process with missing pair responses produces explicit incomplete coverage; duplicate or unrequested pair responses are protocol errors. A crash with partial stdout is a transport error because a single-batch response cannot be trusted as a finished protocol document.
134
+
135
+ ## Real runtime upgrade evidence
136
+
137
+ The [reproducible case study](https://github.com/0then0/collationdelta/blob/main/docs/case-study.md) compares the official Node **18.20.8 / ICU 74.2 / CLDR 44.1** and **24.21.0 / ICU 78.3 / CLDR 48.0** binaries with the same `en` / `sensitivity: base` profile. Saved captures and reports are in [evidence/node-upgrade](https://github.com/0then0/collationdelta/tree/main/evidence/node-upgrade). They show an equality merge for `₨` / `Rs` and an order reversal for `₨` / `0`, a same-runtime control, repeated observations, and offline analysis.
138
+
139
+ The two-element sorted snapshot `["₨", "Rs"]` stays the same while equality changes. The included **demonstration application example** sorts and removes adjacent collation-equal strings; its result changes from two records to one. This is a demonstration, not an external production incident. The experiment upgrades the entire Node runtime and does not isolate the effect of ICU alone.
140
+
141
+ ## Evidence and consistency
142
+
143
+ Captures embed corpus, requested profile, effective settings, normalized signs, explicit failures, coverage, runtime/adapter metadata, invocation argv, working directory, platform, UTC timestamp, limits, diagnostics, and a SHA-256 content digest. The digest detects accidental or uncoordinated content alteration; anyone able to edit a capture can recompute it. It is not a signature or proof of runtime authenticity. Environment variables, application configuration files, and executable contents are not bundled; preserve them separately when needed for reproduction. Captures may contain sensitive corpus values and command arguments.
144
+
145
+ On load, CollationDelta validates the schema, digest, observations, and recomputed coverage. Corpus ID/value mappings must match exactly, although record order may differ. Requested profiles must match exactly, including locale spelling; canonicalization is an adapter operation during capture. Effective settings may differ and are exposed for interpretation rather than silently requiring agreement.
146
+
147
+ The consistency check treats identical string values under different IDs as equal and rejects nonzero comparisons between them, nonzero self comparisons, inconsistent reciprocal results, contradictions in equality components, and cycles of strict order. Union-find constructs equality components, then topological traversal checks the graph of strict relations. Time is `O(n² α(n))` and memory `O(n²)` for a full corpus; `α(n)` is the near-constant inverse Ackermann cost of union-find. For partial observations this checks whether known relations can extend to a total preorder; it cannot verify unknown relations. Contradictory observations are errors, never equivalence classes or stability claims.
148
+
149
+ ## Related work and boundaries
150
+
151
+ [Unicode Conformance](https://github.com/unicode-org/conformance) provides data-driven testing against Unicode/CLDR specifications across implementations. CollationDelta shares the idea of executable comparison observations, but its reference is your saved application baseline rather than specification conformance.
152
+
153
+ [glibc-unicode-sorting](https://github.com/ardentperf/glibc-unicode-sorting) studies sorting changes across OS/ICU versions through PostgreSQL, including sorted-output checksums over large datasets. CollationDelta uses a bounded user corpus and explicit equality/order pair witnesses. The distinction is the combination of **your corpus, your actual application comparator, a portable baseline, and separate equality drift detection**. It does not imply that other tools cannot compare pairs or accept custom data.
154
+
155
+ [ICU 76 release notes](https://unicode-org.github.io/icu/download/76.html) document root-collation changes, including currency-symbol ordering; [the ICU Collation API guide](https://unicode-org.github.io/icu/userguide/collation/api.html) describes direct string comparisons and warns that keys from different collators are not comparable. CollationDelta compares observed relation signs, never persisted sort-key bytes, and adds no bytewise tiebreaker. The release notes provide context for the case, not proof of its isolated cause.
156
+
157
+ Stability on a finite corpus says nothing about all Unicode strings. Drift means a change relative to the selected baseline, not an error in the new implementation. Node comparison evidence does not establish SQL `UNIQUE`, `GROUP BY`, or any database collation's behavior. This tool checks neither physical database index correctness nor provider/database rebuild requirements.
158
+
159
+ v0.1 is a local capture/compare CLI. It does not implement UCA, offer a universal conformance suite, fuzz all Unicode, scan production databases, manage runtimes/Docker, migrate databases, run `REINDEX`, accept new baselines automatically, or recommend remediation without application evidence. It has one reference Node adapter and one custom-adapter example; no web UI, daemon, SaaS, or plugin registry.
160
+
161
+ ## Development and validation
162
+
163
+ ```sh
164
+ uv sync --locked --python 3.12
165
+ uv run --locked ruff check .
166
+ uv run --locked ruff format --check .
167
+ uv run --locked pytest
168
+ uv build
169
+ ```
170
+
171
+ Tests cover drift types, Unicode preservation, finite-order consistency, strict protocol/transport failures, partial evidence, corruption, deterministic reports, offline comparison, and the actual Node adapter. Unit tests use synthetic fixtures only for controlled core and failure cases; the historical upgrade uses official binaries. Unit tests never download historical runtimes.
172
+
173
+ Ruff checks Python errors, imports, Python 3.12 modernization, and common bug patterns with a 100-column formatting target. To apply formatting, run `uv run --locked ruff format .`. The formatter controls wrapping; long strings and comments are exempt from the linter's line-length check.
174
+
175
+ The CLI's POSIX process transport targets Linux and macOS. CI is configured for both with Python 3.12–3.14 and Node 24.21.0, including clean-wheel installation. Local verification results and unverified platform claims are recorded in the [validation report](https://github.com/0then0/collationdelta/blob/main/docs/validation.md). Windows adapter execution is unsupported in v0.1.
176
+
177
+ The existing [Apache-2.0 license](https://github.com/0then0/collationdelta/blob/main/LICENSE) applies to this project. Node downloads remain separate, external artifacts with their own licensing.
178
+
179
+ ## Releases
180
+
181
+ Release notes are in the [changelog](https://github.com/0then0/collationdelta/blob/main/CHANGELOG.md). Maintainers can follow the [release guide](https://github.com/0then0/collationdelta/blob/main/docs/releasing.md) to publish a version through PyPI Trusted Publishing.